Registered Member
|
Hello Admin,
I am new to eigen, not to c++. I need to re-implement a complex linear algebra code in C++. So I need to use eigen library. Here is the code:
It is highly complicated code in numpy, that's why. Can you please let me know whether it is possible to achieve above linear algebra code in EIgen in a fast way? Thanks in advance |
Registered Member
|
Eigen::Map and Eigen::Select can emulate pythonic lvalue and rvalue, boolean- and index- based array slicing in some ways and not others.
Casting an Eigen matrix/vector to an Eigen::Array enables element-wise operations (in-place and as an rvalue). Eigen::AlignedBox lets you have that grid-aligned bounding box functionality to see if points are contained. I'm not familiar with Eigen's Geometry module, so I don't know if you can get the python-vectorized syntax of np.logical_and. I don't think Eigen's templates support the generic boolean and numeric container interface that np.array does, or has anything like np.unique. And I don't think it supports the dynamic reshaping found in "point_cloud = point_cloud[bound_box]". You may need to manage temporaries and other memory on your own, where python would convienently do it for you before. And you'll probably benefit from using standard c++ containers and algorithms in some places, like an std::unordered_set or std::unique. Are there any other features you're worried about? |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]