template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
class Eigen::Block< XprType, BlockRows, BlockCols, InnerPanel >
Expression of a fixed-size or dynamic-size block.
- Template Parameters
-
XprType | the type of the expression in which we are taking a block |
BlockRows | the number of rows of the block we are taking at compile time (optional) |
BlockCols | the number of columns of the block we are taking at compile time (optional) |
InnerPanel | is true, if the block maps to a set of rows of a row major matrix or to set of columns of a column major matrix (optional). The parameter allows to determine at compile time whether aligned access is possible on the block expression. |
This class represents an expression of either a fixed-size or dynamic-size block. It is the return type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block<int,int>(Index,Index) and most of the time this is the only way it is used.
However, if you want to directly manipulate block expressions, for instance if you want to write a function returning such an expression, you will need to use this class.
Here is an example illustrating the dynamic case:
#include <Eigen/Core>
#include <iostream>
template <typename Derived>
}
template <typename Derived>
}
Eigen::Matrix4d
m = Eigen::Matrix4d::Identity();
std::cout <<
"Now the matrix m is:" << std::endl <<
m << std::endl;
return 0;
}
int main(int argc, char *argv[])
Definition: T_protectiveWall.cpp:194
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:110
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
Eigen::Block< Derived > topLeftCorner(Eigen::MatrixBase< Derived > &m, int rows, int cols)
Definition: class_Block.cpp:5
int * m
Definition: level2_cplx_impl.h:294
Output:
- Note
- Even though this expression has dynamic size, in the case where XprType has fixed size, this expression inherits a fixed maximal size which means that evaluating it does not cause a dynamic memory allocation.
Here is an example illustrating the fixed-size case:
#include <Eigen/Core>
#include <iostream>
template <typename Derived>
}
template <typename Derived>
}
Eigen::Matrix3d
m = Eigen::Matrix3d::Identity();
std::cout <<
"Now the matrix m is:" << std::endl <<
m << std::endl;
return 0;
}
Eigen::Block< Derived, 2, 2 > topLeft2x2Corner(Eigen::MatrixBase< Derived > &m)
Definition: class_FixedBlock.cpp:5
Output:
- See also
- DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock