class_FixedBlock.cpp
Go to the documentation of this file.
00001 #include <Eigen/Core>
00002 #include <iostream>
00003 using namespace Eigen;
00004 using namespace std;
00005 
00006 template<typename Derived>
00007 Eigen::Block<Derived, 2, 2>
00008 topLeft2x2Corner(MatrixBase<Derived>& m)
00009 {
00010   return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);
00011 }
00012 
00013 template<typename Derived>
00014 const Eigen::Block<const Derived, 2, 2>
00015 topLeft2x2Corner(const MatrixBase<Derived>& m)
00016 {
00017   return Eigen::Block<const Derived, 2, 2>(m.derived(), 0, 0);
00018 }
00019 
00020 int main(int, char**)
00021 {
00022   Matrix3d m = Matrix3d::Identity();
00023   cout << topLeft2x2Corner(4*m) << endl; // calls the const version
00024   topLeft2x2Corner(m) *= 2;              // calls the non-const version
00025   cout << "Now the matrix m is:" << endl << m << endl;
00026   return 0;
00027 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:30:55