
This code is sourced from <a href=https://www.logos.ic.i.u-tokyo.ac.jp/~tsuruoka/lapos/>lapos</a> and sub sequently heavily refactored.
