2017-08-01 85 views
0

我正在尋找爲不同的特徵矩陣創建容器的最佳方法。喜歡的東西:Eigen/C++多維容器

Global(1,:,:) = mat_A; 
Global(2,:,:) = mat_B; 
+0

'std :: vector '足夠嗎? (假設由*不同*你也意味着不同的大小,我沒有看到任何其他明顯的解決方案) – chtz

回答

0

感謝chtz,你再幫我:),這combinaison Eigenstd::vector之間是非常強大的,它可以被用來作爲multidimensionnal基質容器,而是一個應設置向量的大小。

#include <vector> 
#include <Eigen/Dense> 

MatrixXd A(3,3), B(3,3); 

    A << 1, 2, 3, 
     4, 1, 0, 
     6, 9, 0; 

    B << 5, 8, 11, 
     19, 0, 5, 
     8, 0, 1; 


    std::vector<MatrixXd> test(2); 
    test[0]=A; 
    test[1]=B; 

    cout << test[0] << endl;