Base class for all matrices, vectors, and expressions. More...
Public Types | |
enum | { RowsAtCompileTime, ColsAtCompileTime, SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime, IsVectorAtCompileTime, Flags, CoeffReadCost } |
Public Member Functions | |
const AdjointReturnType | adjoint () const |
bool | all (void) const |
bool | any (void) const |
const DiagonalMatrix< Derived > | asDiagonal () const |
template<typename CustomBinaryOp , typename OtherDerived > | |
const CwiseBinaryOp < CustomBinaryOp, Derived, OtherDerived > | binaryExpr (const MatrixBase< OtherDerived > &other, const CustomBinaryOp &func=CustomBinaryOp()) const |
BlockReturnType< Derived >::Type | block (int startRow, int startCol, int blockRows, int blockCols) |
const BlockReturnType< Derived > ::Type | block (int startRow, int startCol, int blockRows, int blockCols) const |
template<int BlockRows, int BlockCols> | |
BlockReturnType< Derived, BlockRows, BlockCols >::Type | block (int startRow, int startCol) |
template<int BlockRows, int BlockCols> | |
const BlockReturnType< Derived, BlockRows, BlockCols >::Type | block (int startRow, int startCol) const |
template<typename NewType > | |
const CwiseUnaryOp < ei_scalar_cast_op< typename ei_traits< Derived >::Scalar, NewType >, Derived > | cast () const |
const Scalar | coeff (int row, int col) const |
const Scalar | coeff (int index) const |
Scalar & | coeffRef (int row, int col) |
Scalar & | coeffRef (int index) |
ColXpr | col (int i) |
const ColXpr | col (int i) const |
int | cols () const |
const PartialRedux< Derived, Vertical > | colwise () const |
template<typename OtherDerived > | |
void | computeInverse (MatrixBase< OtherDerived > *result) const |
template<typename ResultType > | |
void | computeInverse (MatrixBase< ResultType > *result) const |
ConjugateReturnType | conjugate () const |
BlockReturnType< Derived >::Type | corner (CornerType type, int cRows, int cCols) |
const BlockReturnType< Derived > ::Type | corner (CornerType type, int cRows, int cCols) const |
template<int CRows, int CCols> | |
BlockReturnType< Derived, CRows, CCols >::Type | corner (CornerType type) |
template<int CRows, int CCols> | |
const BlockReturnType< Derived, CRows, CCols >::Type | corner (CornerType type) const |
int | count () const |
template<typename OtherDerived > | |
MatrixBase< Derived > ::PlainMatrixType | cross (const MatrixBase< OtherDerived > &other) const |
template<typename OtherDerived > | |
PlainMatrixType | cross (const MatrixBase< OtherDerived > &other) const |
const Cwise< Derived > | cwise () const |
Cwise< Derived > | cwise () |
Scalar | determinant () const |
DiagonalCoeffs< Derived > | diagonal () |
const DiagonalCoeffs< Derived > | diagonal () const |
template<typename OtherDerived > | |
ei_traits< Derived >::Scalar | dot (const MatrixBase< OtherDerived > &other) const |
template<typename OtherDerived > | |
Scalar | dot (const MatrixBase< OtherDerived > &other) const |
EigenvaluesReturnType | eigenvalues () const |
BlockReturnType< Derived, Dynamic >::SubVectorType | end (int size) |
const BlockReturnType< Derived, Dynamic >::SubVectorType | end (int size) const |
template<int Size> | |
BlockReturnType< Derived, Size > ::SubVectorType | end () |
template<int Size> | |
const BlockReturnType< Derived, Size >::SubVectorType | end () const |
Matrix< Scalar, 3, 1 > | eulerAngles (int a0, int a1, int a2) const |
const ei_eval< Derived >::type | eval () const |
void | fill (const Scalar &value) |
const WithFormat< Derived > | format (const IOFormat &fmt) const |
const ImagReturnType | imag () const |
int | innerSize () const |
const PlainMatrixType | inverse () const |
template<typename OtherDerived > | |
bool | isApprox (const MatrixBase< OtherDerived > &other, typename NumTraits< Scalar >::Real prec) const |
template<typename OtherDerived > | |
bool | isApprox (const MatrixBase< OtherDerived > &other, RealScalar prec=precision< Scalar >()) const |
bool | isApproxToConstant (const Scalar &value, RealScalar prec=precision< Scalar >()) const |
bool | isConstant (const Scalar &value, RealScalar prec=precision< Scalar >()) const |
bool | isDiagonal (RealScalar prec=precision< Scalar >()) const |
bool | isIdentity (RealScalar prec=precision< Scalar >()) const |
bool | isLowerTriangular (RealScalar prec=precision< Scalar >()) const |
template<typename Derived > | |
bool | isMuchSmallerThan (const typename NumTraits< Scalar >::Real &other, typename NumTraits< Scalar >::Real prec) const |
template<typename OtherDerived > | |
bool | isMuchSmallerThan (const MatrixBase< OtherDerived > &other, typename NumTraits< Scalar >::Real prec) const |
bool | isMuchSmallerThan (const RealScalar &other, RealScalar prec=precision< Scalar >()) const |
template<typename OtherDerived > | |
bool | isMuchSmallerThan (const MatrixBase< OtherDerived > &other, RealScalar prec=precision< Scalar >()) const |
bool | isOnes (RealScalar prec=precision< Scalar >()) const |
template<typename OtherDerived > | |
bool | isOrthogonal (const MatrixBase< OtherDerived > &other, RealScalar prec=precision< Scalar >()) const |
bool | isUnitary (RealScalar prec=precision< Scalar >()) const |
bool | isUpperTriangular (RealScalar prec=precision< Scalar >()) const |
bool | isVector () const |
bool | isZero (RealScalar prec=precision< Scalar >()) const |
const Flagged< Derived, 0, EvalBeforeNestingBit|EvalBeforeAssigningBit > | lazy () const |
template<typename Lhs , typename Rhs > | |
Derived & | lazyAssign (const SparseProduct< Lhs, Rhs, SparseTimeDenseProduct > &product) |
template<typename Lhs , typename Rhs > | |
Derived & | lazyAssign (const SparseProduct< Lhs, Rhs, DenseTimeSparseProduct > &product) |
template<typename Derived1 , typename Derived2 > | |
Derived & | lazyAssign (const SparseProduct< Derived1, Derived2, SparseTimeDenseProduct > &product) |
template<typename Derived1 , typename Derived2 > | |
Derived & | lazyAssign (const SparseProduct< Derived1, Derived2, DenseTimeSparseProduct > &product) |
template<typename Lhs , typename Rhs > | |
Derived & | lazyAssign (const Product< Lhs, Rhs, CacheFriendlyProduct > &product) |
const LDLT< PlainMatrixType > | ldlt () const |
const LLT< PlainMatrixType > | llt () const |
template<int p> | |
NumTraits< typename ei_traits < Derived >::Scalar >::Real | lpNorm () const |
template<int p> | |
RealScalar | lpNorm () const |
const LU< PlainMatrixType > | lu () const |
template<unsigned int Added> | |
const Flagged< Derived, Added, 0 > | marked () const |
ei_traits< Derived >::Scalar | maxCoeff () const |
ei_traits< Derived >::Scalar | maxCoeff (int *row, int *col) const |
ei_traits< Derived >::Scalar | maxCoeff (int *index) const |
ei_traits< Derived >::Scalar | minCoeff () const |
ei_traits< Derived >::Scalar | minCoeff (int *row, int *col) const |
ei_traits< Derived >::Scalar | minCoeff (int *index) const |
Minor< Derived > | minor (int row, int col) |
const Minor< Derived > | minor (int row, int col) const |
const NestByValue< Derived > | nestByValue () const |
int | nonZeros () const |
RealScalar | norm () const |
void | normalize () |
const PlainMatrixType | normalized () const |
template<typename CustomNullaryOp > | |
const CwiseNullaryOp < CustomNullaryOp, Derived > | NullaryExpr (int rows, int cols, const CustomNullaryOp &func) |
template<typename CustomNullaryOp > | |
const CwiseNullaryOp < CustomNullaryOp, Derived > | NullaryExpr (int size, const CustomNullaryOp &func) |
template<typename CustomNullaryOp > | |
const CwiseNullaryOp < CustomNullaryOp, Derived > | NullaryExpr (const CustomNullaryOp &func) |
template<typename OtherDerived > | |
bool | operator!= (const MatrixBase< OtherDerived > &other) const |
const Scalar | operator() (int row, int col) const |
Scalar & | operator() (int row, int col) |
const Scalar | operator() (int index) const |
Scalar & | operator() (int index) |
const ScalarMultipleReturnType | operator* (const Scalar &scalar) const |
template<typename OtherDerived > | |
const ProductReturnType < Derived, OtherDerived > ::Type | operator* (const MatrixBase< OtherDerived > &other) const |
Derived & | operator*= (const Scalar &other) |
template<typename OtherDerived > | |
Derived & | operator*= (const MatrixBase< OtherDerived > &other) |
template<typename OtherDerived > | |
const CwiseBinaryOp < ei_scalar_sum_op< typename ei_traits< Derived >::Scalar > , Derived, OtherDerived > | operator+ (const MatrixBase< OtherDerived > &other) const |
template<typename OtherDerived > | |
Derived & | operator+= (const MatrixBase< OtherDerived > &other) |
template<typename Lhs , typename Rhs > | |
Derived & | operator+= (const Flagged< Product< Lhs, Rhs, CacheFriendlyProduct >, 0, EvalBeforeNestingBit|EvalBeforeAssigningBit > &other) |
const CwiseUnaryOp < ei_scalar_opposite_op < typename ei_traits< Derived > ::Scalar >, Derived > | operator- () const |
template<typename OtherDerived > | |
const CwiseBinaryOp < ei_scalar_difference_op < typename ei_traits< Derived > ::Scalar >, Derived, OtherDerived > | operator- (const MatrixBase< OtherDerived > &other) const |
template<typename OtherDerived > | |
Derived & | operator-= (const MatrixBase< OtherDerived > &other) |
const CwiseUnaryOp < ei_scalar_quotient1_op < typename ei_traits< Derived > ::Scalar >, Derived > | operator/ (const Scalar &scalar) const |
Derived & | operator/= (const Scalar &other) |
CommaInitializer< Derived > | operator<< (const Scalar &s) |
template<typename OtherDerived > | |
CommaInitializer< Derived > | operator<< (const MatrixBase< OtherDerived > &other) |
template<typename OtherDerived > | |
Derived & | operator= (const MatrixBase< OtherDerived > &other) |
Derived & | operator= (const MatrixBase &other) |
template<typename OtherDerived > | |
bool | operator== (const MatrixBase< OtherDerived > &other) const |
const Scalar | operator[] (int index) const |
Scalar & | operator[] (int index) |
RealScalar | operatorNorm () const |
int | outerSize () const |
template<int LoadMode> | |
ei_packet_traits< typename ei_traits< Derived >::Scalar > ::type | packet (int row, int col) const |
template<int LoadMode> | |
PacketScalar | packet (int row, int col) const |
template<int LoadMode> | |
PacketScalar | packet (int index) const |
template<int LoadMode> | |
ei_packet_traits< typename ei_traits< Derived >::Scalar > ::type | packet (int index) const |
template<unsigned int Mode> | |
Part< Derived, Mode > | part () |
template<unsigned int Mode> | |
const Part< Derived, Mode > | part () const |
const QR< PlainMatrixType > | qr () const |
const RealReturnType | real () const |
template<typename BinaryOp > | |
ei_result_of< BinaryOp(typename ei_traits< Derived >::Scalar)> ::type | redux (const BinaryOp &func) const |
RowXpr | row (int i) |
const RowXpr | row (int i) const |
int | rows () const |
const PartialRedux< Derived, Horizontal > | rowwise () const |
BlockReturnType< Derived > ::SubVectorType | segment (int start, int size) |
const BlockReturnType< Derived > ::SubVectorType | segment (int start, int size) const |
template<int Size> | |
BlockReturnType< Derived, Size > ::SubVectorType | segment (int start) |
template<int Size> | |
const BlockReturnType< Derived, Size >::SubVectorType | segment (int start) const |
template<typename ThenDerived , typename ElseDerived > | |
const Select< Derived, ThenDerived, ElseDerived > | select (const MatrixBase< ThenDerived > &thenMatrix, const MatrixBase< ElseDerived > &elseMatrix) const |
template<typename ThenDerived > | |
const Select< Derived, ThenDerived, NestByValue < typename ThenDerived::ConstantReturnType > > | select (const MatrixBase< ThenDerived > &thenMatrix, typename ThenDerived::Scalar elseScalar) const |
template<typename ElseDerived > | |
const Select< Derived, NestByValue< typename ElseDerived::ConstantReturnType > , ElseDerived > | select (typename ElseDerived::Scalar thenScalar, const MatrixBase< ElseDerived > &elseMatrix) const |
Derived & | setConstant (const Scalar &value) |
Derived & | setIdentity () |
Derived & | setOnes () |
Derived & | setRandom () |
Derived & | setZero () |
int | size () const |
template<typename OtherDerived > | |
ei_plain_matrix_type_column_major < OtherDerived >::type | solveTriangular (const MatrixBase< OtherDerived > &other) const |
template<typename OtherDerived > | |
void | solveTriangularInPlace (const MatrixBase< OtherDerived > &other) const |
RealScalar | squaredNorm () const |
BlockReturnType< Derived, Dynamic >::SubVectorType | start (int size) |
const BlockReturnType< Derived, Dynamic >::SubVectorType | start (int size) const |
template<int Size> | |
BlockReturnType< Derived, Size > ::SubVectorType | start (void) |
template<int Size> | |
const BlockReturnType< Derived, Size >::SubVectorType | start () const |
int | stride (void) const |
Scalar | sum () const |
SVD< PlainMatrixType > | svd () const |
template<typename OtherDerived > | |
void | swap (const MatrixBase< OtherDerived > &other) |
Scalar | trace () const |
Eigen::Transpose< Derived > | transpose () |
const Eigen::Transpose< Derived > | transpose () const |
void | transposeInPlace () |
template<typename CustomUnaryOp > | |
const CwiseUnaryOp < CustomUnaryOp, Derived > | unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const |
PlainMatrixType | unitOrthogonal (void) const |
template<typename Visitor > | |
void | visit (Visitor &func) const |
const Scalar | w () const |
Scalar & | w () |
template<int StoreMode> | |
void | writePacket (int row, int col, const typename ei_packet_traits< typename ei_traits< Derived >::Scalar >::type &x) |
template<int StoreMode> | |
void | writePacket (int row, int col, const PacketScalar &x) |
template<int StoreMode> | |
void | writePacket (int index, const PacketScalar &x) |
template<int StoreMode> | |
void | writePacket (int index, const typename ei_packet_traits< typename ei_traits< Derived >::Scalar >::type &x) |
const Scalar | x () const |
Scalar & | x () |
const Scalar | y () const |
Scalar & | y () |
const Scalar | z () const |
Scalar & | z () |
Static Public Member Functions | |
static const ConstantReturnType | Constant (int rows, int cols, const Scalar &value) |
static const ConstantReturnType | Constant (int size, const Scalar &value) |
static const ConstantReturnType | Constant (const Scalar &value) |
static const IdentityReturnType | Identity () |
static const IdentityReturnType | Identity (int rows, int cols) |
template<typename CustomNullaryOp > | |
static const CwiseNullaryOp < CustomNullaryOp, Derived > | NullaryExpr (int rows, int cols, const CustomNullaryOp &func) |
template<typename CustomNullaryOp > | |
static const CwiseNullaryOp < CustomNullaryOp, Derived > | NullaryExpr (int size, const CustomNullaryOp &func) |
template<typename CustomNullaryOp > | |
static const CwiseNullaryOp < CustomNullaryOp, Derived > | NullaryExpr (const CustomNullaryOp &func) |
static const ConstantReturnType | Ones (int rows, int cols) |
static const ConstantReturnType | Ones (int size) |
static const ConstantReturnType | Ones () |
static const CwiseNullaryOp < ei_scalar_random_op< Scalar > , Derived > | Random (int rows, int cols) |
static const CwiseNullaryOp < ei_scalar_random_op< Scalar > , Derived > | Random (int size) |
static const CwiseNullaryOp < ei_scalar_random_op< Scalar > , Derived > | Random () |
static const BasisReturnType | Unit (int size, int i) |
static const BasisReturnType | Unit (int i) |
static const BasisReturnType | UnitW () |
static const BasisReturnType | UnitX () |
static const BasisReturnType | UnitY () |
static const BasisReturnType | UnitZ () |
static const ConstantReturnType | Zero (int rows, int cols) |
static const ConstantReturnType | Zero (int size) |
static const ConstantReturnType | Zero () |
Protected Member Functions | |
MatrixBase () | |
Friends | |
const CwiseUnaryOp < ei_scalar_multiple_op < typename ei_traits< Derived > ::Scalar >, Derived > | operator* (const Scalar &scalar, const MatrixBase &matrix) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Derived > | |
std::ostream & | operator<< (std::ostream &s, const MatrixBase< Derived > &m) |
Base class for all matrices, vectors, and expressions.
This class is the base that is inherited by all matrix, vector, and expression types. Most of the Eigen API is contained in this class. Other important classes for the Eigen API are Matrix, Cwise, and PartialRedux.
Note that some methods are defined in the Array module.
Derived | is the derived type, e.g. a matrix type, or an expression, etc. |
When writing a function taking Eigen objects as argument, if you want your function to take as argument any matrix, vector, or expression, just let it take a MatrixBase argument. As an example, here is a function printFirstRow which, given a matrix, vector, or expression x, prints the first row of x.
anonymous enum |
Enumerator | |
---|---|
RowsAtCompileTime |
The number of rows at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant. |
ColsAtCompileTime |
The number of columns at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant. |
SizeAtCompileTime |
This is equal to the number of coefficients, i.e. the number of rows times the number of columns, or to Dynamic if this is not known at compile-time.
|
MaxRowsAtCompileTime |
This value is equal to the maximum possible number of rows that this expression might have. If this expression might have an arbitrarily high number of rows, this value is set to Dynamic. This value is useful to know when evaluating an expression, in order to determine whether it is possible to avoid doing a dynamic memory allocation. |
MaxColsAtCompileTime |
This value is equal to the maximum possible number of columns that this expression might have. If this expression might have an arbitrarily high number of columns, this value is set to Dynamic. This value is useful to know when evaluating an expression, in order to determine whether it is possible to avoid doing a dynamic memory allocation. |
MaxSizeAtCompileTime |
This value is equal to the maximum possible number of coefficients that this expression might have. If this expression might have an arbitrarily high number of coefficients, this value is set to Dynamic. This value is useful to know when evaluating an expression, in order to determine whether it is possible to avoid doing a dynamic memory allocation. |
IsVectorAtCompileTime |
This is set to true if either the number of rows or the number of columns is known at compile-time to be equal to 1. Indeed, in that case, we are dealing with a column-vector (if there is only one column) or with a row-vector (if there is only one row). |
Flags |
This stores expression flags flags which may or may not be inherited by new expressions constructed from this one. See the list of flags. |
CoeffReadCost |
This is a rough measure of how expensive it is to read one coefficient from this expression. |
|
inlineprotected |
Default constructor. Do nothing.
|
inline |
Example:
Output:
Here is the 2x2 complex matrix m: (-0.211,0.68) (-0.605,0.823) (0.597,0.566) (0.536,-0.33) Here is the adjoint of m: (-0.211,-0.68) (0.597,-0.566) (-0.605,-0.823) (0.536,0.33)
|
inline |
This is defined in the Array module.
Example:
Output:
Is ( 0.68 -0.211 0.566) inside the box: 0 Is (0.597 0.823 0.605) inside the box: 1
|
inline |
This is defined in the Array module.
|
inline |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
Example:
Output:
2 0 0 0 5 0 0 0 6
|
inline |
The template parameter CustomBinaryOp is the type of the functor of the custom operator (see class CwiseBinaryOp for an example)
Here is an example illustrating the use of custom functors:
Output:
(0.68,0.271) (0.823,-0.967) (-0.444,-0.687) (-0.27,0.998) (-0.211,0.435) (-0.605,-0.514) (0.108,-0.198) (0.0268,-0.563) (0.566,-0.717) (-0.33,-0.726) (-0.0452,-0.74) (0.904,0.0259) (0.597,0.214) (0.536,0.608) (0.258,-0.782) (0.832,0.678)
|
inline |
startRow | the first row in the block |
startCol | the first column in the block |
blockRows | the number of rows in the block |
blockCols | the number of columns in the block |
Example:
Output:
Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is m.block(1, 1, 2, 2): -6 1 -3 0 Now the matrix m is: 7 9 -5 -3 -2 0 0 0 6 0 0 9 6 6 3 9
|
inline |
This is the const version of block(int,int,int,int).
|
inline |
The template parameters BlockRows and BlockCols are the number of rows and columns in the block.
startRow | the first row in the block |
startCol | the first column in the block |
Example:
Output:
Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is m.block<2,2>(1,1): -6 1 -3 0 Now the matrix m is: 7 9 -5 -3 -2 0 0 0 6 0 0 9 6 6 3 9
|
inline |
This is the const version of block<>(int, int).
|
inline |
The template parameter NewScalar is the type we are casting the scalars to.
|
inline |
Short version: don't use this function, use operator()(int,int) const instead.
Long version: this function is similar to operator()(int,int) const , but without the assertion. Use this for limiting the performance cost of debugging code when doing repeated coefficient access. Only use this when it is guaranteed that the parameters row and col are in range.
If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this function equivalent to operator()(int,int) const .
|
inline |
Short version: don't use this function, use operator[](int) const instead.
Long version: this function is similar to operator[](int) const , but without the assertion. Use this for limiting the performance cost of debugging code when doing repeated coefficient access. Only use this when it is guaranteed that the parameter index is in range.
If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this function equivalent to operator[](int) const .
|
inline |
Short version: don't use this function, use operator()(int,int) instead.
Long version: this function is similar to operator()(int,int), but without the assertion. Use this for limiting the performance cost of debugging code when doing repeated coefficient access. Only use this when it is guaranteed that the parameters row and col are in range.
If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this function equivalent to operator()(int,int).
|
inline |
Short version: don't use this function, use operator[](int) instead.
Long version: this function is similar to operator[](int), but without the assertion. Use this for limiting the performance cost of debugging code when doing repeated coefficient access. Only use this when it is guaranteed that the parameters row and col are in range.
If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this function equivalent to operator[](int).
|
inline |
Example:
Output:
1 4 0 0 5 0 0 6 1
|
inline |
This is the const version of col().
|
inline |
|
inline |
This is defined in the Array module.
Example:
Output:
Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 Here is the sum of each column: 1.04 0.815 -0.238 Here is the maximum absolute value of each column: 0.68 0.823 0.536
|
inline |
This is defined in the LU module.
Computes the matrix inverse of this matrix.
result | Pointer to the matrix in which to store the result. |
Example:
Output:
Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 Its inverse is: -0.199 2.23 2.84 1.01 -0.555 -1.42 -1.62 3.59 3.29
|
inline |
*this
.
|
inlinestatic |
The parameters rows and cols are the number of rows and of columns of the returned matrix. Must be compatible with this MatrixBase type.
This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass rows and cols as arguments, so Zero() should be used instead.
The template parameter CustomNullaryOp is the type of the functor.
|
inlinestatic |
The parameter size is the size of the returned vector. Must be compatible with this MatrixBase type.
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
This variant is meant to be used for dynamic-size vector types. For fixed-size types, it is redundant to pass size as argument, so Zero() should be used instead.
The template parameter CustomNullaryOp is the type of the functor.
|
inlinestatic |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
The template parameter CustomNullaryOp is the type of the functor.
|
inline |
type | the type of corner. Can be Eigen::TopLeft, Eigen::TopRight, Eigen::BottomLeft, Eigen::BottomRight. |
cRows | the number of rows in the corner |
cCols | the number of columns in the corner |
Example:
Output:
Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is the bottom-right 2x3 corner in m: -3 0 9 6 3 9 Now the matrix m is: 7 9 -5 -3 -2 -6 1 0 6 0 0 0 6 0 0 0
|
inline |
This is the const version of corner(CornerType, int, int).
|
inline |
type | the type of corner. Can be Eigen::TopLeft, Eigen::TopRight, Eigen::BottomLeft, Eigen::BottomRight. |
The template parameters CRows and CCols arethe number of rows and columns in the corner.
Example:
Output:
Here is the matrix m: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is the bottom-right 2x3 corner in m: -3 0 9 6 3 9 Now the matrix m is: 7 9 -5 -3 -2 -6 1 0 6 0 0 0 6 0 0 0
|
inline |
This is the const version of corner<int, int>(CornerType).
|
inline |
This is defined in the Array module.
|
inline |
This is defined in the Geometry module.
*this
and other Here is a very good explanation of cross-product: http://xkcd.com/199/
|
inline |
Example:
Output:
the absolute values: 1 2 3 the absolute values plus one: 2 3 4 sum of the squares: 14
|
inline |
Example:
Output:
2 3 4
|
inline |
This is defined in the LU module.
|
inline |
*this
*this
is not required to be square.
Example:
Output:
Here is the matrix m: 7 6 -3 -2 9 6 6 -6 -5 Here are the coefficients on the main diagonal of m: 7 9 -5
|
inline |
This is the const version of diagonal().
ei_traits<Derived>::Scalar dot | ( | const MatrixBase< OtherDerived > & | other) | const |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
|
inline |
This is defined in the QR module.
|
inline |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
size | the number of coefficients in the block |
Example:
Output:
Here is the vector v: 7 -2 6 6 Here is v.end(2): 6 6 Now the vector v is: 7 -2 0 0
|
inline |
This is the const version of end(int).
|
inline |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
The template parameter Size is the number of coefficients in the block
Example:
Output:
Here is the vector v: 7 -2 6 6 Here is v.end(2): 6 6 Now the vector v is: 7 -2 0 0
|
inline |
This is the const version of end<int>.
|
inline |
Notice that in the case of a plain matrix or vector (not an expression) this function just returns a const reference, in order to avoid a useless copy.
|
inline |
Alias for setConstant(): sets all coefficients in this expression to value.
|
inline |
See class IOFormat for some examples.
|
inlinestatic |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variant taking size arguments.
Example:
Output:
1 0 0 0 0 1 0 0 0 0 1 0
|
inlinestatic |
The parameters rows and cols are the number of rows and of columns of the returned matrix. Must be compatible with this MatrixBase type.
This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass rows and cols as arguments, so Identity() should be used instead.
Example:
Output:
1 0 0 0 1 0 0 0 1 0 0 0
|
inline |
*this
.
|
inline |
|
inline |
This is defined in the LU module.
Example:
Output:
Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 Its inverse is: -0.199 2.23 2.84 1.01 -0.555 -1.42 -1.62 3.59 3.29
bool isApprox | ( | const MatrixBase< OtherDerived > & | other, |
typename NumTraits< Scalar >::Real | prec | ||
) | const |
true
if *this
is approximately equal to other, within the precision determined by prec.
*this
is approximately equal to the zero matrix or vector. Indeed, isApprox(zero)
returns false unless *this
itself is exactly the zero matrix or vector. If you want to test whether *this
is zero, use ei_isMuchSmallerThan(const RealScalar&, RealScalar) instead.bool isApproxToConstant | ( | const Scalar & | value, |
RealScalar | prec = precision<Scalar>() |
||
) | const |
bool isConstant | ( | const Scalar & | value, |
RealScalar | prec = precision<Scalar>() |
||
) | const |
This is just an alias for isApproxToConstant().
bool isDiagonal | ( | RealScalar | prec = precision<Scalar>() ) | const |
Example:
Output:
Here's the matrix m: 1e+04 0 1 0 1e+04 0 0 0 1e+04 m.isDiagonal() returns: 0 m.isDiagonal(1e-3) returns: 1
bool isIdentity | ( | RealScalar | prec = precision<Scalar>() ) | const |
Example:
Output:
Here's the matrix m: 1 0 0.0001 0 1 0 0 0 1 m.isIdentity() returns: 0 m.isIdentity(1e-3) returns: 1
bool isLowerTriangular | ( | RealScalar | prec = precision<Scalar>() ) | const |
bool isMuchSmallerThan | ( | const typename NumTraits< Scalar >::Real & | other, |
typename NumTraits< Scalar >::Real | prec | ||
) | const |
true
if the norm of *this
is much smaller than other, within the precision determined by prec.
For matrices, the comparison is done using the Hilbert-Schmidt norm. For this reason, the value of the reference scalar other should come from the Hilbert-Schmidt norm of a reference matrix of same dimensions.
bool isMuchSmallerThan | ( | const MatrixBase< OtherDerived > & | other, |
typename NumTraits< Scalar >::Real | prec | ||
) | const |
true
if the norm of *this
is much smaller than the norm of other, within the precision determined by prec.
bool isOnes | ( | RealScalar | prec = precision<Scalar>() ) | const |
Example:
Output:
Here's the matrix m: 1 1 1 1 1 1 1 1 1 m.isOnes() returns: 0 m.isOnes(1e-3) returns: 1
bool isOrthogonal | ( | const MatrixBase< OtherDerived > & | other, |
RealScalar | prec = precision<Scalar>() |
||
) | const |
Example:
Output:
Here's the vector v: 1 0 0 Here's the vector w: 0.0001 0 1 v.isOrthogonal(w) returns: 0 v.isOrthogonal(w,1e-3) returns: 1
bool isUnitary | ( | RealScalar | prec = precision<Scalar>() ) | const |
m.isUnitary()
returns true if and only if the columns (equivalently, the rows) of m form an orthonormal basis.Example:
Output:
Here's the matrix m: 1 0 0.0001 0 1 0 0 0 1 m.isUnitary() returns: 0 m.isUnitary(1e-3) returns: 1
bool isUpperTriangular | ( | RealScalar | prec = precision<Scalar>() ) | const |
|
inline |
bool isZero | ( | RealScalar | prec = precision<Scalar>() ) | const |
Example:
Output:
Here's the matrix m: 0 0 0.0001 0 0 0 0 0 0 m.isZero() returns: 0 m.isZero(1e-3) returns: 1
|
inline |
Example:
Output:
7 10
|
inline |
This is defined in the Cholesky module.
*this
|
inline |
This is defined in the Cholesky module.
*this
|
inline |
This is defined in the Array module.
|
inline |
|
inline |
Example:
Output:
Here is the matrix m: 1 1 1 0 1 1 0 0 1 Here is the matrix n: 2 1 1 2 2 1 2 2 2 And now here is m.inverse()*n, taking advantage of the fact that m is upper-triangular: 0 -1 0 0 0 -1 2 2 2
|
inline |
ei_traits< Derived >::Scalar maxCoeff | ( | int * | row, |
int * | col | ||
) | const |
ei_traits< Derived >::Scalar maxCoeff | ( | int * | index) | const |
|
inline |
ei_traits< Derived >::Scalar minCoeff | ( | int * | row, |
int * | col | ||
) | const |
ei_traits< Derived >::Scalar minCoeff | ( | int * | index) | const |
|
inline |
Example:
Output:
Here is the matrix m: 7 6 -3 -2 9 6 6 -6 -5 Here is m.minor(1,1): 7 -3 6 -5
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Normalizes the vector, i.e. divides it by its own norm.
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
|
inline |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
|
inline |
The parameters rows and cols are the number of rows and of columns of the returned matrix. Must be compatible with this MatrixBase type.
This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass rows and cols as arguments, so Zero() should be used instead.
The template parameter CustomNullaryOp is the type of the functor.
|
inline |
The parameter size is the size of the returned vector. Must be compatible with this MatrixBase type.
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
This variant is meant to be used for dynamic-size vector types. For fixed-size types, it is redundant to pass size as argument, so Zero() should be used instead.
The template parameter CustomNullaryOp is the type of the functor.
|
inline |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
The template parameter CustomNullaryOp is the type of the functor.
|
inlinestatic |
The parameters rows and cols are the number of rows and of columns of the returned matrix. Must be compatible with this MatrixBase type.
This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass rows and cols as arguments, so Ones() should be used instead.
Example:
Output:
1 1 1 1 1 1
|
inlinestatic |
The parameter size is the size of the returned vector. Must be compatible with this MatrixBase type.
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
This variant is meant to be used for dynamic-size vector types. For fixed-size types, it is redundant to pass size as argument, so Ones() should be used instead.
Example:
Output:
6 6 6 6 1 1
|
inlinestatic |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
Example:
Output:
1 1 1 1 6 6 6 6
|
inline |
|
inline |
|
inline |
This is synonymous to operator[](int) const.
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
|
inline |
This is synonymous to operator[](int).
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
|
inline |
*this
and other.
|
inline |
replaces *this
by *this
* other.
*this
|
inline |
replaces *this
by *this
+ other.
*this
|
inline |
*this
|
inline |
*this
and other
|
inline |
replaces *this
by *this
- other.
*this
|
inline |
Convenient operator to set the coefficients of a matrix.
The coefficients must be provided in a row major order and exactly match the size of the matrix. Otherwise an assertion is raised.
Example:
Output:
1 2 3 4 5 6 7 8 9 10 11 0 12 13 0 0 0 1 14 15 16 14 5 6 15 8 9
|
inline |
Derived& operator= | ( | const MatrixBase< OtherDerived > & | other) |
Copies other into *this.
|
inline |
Special case of the template operator=, in order to prevent the compiler from generating a default operator= (issue hit with g++ 4.1)
|
inline |
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
|
inline |
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
|
inline |
This is defined in the QR module.
|
inline |
|
inline |
The LoadMode parameter may have the value Aligned or Unaligned. Its effect is to select the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets starting at an address which is a multiple of the packet size.
|
inline |
The LoadMode parameter may have the value Aligned or Unaligned. Its effect is to select the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets starting at an address which is a multiple of the packet size.
|
inline |
*this
.The Mode parameter can have the following values: UpperTriangular
, StrictlyUpperTriangular
, LowerTriangular
, StrictlyLowerTriangular
, SelfAdjoint
.
Example:
Output:
Here is the matrix m: 0 1 1 0 0 1 0 0 0 And let us now compute m*m.adjoint() in a very optimized way taking advantage of the symmetry. The result is: 2 1 0 1 1 0 0 0 0
const Part< Derived, Mode > part | ( | ) | const |
The parameter Mode can have the following values: UpperTriangular
, StrictlyUpperTriangular
, UnitUpperTriangular
, LowerTriangular
, StrictlyLowerTriangular
, UnitLowerTriangular
.
Example:
Output:
Here is the matrix m: 7 6 -3 -2 9 6 6 -6 -5 Here is the upper-triangular matrix extracted from m: 7 6 -3 0 9 6 0 0 -5 Here is the strictly-upper-triangular matrix extracted from m: 0 6 -3 0 0 6 0 0 0 Here is the unit-lower-triangular matrix extracted from m: 1 0 0 -2 1 0 6 -6 1
const QR< typename MatrixBase< Derived >::PlainMatrixType > qr | ( | ) | const |
|
inlinestatic |
This is defined in the Array module.
The parameters rows and cols are the number of rows and of columns of the returned matrix. Must be compatible with this MatrixBase type.
This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass rows and cols as arguments, so ei_random() should be used instead.
Example:
Output:
7 6 9 -2 6 -6
|
inlinestatic |
This is defined in the Array module.
The parameter size is the size of the returned vector. Must be compatible with this MatrixBase type.
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
This variant is meant to be used for dynamic-size vector types. For fixed-size types, it is redundant to pass size as argument, so ei_random() should be used instead.
Example:
Output:
7 -2
|
inlinestatic |
This is defined in the Array module.
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
Example:
Output:
700 600 -200 600
|
inline |
*this
.ei_result_of< BinaryOp(typename ei_traits< Derived >::Scalar)>::type redux | ( | const BinaryOp & | func) | const |
The template parameter BinaryOp is the type of the functor func which must be an assiociative operator. Both current STL and TR1 functor styles are handled.
|
inline |
Example:
Output:
1 0 0 4 5 6 0 0 1
|
inline |
This is the const version of row().
|
inline |
|
inline |
This is defined in the Array module.
Example:
Output:
Here is the matrix m: 0.68 0.597 -0.33 -0.211 0.823 0.536 0.566 -0.605 -0.444 Here is the sum of each row: 0.948 1.15 -0.483 Here is the maximum absolute value of each row: 0.68 0.823 0.605
|
inline |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
start | the first coefficient in the segment |
size | the number of coefficients in the segment |
Example:
Output:
Here is the vector v: 7 -2 6 6 Here is v.segment(1, 2): -2 6 Now the vector v is: 7 0 0 6
|
inline |
This is the const version of segment(int,int).
|
inline |
*this
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
The template parameter Size is the number of coefficients in the block
start | the index of the first element of the sub-vector |
Example:
Output:
Here is the vector v: 7 -2 6 6 Here is v.segment<2>(1): -2 6 Now the vector v is: 7 -2 0 0
|
inline |
This is the const version of segment<int>(int).
|
inline |
This is defined in the Array module.
*this
(i,j), and elseMatrix(i,j) otherwise.Example:
Output:
|
inline |
This is defined in the Array module.
Version of MatrixBase::select(const MatrixBase&, const MatrixBase&) with the else expression being a scalar value.
|
inline |
This is defined in the Array module.
Version of MatrixBase::select(const MatrixBase&, const MatrixBase&) with the then expression being a scalar value.
|
inline |
Sets all coefficients in this expression to value.
|
inline |
Writes the identity expression (not necessarily square) into *this.
Example:
Output:
0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0
|
inline |
Sets all coefficients in this expression to one.
Example:
Output:
7 9 -5 -3 1 1 1 1 6 -3 0 9 6 6 3 9
|
inline |
This is defined in the Array module.
Sets all coefficients in this expression to random values.
Example:
Output:
0 7 0 0 0 -2 0 0 0 6 0 0 0 6 0 0
|
inline |
Sets all coefficients in this expression to zero.
Example:
Output:
7 9 -5 -3 0 0 0 0 6 -3 0 9 6 6 3 9
|
inline |
ei_plain_matrix_type_column_major< OtherDerived >::type solveTriangular | ( | const MatrixBase< OtherDerived > & | other) | const |
*this
with other, *this being triangular.This function computes the inverse-matrix matrix product inverse(*this
) * other. The matrix *this
must be triangular and invertible (i.e., all the coefficients of the diagonal must be non zero). It works as a forward (resp. backward) substitution if *this
is an upper (resp. lower) triangular matrix.
It is required that *this
be marked as either an upper or a lower triangular matrix, which can be done by marked(), and that is automatically the case with expressions such as those returned by extract().
Example:
Output:
Here is the matrix m: 1 1 1 0 1 1 0 0 1 Here is the matrix n: 2 1 1 2 2 1 2 2 2 And now here is m.inverse()*n, taking advantage of the fact that m is upper-triangular: 0 -1 0 0 0 -1 2 2 2
This function is essentially a wrapper to the faster solveTriangularInPlace() function creating a temporary copy of other, calling solveTriangularInPlace() on the copy and returning it. Therefore, if other is not needed anymore, it is quite faster to call solveTriangularInPlace() instead of solveTriangular().
For users coming from BLAS, this function (and more specifically solveTriangularInPlace()) offer all the operations supported by the *TRSV
and *TRSM
BLAS routines.
Tips: to perform a "right-inverse-multiply" you can simply transpose the operation, e.g.:
void solveTriangularInPlace | ( | const MatrixBase< OtherDerived > & | _other) | const |
"in-place" version of MatrixBase::solveTriangular() where the result is written in other
The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here. This function will const_cast it, so constness isn't honored here.
See MatrixBase:solveTriangular() for the details.
|
inline |
|
inline |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
size | the number of coefficients in the block |
Example:
Output:
Here is the vector v: 7 -2 6 6 Here is v.start(2): 7 -2 Now the vector v is: 0 0 6 6
|
inline |
This is the const version of start(int).
|
inline |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
The template parameter Size is the number of coefficients in the block
Example:
Output:
Here is the vector v: 7 -2 6 6 Here is v.start(2): 7 -2 Now the vector v is: 0 0 6 6
|
inline |
This is the const version of start<int>().
|
inline |
|
inline |
|
inline |
void swap | ( | const MatrixBase< OtherDerived > & | other) |
swaps *this with the expression other.
|
inline |
*this
, i.e. the sum of the coefficients on the main diagonal.*this
can be any matrix, not necessarily square.
|
inline |
Example:
Output:
Here is the matrix m: 7 6 -2 6 Here is the transpose of m: 7 -2 6 6 Here is the coefficient (1,0) in the transpose of m: 6 Let us overwrite this coefficient with the value 0. Now the matrix m is: 7 0 -2 6
|
inline |
This is the const version of transpose().
Make sure you read the warning for transpose() !
|
inline |
This is the "in place" version of transpose: it transposes *this
.
In most cases it is probably better to simply use the transposed expression of a matrix. However, when transposing the matrix data itself is really needed, then this "in-place" version is probably the right choice because it provides the following additional features:
*this
must be a resizable matrix.
|
inline |
The template parameter CustomUnaryOp is the type of the functor of the custom unary operator.
Example:
Output:
0.68 0.823 -0.444 -0.27 -0.211 -0.605 0.108 0.0268 0.566 -0.33 -0.0452 0.904 0.597 0.536 0.258 0.832 becomes: 0.5 0.5 -0.444 -0.27 -0.211 -0.5 0.108 0.0268 0.5 -0.33 -0.0452 0.5 0.5 0.5 0.258 0.5
|
inlinestatic |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
|
inlinestatic |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
This variant is for fixed-size vector only.
MatrixBase< Derived >::PlainMatrixType unitOrthogonal | ( | void | ) | const |
*this
The size of *this
must be at least 2. If the size is exactly 2, then the returned vector is a counter clock wise rotation of *this
, i.e., (-y,x).normalized().
|
inlinestatic |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
|
inlinestatic |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
|
inlinestatic |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
|
inlinestatic |
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
void visit | ( | Visitor & | visitor) | const |
Applies the visitor visitor to the whole coefficients of the matrix or vector.
The template parameter Visitor is the type of the visitor and provides the following interface:
|
inline |
equivalent to operator[](3).
|
inline |
equivalent to operator[](3).
|
inline |
Stores the given packet of coefficients, at the given row and column of this expression. It is your responsibility to ensure that a packet really starts there. This method is only available on expressions having the PacketAccessBit.
The LoadMode parameter may have the value Aligned or Unaligned. Its effect is to select the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets starting at an address which is a multiple of the packet size.
|
inline |
Stores the given packet of coefficients, at the given index in this expression. It is your responsibility to ensure that a packet really starts there. This method is only available on expressions having the PacketAccessBit and the LinearAccessBit.
The LoadMode parameter may have the value Aligned or Unaligned. Its effect is to select the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets starting at an address which is a multiple of the packet size.
|
inline |
equivalent to operator[](0).
|
inline |
equivalent to operator[](0).
|
inline |
equivalent to operator[](1).
|
inline |
equivalent to operator[](1).
|
inline |
equivalent to operator[](2).
|
inline |
equivalent to operator[](2).
|
inlinestatic |
The parameters rows and cols are the number of rows and of columns of the returned matrix. Must be compatible with this MatrixBase type.
This variant is meant to be used for dynamic-size matrix types. For fixed-size types, it is redundant to pass rows and cols as arguments, so Zero() should be used instead.
Example:
Output:
0 0 0 0 0 0
|
inlinestatic |
The parameter size is the size of the returned vector. Must be compatible with this MatrixBase type.
This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.
This variant is meant to be used for dynamic-size vector types. For fixed-size types, it is redundant to pass size as argument, so Zero() should be used instead.
Example:
Output:
0 0 0 0 0 0
|
inlinestatic |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
Example:
Output:
0 0 0 0 0 0 0 0
|
related |
Outputs the matrix, to the given stream.
If you wish to print the matrix with a format different than the default, use MatrixBase::format().
It is also possible to change the default format by defining EIGEN_DEFAULT_IO_FORMAT before including Eigen headers. If not defined, this will automatically be defined to Eigen::IOFormat(), that is the Eigen::IOFormat with default parameters.