This forum has been archived. All content is frozen. Please use KDE Discuss instead.

3d array manipulation

Tags: None
(comma "," separated)
weiliu620\
Registered Member
Posts
3
Karma
0
OS

3d array manipulation

Mon Aug 17, 2009 4:22 pm
Is there a easy way to extend the matrix to 3D array? I need to compute something like A+B, 2*A, where A and B are 3 dimensional array/volume data. I guess I can define some tensor type for the element of a matrix, so each element of a matrix is a vector itself. But I did not find any information about that. The main page said it's easy to extend to 'user-defined' type for matrix. I'll appreciate if anyone can give me a clue.

Wei Liu
University of Utah
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: 3d array manipulation

Mon Aug 17, 2009 5:24 pm
Indeed, Eigen doesn't have any native support for n-dimensional arrays with n>2 or tensors; and indeed, one way to get basic functionality for 3d arrays is to use a vector type as the scalar type, i.e. something like Matrix<VectorXd, Dynamic, Dynamic>.

Indeed, this doesn't work out of the box and you have to add yourself the support for the vector type as a scalar type. To do that, you need to edit the files MathFunctions.h and NumTraits.h in Eigen/src/Core.

See this:
http://eigen.tuxfamily.org/dox/Customiz ... ScalarType


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
weiliu620\
Registered Member
Posts
3
Karma
0
OS

Re: 3d array manipulation

Mon Aug 17, 2009 5:45 pm
Thanks, I'll look at that, though the customization is difficult to me considering my current knowledge of c++.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]