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

can't initialize an Eigen::ArrayXcf by Zero

Tags: None
(comma "," separated)
senjia
Registered Member
Posts
2
Karma
0
Hello,

I want to initialize an Eigen::ArrayXcf (an Array of std::complex<float> ) to be zero. This code fragment:

#include <Eigen/Dense>
using namespace Eigen;

..........
std::vector<size_t> coil_im_dims_;
coil_im_dims_.clear();
coil_im_dims_.push_back(256);
coil_im_dims_push_back(256);
ArrayXcf cg_x = ArrayXcf::Zero(coil_im_dims_[0], coil_im_dims_[1]);

.............

will encounter a running error:

/usr/local/inclue/Eigen/src/Core/util/XprHelper.h: 53: Eigen::internal::variable_if_dynamic<T, Value>::variable_if_dynamic(T) [with T = long int; int Value=1]: Assertion 'v == T(Value)' failed.

What should I do to solve this problem?

Thank you for your help.

Best wishes,
Jia Sen
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
ArrayXcf is 1D, use ArrayXXcf for 2D. (yes I know that's a bit confusing with MatrixXcf which has only one 'X' but 'Matrix' 2D by nature....)
senjia
Registered Member
Posts
2
Karma
0
Thank you so much. So mindless mistake I made. The problem has been solved.

Best wishes,
Jia Sen


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]