diff --git a/doc/tutorial.cpp b/doc/tutorial.cpp index 5daf2f027..8348cab52 100644 --- a/doc/tutorial.cpp +++ b/doc/tutorial.cpp @@ -18,13 +18,13 @@ int main(int, char **) // notice how we are mixing fixed-size and dynamic-size types. cout << "In the top-left block, we put the matrix m shown above." << endl; - m2.block(0,0,2,2) = m; + m2.block<2,2>(0,0) = m; cout << "In the bottom-left block, we put the matrix m*m, which is:" << endl << m*m << endl; - m2.block(2,0,2,2) = m * m; + m2.block<2,2>(2,0) = m * m; cout << "In the top-right block, we put the matrix m+m, which is:" << endl << m+m << endl; - m2.block(0,2,2,2) = m + m; + m2.block<2,2>(0,2) = m + m; cout << "In the bottom-right block, we put the matrix m-m, which is:" << endl << m-m << endl; - m2.block(2,2,2,2) = m - m; + m2.block<2,2>(2,2) = m - m; cout << "Now the 4x4 matrix m2 is:" << endl << m2 << endl; cout << "Row 0 of m2 is:" << endl << m2.row(0) << endl; diff --git a/src/Core.h b/src/Core.h index c1fde09be..6e009b538 100644 --- a/src/Core.h +++ b/src/Core.h @@ -21,6 +21,7 @@ namespace Eigen { #include "Core/Row.h" #include "Core/Column.h" #include "Core/DynBlock.h" +#include "Core/Block.h" #include "Core/Minor.h" #include "Core/Transpose.h" #include "Core/Conjugate.h" diff --git a/src/Core/DynBlock.h b/src/Core/DynBlock.h index 05f67aefd..ea9be7680 100644 --- a/src/Core/DynBlock.h +++ b/src/Core/DynBlock.h @@ -23,8 +23,8 @@ // License. This exception does not invalidate any other reasons why a work // based on this file might be covered by the GNU General Public License. -#ifndef EIGEN_BLOCK_H -#define EIGEN_BLOCK_H +#ifndef EIGEN_DYNBLOCK_H +#define EIGEN_DYNBLOCK_H template class DynBlock : public MatrixBase > @@ -82,4 +82,4 @@ DynBlock MatrixBase startRow, startCol, blockRows, blockCols); } -#endif // EIGEN_BLOCK_H +#endif // EIGEN_DYNBLOCK_H diff --git a/src/Core/MatrixBase.h b/src/Core/MatrixBase.h index c37967cbf..db4c2befb 100644 --- a/src/Core/MatrixBase.h +++ b/src/Core/MatrixBase.h @@ -85,8 +85,8 @@ template class MatrixBase DynBlock dynBlock(int startRow, int startCol, int blockRows, int blockCols) const; - //template Block - //block(int startRow, int startCol) const; + template + Block block(int startRow, int startCol) const; Transpose transpose() const; Conjugate conjugate() const; diff --git a/src/Core/Util.h b/src/Core/Util.h index 615fd610e..aaa94c53d 100644 --- a/src/Core/Util.h +++ b/src/Core/Util.h @@ -48,6 +48,7 @@ template class Row; template class Column; template class Minor; template class DynBlock; +template class Block; template class Transpose; template class Conjugate; template class Opposite;