cart-elc

Source code for CART-ELC
git clone git://git.laack.co/cart-elc.git
Log | Files | Refs | README | LICENSE

class_FixedReshaped.cpp (467B)


      1 #include <Eigen/Core>
      2 #include <iostream>
      3 using namespace Eigen;
      4 using namespace std;
      5 
      6 template<typename Derived>
      7 Eigen::Reshaped<Derived, 4, 2>
      8 reshape_helper(MatrixBase<Derived>& m)
      9 {
     10   return Eigen::Reshaped<Derived, 4, 2>(m.derived());
     11 }
     12 
     13 int main(int, char**)
     14 {
     15   MatrixXd m(2, 4);
     16   m << 1, 2, 3, 4,
     17        5, 6, 7, 8;
     18   MatrixXd n = reshape_helper(m);
     19   cout << "matrix m is:" << endl << m << endl;
     20   cout << "matrix n is:" << endl << n << endl;
     21   return 0;
     22 }