0

マトリックスAのブロックからマトリックスBを作成したいと思います.Aのサイズが変わるので、次のことを達成しようとしています

Eigen::MatrixXd B(A.block<3,N>(0,0)); 

ここで、N は A の列番号です。このエラーが発生しthe expression must have constant value.ます。この問題を解決するにはどうすればよいですか? 私は使用しようとしましconst_cast<>たが、それでも同じ問題が発生します。

4

1 に答える 1

2

I think this would work:

Eigen::MatrixXd B = A.block(0, 0, 3, N);

The API documentation of eigen is here. If N is a variable, it can't be used as a template function argument (<3,N>) because those must be compile-time constants (the compiler generates/instanciates a version of the function block for each combination or template arguments.)

于 2014-12-11T20:38:34.097 に答える