This PR implements several performance improvements related to FunctionBasedPath by speeding up function evaluations in MultivariatePolynomialFunction and adding a few new options to PolynomialPathFitter. A brief list of the main changes:
Added the internal helper class MultivariatePolynomial for computing basic symbolic polynomial function operations.
Refactored MultivariatePolynomialFunction to compute function values and derivatives based on Horner's scheme.
Added the method generateDerivativeFunction and generatePartialVelocityFunction to MultivariatePolynomialFunction for conveniently generating moment arm and lengthening speed functions from a muscle path function.
Added the properties include_moment_arm_functions and include_lengthening_speed_function to PolynomialPathFitter, which leverage the above methods.
Replaced current least-squares fitting in PolynomialPathFitter with SimTK::FactorQTZ, which should be more robust to poorly conditioned A matrices (this is often the case for the multivariate polynomials since the terms can be highly correlated).
Fixed the bug described in #3759.
Testing I've completed
Added related tests to testFunctions.cpp and testWrapping.cpp. A summery of the performance benchmarking is below (seeing a ~20-25% speed up).
Fixes issue #3759, #3762. Partially addresses #3761.
Brief summary of changes
This PR implements several performance improvements related to
FunctionBasedPath
by speeding up function evaluations inMultivariatePolynomialFunction
and adding a few new options toPolynomialPathFitter
. A brief list of the main changes:MultivariatePolynomial
for computing basic symbolic polynomial function operations.MultivariatePolynomialFunction
to compute function values and derivatives based on Horner's scheme.generateDerivativeFunction
andgeneratePartialVelocityFunction
toMultivariatePolynomialFunction
for conveniently generating moment arm and lengthening speed functions from a muscle path function.include_moment_arm_functions
andinclude_lengthening_speed_function
toPolynomialPathFitter
, which leverage the above methods.PolynomialPathFitter
withSimTK::FactorQTZ
, which should be more robust to poorly conditionedA
matrices (this is often the case for the multivariate polynomials since the terms can be highly correlated).Testing I've completed
Added related tests to
testFunctions.cpp
andtestWrapping.cpp
. A summery of the performance benchmarking is below (seeing a ~20-25% speed up).Looking for feedback on...
CHANGELOG.md (choose one)
[perf-win]
Performance analysis
Platform: Windows, self-hosted runner
This change is![Reviewable](https://reviewable.io/review_button.svg)