You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, for numeric types which need heap allocation (multiprecision types), this causes the return of a brand-new object. But the problem is not limited to the heap allocation, which could possibly be benign. In my case, the contents of the vectors for multiprecision types are in fact of variable precision. Observe:
import pybertini
pybertini.default_precision() # gives 16
v = pybertini.multiprec.Vector(2) # make a vector of default-constructed multiprecision complex numbers (0's)
pybertini.default_precision(20) # change precision of future-made objects. does not affect current objects.
v[0].precision() # erroneously gives 20, should give 16
So, if I make a vector of multiprecision numbers at one precision, then change the default precision to something else, and then get an element of that same vector -- which has not changed precision -- i get
a new copy of that entry
at the wrong precision (doesn't actually match the internal precision of the vector).
I hence propose a modification to the VectorVisitor's get_item -- that it return an internal reference. However, perhaps this is not the desired behaviour -- should I modify minieigen so that the decision of internal reference vs copy is a policy?
Pull request will be incoming..
The text was updated successfully, but these errors were encountered:
Go ahead and fork. Minieigen was developed with plain (machine) numeric types where this was never an issue. I think there must have been some reason for not returning internal references for plain numeric types. Perhaps you find a way to return internal reference for multiprecision types and keep the current behavior for plain numeric types.
the return type for VectorVisitor's
get_item
is as in this line of code:However, for numeric types which need heap allocation (multiprecision types), this causes the return of a brand-new object. But the problem is not limited to the heap allocation, which could possibly be benign. In my case, the contents of the vectors for multiprecision types are in fact of variable precision. Observe:
So, if I make a vector of multiprecision numbers at one precision, then change the default precision to something else, and then get an element of that same vector -- which has not changed precision -- i get
I hence propose a modification to the VectorVisitor's
get_item
-- that it return an internal reference. However, perhaps this is not the desired behaviour -- should I modify minieigen so that the decision of internal reference vs copy is a policy?Pull request will be incoming..
The text was updated successfully, but these errors were encountered: