memory-efficient implementation for multithreading computations needed for lbfgs optimization. details: https://github.com/ldmt-muri/alignment-with-openfst/issues/83