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
I'm looking for best practices to pass types by copy to JS that are mainly (big) arrays, like those used by Eigen. Right now we are returning val objects that we construct by hand, for example converting Eigen::MatrixXd (2d array with dynamic size) from and to:
{
rows: Number
cols: Number
data: Float64Array}
Would this also be possible with automatic conversions, so we could have function returning/taking Eigen::MatrixXd instead val? Is this possible using something like value_object (with getter return val and setter taking val)? We would like to avoid pure memory views into the heap, as we are using a grow-able heap and also don't want explicit memory management on the JS side.
Are there best practices for this case? For example, pybind maps to automatically to numpy.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi fellow web binders,
I'm looking for best practices to pass types by copy to JS that are mainly (big) arrays, like those used by
Eigen
. Right now we are returningval
objects that we construct by hand, for example convertingEigen::MatrixXd
(2d array with dynamic size) from and to:Would this also be possible with automatic conversions, so we could have function returning/taking
Eigen::MatrixXd
insteadval
? Is this possible using something likevalue_object
(withgetter
returnval
and setter takingval
)? We would like to avoid pure memory views into the heap, as we are using a grow-able heap and also don't want explicit memory management on the JS side.Are there best practices for this case? For example,
pybind
maps to automatically tonumpy
.Thanks!
Sven
Beta Was this translation helpful? Give feedback.
All reactions