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

Vector of Eigen tensors with different ranks

Tags: None
(comma "," separated)
netw0rkf10w
Registered Member
Posts
8
Karma
0
Hello,

I would like to create a vector that contains objects whose types take values among Eigen::MatrixXd, Tensor3d, Tensor4d,..., Tensor10d (defined below). The objects can have different types.

Code: Select all
#include <iostream>
#include <vector>
#include <Eigen/Dense>
#include <unsupported/Eigen/CXX11/Tensor>

typedef Eigen::Tensor< double , 3 > Tensor3d;
typedef Eigen::Tensor< double , 4 > Tensor4d;
typedef Eigen::Tensor< double , 5 > Tensor5d;
typedef Eigen::Tensor< double , 6 > Tensor6d;
typedef Eigen::Tensor< double , 7 > Tensor7d;
typedef Eigen::Tensor< double , 8 > Tensor8d;
typedef Eigen::Tensor< double , 9 > Tensor9d;
typedef Eigen::Tensor< double , 10 > Tensor10d;

class MyClass
{
private:
    std::vector< TensorXd > Tensors;
public:
    MyClass();
};


Is this possible to do that?
Thank you in advance for your help!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]