Minor update the pyEXP CoefStruct interface #112
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This commit overloads
CoefStruct::setCoefs()to have two call signatures:CoefStructdata storeCoefStruct::getCoefs()orCoefStruct::setCoefs(); that is, with the signaturevoid CoefStruct::getCoefs(Eigen::VectorXcd& array)and sets the underlying data store from array.This gets around the confusion of needing to set the values of
CfromC=CoefStruct::setCoefs()element by element which is a bad use of the numpy API, imho.Tests
Tested on the 'custom force' notebook from
pyEXP-examples/Tutorials/Orbitsto confirm that both methods give the same results. This improves the readability the force function in this notebook very nicely! I will check that into EXP-code/pyEXP-examples/#13 if we decide to keep this change.Notes
This PR adds new minor functionality and, therefore, this addition should not conflict with any current usage pattern and break existing code.