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 trying to build a small C++ program that uses the generated tiny_data.cpp, by calling set_x0 and set_x_ref, like codegen/pywrapper/bindings.cpp.
However, when calling set_x0 (copied from codegen/pywrapper/bindings.cpp) I get a runtime error;
The call to the inner tiny_set_x0 (that expects a tinyVector) fails, as it tries to pass a matrix (that is, more than 1 rows and cols) as an argument (the result of the x0.replicate in here line 25) to a tinyVector. Which Eigen does not like, as it expects the matrix being cast to have at least one dimension of size 1.
(The following message is printed: Assertion `other.rows() == 1 || other.cols() == 1' failed)
I see that codegen/pywrapper/bindings.cpp is used for tinympcgen's operations (set_x0, set_x_ref etc.). Is it that Pybind11's Eigen implementation prevents this from failing (as opposed to when running these lines in pure C++ and Eigen like i've tried)?
Is the replication necessary in the case of set_x0? Is it some kind of necessity from using Pybind11? or am I missing something.
Thanks.
The text was updated successfully, but these errors were encountered:
levioctl
changed the title
Cannot use set_x0 in codegen/pywrapper/bindings.py
Cannot use set_x0 in codegen/pywrapper/bindings.cpp
Jan 26, 2025
Hi,
I'm trying to build a small C++ program that uses the generated tiny_data.cpp, by calling
set_x0
andset_x_ref
, like codegen/pywrapper/bindings.cpp.However, when calling
set_x0
(copied from codegen/pywrapper/bindings.cpp) I get a runtime error;The call to the inner
tiny_set_x0
(that expects atinyVector
) fails, as it tries to pass a matrix (that is, more than 1 rows and cols) as an argument (the result of thex0.replicate
in here line 25) to atinyVector
. Which Eigen does not like, as it expects the matrix being cast to have at least one dimension of size 1.(The following message is printed:
Assertion `other.rows() == 1 || other.cols() == 1' failed
)I see that codegen/pywrapper/bindings.cpp is used for tinympcgen's operations (
set_x0
,set_x_ref
etc.). Is it that Pybind11's Eigen implementation prevents this from failing (as opposed to when running these lines in pure C++ and Eigen like i've tried)?Is the replication necessary in the case of
set_x0
? Is it some kind of necessity from using Pybind11? or am I missing something.Thanks.
The text was updated successfully, but these errors were encountered: