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

Initializing struct with Eigen::Matrix as a field

Tags: None
(comma "," separated)
pellek
Registered Member
Posts
1
Karma
0
Hello,

I'm pretty new to eigen and c++ . I try to write a class-file as a database with the following header:

Code: Select all
struct Coefficients {
    Eigen::Matrix<double,6,1>  A;
    // Eigen::Array<double,7,1>  a_high;
    // Eigen::Array<double,7,1>  a_low;
};

class ComponentsDatabase {
public:
    static const Coefficients N2;
    static const Coefficients O2;
};


I want to initialize the structs within the source-file like it was suggested in http://stackoverflow.com/questions/12079537/c-initializing-static-const-structure-variable but I don't find the right syntax to use for Eigen-Matrices as the following code doesn't work.

Code: Select all
#include "ComponentsDatabase.h"

const Coefficients ComponentsDatabase::N2 = {(Eigen::Matrix<double,6,1> << 0, 0, 0, 2, 0, 0).finished()};


Hopefully you can help me.

Thanks a lot

Pelle


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell