Skip to content
Snippets Groups Projects
Commit 8d8ad724 authored by patavirt's avatar patavirt
Browse files

array: adjust eigen conversions

parent 267d1cd5
No related branches found
No related tags found
No related merge requests found
......@@ -152,12 +152,12 @@ public:
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> EigenMatrix;
typedef Eigen::Map<EigenMatrix, 0, Eigen::Stride<Eigen::Dynamic,Eigen::Dynamic> > EigenMap;
operator EigenMap() const
EigenMap to_matrix() const
{
static_assert(NDim == 2, "matrixes must be two-dimensional");
return EigenMap((Scalar *)data_.data() + offset_,
shape_[0], shape_[1],
{(long)stride_[1], (long)stride_[0]});
return {(Scalar *)data_.data() + offset_,
shape_[0], shape_[1],
{(long)stride_[1], (long)stride_[0]}};
}
};
......
......@@ -31,7 +31,7 @@ int main()
std::cout << Q.index(0u,0u) << std::endl;
Array<ADComplex,3>::EigenMap mat(Q);
auto mat = Q.to_matrix();
mat(1,1) = 123;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment