eigency | Cython interface to Eigen library | Data Manipulation library
kandi X-RAY | eigency Summary
kandi X-RAY | eigency Summary
Eigency is a Cython interface between Numpy arrays and Matrix/Array objects from the Eigen C++ library. It is intended to simplify the process of writing C++ extensions using the Eigen library. Eigency is designed to reuse the underlying storage of the arrays when passing data back and forth, and will thus avoid making unnecessary copies whenever possible. Only in cases where copies are explicitly requested by your C++ code will they be made.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of eigency
eigency Key Features
eigency Examples and Code Snippets
Community Discussions
Trending Discussions on eigency
QUESTION
I have a C++ function which I want to run from Python. For this I use Cython. My C++ function relies heavily on Eigen matrices which I map to Python's Numpy matrices using Eigency.
I cannot get this to work for the case where I have a list of Numpy matrices.
What does works (mapping a plain Numpy matrix to an Eigen matrix):
I have a C++ function which in the header (Header.h) looks like:
...ANSWER
Answered 2021-Dec-01 at 18:34Thanks to @ead I found a solution.
FlattenedMapWithOrder
has implementation so it can be assinged to an Eigen::Matrix
.
However, std::vector
does not have such functionality and since std::vector
and std::vector
are of a different type, they cannot be assigned to one another.
More about this here.
The implementation in FlattenedMapWithOrder
mentioned above is here.
To solve this, the function in the C++ code called from Cython need to simply have as input argument the matching type: std::vector
.
To do this, the C++ code needs to know the definition of type FlattenedMapWithOrder
.
To do this, you need to #include "eigency_cpp.h"
. Unfortunately, this header is not self contained.
Therefore, (credits to @ead) I added these lines:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install eigency
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page