diff --git a/src/action.hpp b/src/action.hpp index d220e3aec7e86fc2bb925b2d180e9bc46c427395..51e45b516e7976be2c32ad57c5c00e418e7fe104 100644 --- a/src/action.hpp +++ b/src/action.hpp @@ -10,9 +10,11 @@ inline Scalar S_2(Array<Scalar,2> Q) { Q(0u,0u) = 1; Q(0u,1u) = 2; + Q(1u,1u) = 3; return Scalar(0); } #endif + diff --git a/src/array.hpp b/src/array.hpp index e1f00eb3dd20c758ba6c54645cc8085b7cefd895..b6ff32f56c520a860ab0a278bf76fd62d0aae5db 100644 --- a/src/array.hpp +++ b/src/array.hpp @@ -154,11 +154,13 @@ public: EigenMap to_matrix() const { - static_assert(NDim == 2, "matrixes must be two-dimensional"); + static_assert(NDim == 2, "matrix must be two-dimensional"); return {(Scalar *)data_.data() + offset_, - shape_[0], shape_[1], - {(long)stride_[1], (long)stride_[0]}}; + static_cast<Eigen::Index>(shape_[0]), static_cast<Eigen::Index>(shape_[1]), + {static_cast<Eigen::Index>(stride_[1]), static_cast<Eigen::Index>(stride_[0])}}; } + + operator EigenMap() const { return to_matrix(); } }; diff --git a/src/main.cpp b/src/main.cpp index 70ec82cfaf7db2a920a155f68a2cbb28f419a837..b45a36e62c7e7e33f6cca210e24d1b8f2e1f8d1b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,7 @@ int main() auto mat = Q.to_matrix(); - mat(1,1) = 123; + mat = mat * mat; dump(Q0); std::cout << mat << std::endl;