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 |
template<int BlockRows, int BlockCols> | |
const BlockReturnType< Derived, BlockRows, BlockCols >::Type | block (int startRow, int startCol) const |
template<int BlockRows, int BlockCols> | |
BlockReturnType< Derived, BlockRows, BlockCols >::Type | block (int startRow, int startCol) |
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) |
template<typename NewType > | |
const CwiseUnaryOp < ei_scalar_cast_op< typename ei_traits< Derived >::Scalar, NewType >, Derived > | cast () const |
const Scalar | coeff (int index) const |
const Scalar | coeff (int row, int col) const |
Scalar & | coeffRef (int index) |
Scalar & | coeffRef (int row, int col) |
const ColXpr | col (int i) const |
ColXpr | col (int i) |
int | cols () const |
const PartialRedux< Derived, Vertical > | colwise () const |
void | computeInverse (PlainMatrixType *result) const |
ConjugateReturnType | conjugate () const |
template<int CRows, int CCols> | |
const BlockReturnType< Derived, CRows, CCols >::Type | corner (CornerType type) const |
template<int CRows, int CCols> | |
BlockReturnType< Derived, CRows, CCols >::Type | corner (CornerType type) |
const BlockReturnType< Derived > ::Type | corner (CornerType type, int cRows, int cCols) const |
BlockReturnType< Derived >::Type | corner (CornerType type, int cRows, int cCols) |
int | count () const |
template<typename OtherDerived > | |
PlainMatrixType | cross (const MatrixBase< OtherDerived > &other) const |
Cwise< Derived > | cwise () |
const Cwise< Derived > | cwise () const |
Scalar | determinant () const |
const DiagonalCoeffs< Derived > | diagonal () const |
DiagonalCoeffs< Derived > | diagonal () |
template<typename OtherDerived > | |
Scalar | dot (const MatrixBase< OtherDerived > &other) const |
EigenvaluesReturnType | eigenvalues () const |
template<int Size> | |
const BlockReturnType< Derived, Size >::SubVectorType | end () const |
template<int Size> | |
BlockReturnType< Derived, Size > ::SubVectorType | end () |
const BlockReturnType< Derived, Dynamic >::SubVectorType | end (int size) const |
BlockReturnType< Derived, Dynamic >::SubVectorType | end (int size) |
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 OtherDerived > | |
bool | isMuchSmallerThan (const MatrixBase< OtherDerived > &other, typename NumTraits< Scalar >::Real prec) 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, RealScalar prec=precision< Scalar >()) const |
bool | isMuchSmallerThan (const RealScalar &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, DenseTimeSparseProduct > &product) |
template<typename Lhs , typename Rhs > | |
Derived & | lazyAssign (const SparseProduct< Lhs, Rhs, SparseTimeDenseProduct > &product) |
template<typename Lhs , typename Rhs > | |
Derived & | lazyAssign (const Product< Lhs, Rhs, CacheFriendlyProduct > &product) |
template<typename Derived1 , typename Derived2 > | |
Derived & | lazyAssign (const SparseProduct< Derived1, Derived2, DenseTimeSparseProduct > &product) |
template<typename Derived1 , typename Derived2 > | |
Derived & | lazyAssign (const SparseProduct< Derived1, Derived2, SparseTimeDenseProduct > &product) |
const LDLT< PlainMatrixType > | ldlt () const |
const LLT< PlainMatrixType > | llt () const |
template<int p> | |
RealScalar | lpNorm () const |
const LU< PlainMatrixType > | lu () const |
template<unsigned int Added> | |
const Flagged< Derived, Added, 0 > | marked () const |
MatrixBase () | |
ei_traits< Derived >::Scalar | maxCoeff (int *row, int *col=0) const |
ei_traits< Derived >::Scalar | maxCoeff () const |
ei_traits< Derived >::Scalar | minCoeff (int *row, int *col=0) const |
ei_traits< Derived >::Scalar | minCoeff () const |
const Minor< Derived > | minor (int row, int col) const |
Minor< Derived > | minor (int row, int col) |
const NestByValue< Derived > | nestByValue () const |
int | nonZeros () const |
RealScalar | norm () const |
void | normalize () |
const PlainMatrixType | normalized () const |
template<typename OtherDerived > | |
bool | operator!= (const MatrixBase< OtherDerived > &other) const |
Scalar & | operator() (int index) |
const Scalar | operator() (int index) const |
Scalar & | operator() (int row, int col) |
const Scalar | operator() (int row, int col) const |
template<typename OtherDerived > | |
const ProductReturnType < Derived, OtherDerived > ::Type | operator* (const MatrixBase< OtherDerived > &other) const |
const ScalarMultipleReturnType | operator* (const Scalar &scalar) const |
template<typename OtherDerived > | |
Derived & | operator*= (const MatrixBase< OtherDerived > &other) |
Derived & | operator*= (const Scalar &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 Lhs , typename Rhs > | |
Derived & | operator+= (const Flagged< Product< Lhs, Rhs, CacheFriendlyProduct >, 0, EvalBeforeNestingBit|EvalBeforeAssigningBit > &other) |
template<typename OtherDerived > | |
Derived & | operator+= (const MatrixBase< OtherDerived > &other) |
template<typename OtherDerived > | |
const CwiseBinaryOp < ei_scalar_difference_op < typename ei_traits< Derived > ::Scalar >, Derived, OtherDerived > | operator- (const MatrixBase< OtherDerived > &other) const |
const CwiseUnaryOp < ei_scalar_opposite_op < typename ei_traits< Derived > ::Scalar >, Derived > | operator- () 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) |
template<typename OtherDerived > | |
CommaInitializer< Derived > | operator<< (const MatrixBase< OtherDerived > &other) |
CommaInitializer< Derived > | operator<< (const Scalar &s) |
Derived & | operator= (const MatrixBase &other) |
template<typename OtherDerived > | |
Derived & | operator= (const MatrixBase< OtherDerived > &other) |
template<typename OtherDerived > | |
bool | operator== (const MatrixBase< OtherDerived > &other) const |
Scalar & | operator[] (int index) |
const Scalar | operator[] (int index) const |
RealScalar | operatorNorm () const |
int | outerSize () const |
template<int LoadMode> | |
PacketScalar | packet (int index) const |
template<int LoadMode> | |
PacketScalar | packet (int row, int col) const |
template<unsigned int Mode> | |
const Part< Derived, Mode > | part () const |
template<unsigned int Mode> | |
Part< Derived, Mode > | part () |
const QR< PlainMatrixType > | qr () const |
const RealReturnType | real () const |
const RowXpr | row (int i) const |
RowXpr | row (int i) |
int | rows () const |
const PartialRedux< Derived, Horizontal > | rowwise () const |
template<int Size> | |
const BlockReturnType< Derived, Size >::SubVectorType | segment (int start) const |
template<int Size> | |
BlockReturnType< Derived, Size > ::SubVectorType | segment (int start) |
const BlockReturnType< Derived > ::SubVectorType | segment (int start, int size) const |
BlockReturnType< Derived > ::SubVectorType | segment (int start, int size) |
template<typename ElseDerived > | |
const Select< Derived, NestByValue< typename ElseDerived::ConstantReturnType > , ElseDerived > | select (typename ElseDerived::Scalar thenScalar, 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 ThenDerived , typename ElseDerived > | |
const Select< Derived, ThenDerived, ElseDerived > | select (const MatrixBase< ThenDerived > &thenMatrix, 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 |
template<int Size> | |
const BlockReturnType< Derived, Size >::SubVectorType | start () const |
template<int Size> | |
BlockReturnType< Derived, Size > ::SubVectorType | start (void) |
const BlockReturnType< Derived, Dynamic >::SubVectorType | start (int size) const |
BlockReturnType< Derived, Dynamic >::SubVectorType | start (int size) |
int | stride (void) const |
Scalar | sum () const |
SVD< PlainMatrixType > | svd () const |
template<typename OtherDerived > | |
void | swap (const MatrixBase< OtherDerived > &other) |
Scalar | trace () const |
const Eigen::Transpose< Derived > | transpose () const |
Eigen::Transpose< Derived > | transpose () |
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 |
Scalar & | w () |
const Scalar | w () const |
template<int StoreMode> | |
void | writePacket (int index, const typename ei_packet_traits< typename ei_traits< Derived >::Scalar >::type &x) |
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 index, const PacketScalar &x) |
template<int StoreMode> | |
void | writePacket (int row, int col, const PacketScalar &x) |
Scalar & | x () |
const Scalar | x () const |
Scalar & | y () |
const Scalar | y () const |
Scalar & | z () |
const Scalar | z () const |
Static Public Member Functions | |
static const ConstantReturnType | Constant (const Scalar &value) |
static const ConstantReturnType | Constant (int size, const Scalar &value) |
static const ConstantReturnType | Constant (int rows, int cols, const Scalar &value) |
static const IdentityReturnType | Identity (int rows, int cols) |
static const IdentityReturnType | Identity () |
template<typename CustomNullaryOp > | |
static const CwiseNullaryOp < CustomNullaryOp, Derived > | NullaryExpr (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 (int rows, int cols, const CustomNullaryOp &func) |
static const ConstantReturnType | Ones () |
static const ConstantReturnType | Ones (int size) |
static const ConstantReturnType | Ones (int rows, int cols) |
static const CwiseNullaryOp < ei_scalar_random_op< Scalar > , Derived > | Random () |
static const CwiseNullaryOp < ei_scalar_random_op< Scalar > , Derived > | Random (int size) |
static const CwiseNullaryOp < ei_scalar_random_op< Scalar > , Derived > | Random (int rows, int cols) |
static const BasisReturnType | Unit (int i) |
static const BasisReturnType | Unit (int size, int i) |
static const BasisReturnType | UnitW () |
static const BasisReturnType | UnitX () |
static const BasisReturnType | UnitY () |
static const BasisReturnType | UnitZ () |
static const ConstantReturnType | Zero () |
static const ConstantReturnType | Zero (int size) |
static const ConstantReturnType | Zero (int rows, int cols) |
Friends | |
const CwiseUnaryOp < ei_scalar_multiple_op < typename ei_traits< Derived > ::Scalar >, Derived > | operator* (const Scalar &scalar, const MatrixBase &matrix) |
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.
template<typename Derived> void printFirstRow(const Eigen::MatrixBase<Derived>& x) { cout << x.row(0) << endl; }
anonymous enum |
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. |
MatrixBase | ( | ) | [inline] |
Default constructor. Just checks at compile-time for self-consistency of the flags.
const MatrixBase< Derived >::AdjointReturnType adjoint | ( | ) | const [inline] |
Example:
Matrix2cf m = Matrix2cf::Random(); cout << "Here is the 2x2 complex matrix m:" << endl << m << endl; cout << "Here is the adjoint of m:" << endl << m.adjoint() << endl;
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)
m = m.adjoint(); // bug!!! caused by aliasing effect
m = m.adjoint().eval();
bool all | ( | void | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones()); Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwise().abs(); // let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax: cout << "Is (" << p0.transpose() << ") inside the box: " << ((boxMin.cwise()<p0).all() && (boxMax.cwise()>p0).all()) << endl; cout << "Is (" << p1.transpose() << ") inside the box: " << ((boxMin.cwise()<p1).all() && (boxMax.cwise()>p1).all()) << endl;
Output:
Is ( 0.68 -0.211 0.566) inside the box: 0 Is (0.597 0.823 0.605) inside the box: 1
bool any | ( | void | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
const DiagonalMatrix< Derived > asDiagonal | ( | ) | const [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.
cout << Vector3i(2,5,6).asDiagonal() << endl;
Output:
2 0 0 0 5 0 0 0 6
const CwiseBinaryOp< CustomBinaryOp, Derived, OtherDerived > binaryExpr | ( | const MatrixBase< OtherDerived > & | other, | |
const CustomBinaryOp & | func = CustomBinaryOp() | |||
) | const [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:
#include <Eigen/Core> #include <Eigen/Array> USING_PART_OF_NAMESPACE_EIGEN using namespace std; // define a custom template binary functor template<typename Scalar> struct MakeComplexOp EIGEN_EMPTY_STRUCT { typedef complex<Scalar> result_type; complex<Scalar> operator()(const Scalar& a, const Scalar& b) const { return complex<Scalar>(a,b); } }; int main(int, char**) { Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random(); cout << m1.binaryExpr(m2, MakeComplexOp<double>()) << endl; return 0; }
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)
const BlockReturnType< Derived, BlockRows, BlockCols >::Type block | ( | int | startRow, | |
int | startCol | |||
) | const [inline] |
This is the const version of block<>(int, int).
BlockReturnType< Derived, BlockRows, BlockCols >::Type block | ( | int | startRow, | |
int | startCol | |||
) | [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 |
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.block<2,2>(1,1):" << endl << m.block<2,2>(1,1) << endl; m.block<2,2>(1,1).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
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
m.template block<3,3>(1,1);
const BlockReturnType< Derived >::Type block | ( | int | startRow, | |
int | startCol, | |||
int | blockRows, | |||
int | blockCols | |||
) | const [inline] |
This is the const version of block(int,int,int,int).
BlockReturnType< Derived >::Type block | ( | int | startRow, | |
int | startCol, | |||
int | blockRows, | |||
int | blockCols | |||
) | [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 |
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.block(1, 1, 2, 2):" << endl << m.block(1, 1, 2, 2) << endl; m.block(1, 1, 2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
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
const CwiseUnaryOp< ei_scalar_cast_op< typename ei_traits< Derived >::Scalar, NewType >, Derived > cast | ( | ) | const [inline] |
The template parameter NewScalar is the type we are casting the scalars to.
const ei_traits< Derived >::Scalar coeff | ( | int | index | ) | 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 .
Reimplemented in MapBase< Derived >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
const ei_traits< Derived >::Scalar coeff | ( | int | row, | |
int | col | |||
) | const [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 .
Reimplemented in MapBase< Derived >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
ei_traits< Derived >::Scalar & coeffRef | ( | int | index | ) | [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).
Reimplemented in MapBase< Derived >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
ei_traits< Derived >::Scalar & coeffRef | ( | int | row, | |
int | col | |||
) | [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).
Reimplemented in MapBase< Derived >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
const MatrixBase< Derived >::ColXpr col | ( | int | i | ) | const [inline] |
This is the const version of col().
MatrixBase< Derived >::ColXpr col | ( | int | i | ) | [inline] |
Matrix3d m = Matrix3d::Identity(); m.col(1) = Vector3d(4,5,6); cout << m << endl;
Output:
1 4 0 0 5 0 0 6 1
Reimplemented in Part< MatrixType, Mode >.
int cols | ( | ) | const [inline] |
Reimplemented in Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >, PartialReduxExpr< MatrixType, MemberOp, Direction >, NestByValue< ExpressionType >, Flagged< ExpressionType, Added, Removed >, Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >, CwiseBinaryOp< BinaryOp, Lhs, Rhs >, CwiseUnaryOp< UnaryOp, MatrixType >, CwiseNullaryOp< NullaryOp, MatrixType >, Product< LhsNested, RhsNested, ProductMode >, MapBase< Derived >, Block< MatrixType, BlockRows, BlockCols, PacketAccess, _DirectAccessStatus >, Minor< MatrixType >, Transpose< MatrixType >, DiagonalMatrix< CoeffsVectorType >, DiagonalCoeffs< MatrixType >, Part< MatrixType, Mode >, Matrix< Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< Scalar, HDim, HDim >, Matrix< Complex, MatrixType::ColsAtCompileTime, 1 >, Matrix< Scalar, 4, 1 >, Matrix< Scalar, 3, 1 >, Matrix< Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< Scalar, Dim, 1 >, Matrix< Scalar, MinSize, 1 >, Matrix< int, Dynamic, 1 >, Matrix< Scalar, SizeMinusOne, 1 >, Matrix< Scalar, AmbientDimAtCompileTime, 1 >, Matrix< RealScalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< Scalar, MatrixType::ColsAtCompileTime, 1 >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
const PartialRedux< Derived, Vertical > colwise | ( | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
Example:
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl; cout << "Here is the maximum absolute value of each column:" << endl << m.cwise().abs().colwise().maxCoeff() << endl;
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
void computeInverse | ( | PlainMatrixType * | result | ) | const [inline] |
This is defined in the LU module.
#include <Eigen/LU>
Computes the matrix inverse of this matrix.
result | Pointer to the matrix in which to store the result. |
Example:
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d inv; m.computeInverse(&inv); cout << "Its inverse is:" << endl << inv << endl;
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
MatrixBase< Derived >::ConjugateReturnType conjugate | ( | ) | const [inline] |
*this
.const MatrixBase< Derived >::ConstantReturnType Constant | ( | const Scalar & | value | ) | [inline, static] |
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.
const MatrixBase< Derived >::ConstantReturnType Constant | ( | int | size, | |
const Scalar & | value | |||
) | [inline, static] |
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.
const MatrixBase< Derived >::ConstantReturnType Constant | ( | int | rows, | |
int | cols, | |||
const Scalar & | value | |||
) | [inline, static] |
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.
const BlockReturnType< Derived, CRows, CCols >::Type corner | ( | CornerType | type | ) | const [inline] |
This is the const version of corner<int, int>(CornerType).
BlockReturnType< Derived, CRows, CCols >::Type corner | ( | CornerType | type | ) | [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:
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the bottom-right 2x3 corner in m:" << endl << m.corner<2,3>(Eigen::BottomRight) << endl; m.corner<2,3>(Eigen::BottomRight).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
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
const BlockReturnType< Derived >::Type corner | ( | CornerType | type, | |
int | cRows, | |||
int | cCols | |||
) | const [inline] |
This is the const version of corner(CornerType, int, int).
BlockReturnType< Derived >::Type corner | ( | CornerType | type, | |
int | cRows, | |||
int | cCols | |||
) | [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 |
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the bottom-right 2x3 corner in m:" << endl << m.corner(Eigen::BottomRight, 2, 3) << endl; m.corner(Eigen::BottomRight, 2, 3).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
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
int count | ( | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
MatrixBase< Derived >::PlainMatrixType cross | ( | const MatrixBase< OtherDerived > & | other | ) | const [inline] |
This is defined in the Geometry module.
#include <Eigen/Geometry>
*this
and other Here is a very good explanation of cross-product: http://xkcd.com/199/
Cwise< Derived > cwise | ( | ) | [inline] |
Example:
Vector3d v(1,2,3); v.cwise() += 3; v.cwise() -= 2; cout << v << endl;
Output:
2 3 4
const Cwise< Derived > cwise | ( | ) | const [inline] |
Example:
Vector3d v(-1,2,-3); cout << "the absolute values:" << endl << v.cwise().abs() << endl; cout << "the absolute values plus one:" << endl << v.cwise().abs().cwise()+1 << endl; cout << "sum of the squares: " << v.cwise().square().sum() << endl;
Output:
the absolute values: 1 2 3 the absolute values plus one: 2 3 4 sum of the squares: 14
ei_traits< Derived >::Scalar determinant | ( | ) | const [inline] |
This is defined in the LU module.
#include <Eigen/LU>
const DiagonalCoeffs< Derived > diagonal | ( | ) | const [inline] |
This is the const version of diagonal().
DiagonalCoeffs< Derived > diagonal | ( | ) | [inline] |
*this
*this
is not required to be square.
Example:
Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here are the coefficients on the main diagonal of m:" << endl << m.diagonal() << endl;
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
ei_traits< Derived >::Scalar dot | ( | const MatrixBase< OtherDerived > & | other | ) | const [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.
Matrix< typename NumTraits< typename ei_traits< Derived >::Scalar >::Real, ei_traits< Derived >::ColsAtCompileTime, 1 > eigenvalues | ( | ) | const [inline] |
This is defined in the QR module.
#include <Eigen/QR>
const BlockReturnType< Derived, Size >::SubVectorType end | ( | ) | const [inline] |
This is the const version of end<int>.
BlockReturnType< Derived, Size >::SubVectorType end | ( | ) | [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:
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.end(2):" << endl << v.end<2>() << endl; v.end<2>().setZero(); cout << "Now the vector v is:" << endl << v << endl;
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
const BlockReturnType< Derived, Dynamic >::SubVectorType end | ( | int | size | ) | const [inline] |
This is the const version of end(int).
BlockReturnType< Derived, Dynamic >::SubVectorType end | ( | int | size | ) | [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 |
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.end(2):" << endl << v.end(2) << endl; v.end(2).setZero(); cout << "Now the vector v is:" << endl << v << endl;
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
const ei_eval<Derived>::type eval | ( | ) | const [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.
void fill | ( | const Scalar & | value | ) | [inline] |
Alias for setConstant(): sets all coefficients in this expression to value.
const WithFormat< Derived > format | ( | const IOFormat & | fmt | ) | const [inline] |
See class IOFormat for some examples.
const MatrixBase< Derived >::IdentityReturnType Identity | ( | int | rows, | |
int | cols | |||
) | [inline, static] |
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.
cout << MatrixXd::Identity(4, 3) << endl;
Output:
1 0 0 0 1 0 0 0 1 0 0 0
const MatrixBase< Derived >::IdentityReturnType Identity | ( | ) | [inline, static] |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variant taking size arguments.
Example:
cout << Matrix<double, 3, 4>::Identity() << endl;
Output:
1 0 0 0 0 1 0 0 0 0 1 0
const MatrixBase< Derived >::ImagReturnType imag | ( | ) | const [inline] |
*this
.int innerSize | ( | ) | const [inline] |
const MatrixBase< Derived >::PlainMatrixType inverse | ( | ) | const [inline] |
This is defined in the LU module.
#include <Eigen/LU>
Example:
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Its inverse is:" << endl << m.inverse() << endl;
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 [inline] |
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 [inline] |
bool isConstant | ( | const Scalar & | value, | |
RealScalar | prec = precision<Scalar>() | |||
) | const [inline] |
This is just an alias for isApproxToConstant().
bool isDiagonal | ( | RealScalar | prec = precision<Scalar>() |
) | const [inline] |
Example:
Matrix3d m = 10000 * Matrix3d::Identity(); m(0,2) = 1; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isDiagonal() returns: " << m.isDiagonal() << endl; cout << "m.isDiagonal(1e-3) returns: " << m.isDiagonal(1e-3) << endl;
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 [inline] |
Example:
Matrix3d m = Matrix3d::Identity(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isIdentity() returns: " << m.isIdentity() << endl; cout << "m.isIdentity(1e-3) returns: " << m.isIdentity(1e-3) << endl;
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 [inline] |
bool isMuchSmallerThan | ( | const MatrixBase< OtherDerived > & | other, | |
typename NumTraits< Scalar >::Real | prec | |||
) | const [inline] |
true
if the norm of *this
is much smaller than the norm of other, within the precision determined by prec.
bool isMuchSmallerThan | ( | const typename NumTraits< Scalar >::Real & | other, | |
typename NumTraits< Scalar >::Real | prec | |||
) | const [inline] |
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 isOnes | ( | RealScalar | prec = precision<Scalar>() |
) | const [inline] |
Example:
Matrix3d m = Matrix3d::Ones(); m(0,2) += 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isOnes() returns: " << m.isOnes() << endl; cout << "m.isOnes(1e-3) returns: " << m.isOnes(1e-3) << endl;
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 [inline] |
Example:
Vector3d v(1,0,0); Vector3d w(1e-4,0,1); cout << "Here's the vector v:" << endl << v << endl; cout << "Here's the vector w:" << endl << w << endl; cout << "v.isOrthogonal(w) returns: " << v.isOrthogonal(w) << endl; cout << "v.isOrthogonal(w,1e-3) returns: " << v.isOrthogonal(w,1e-3) << endl;
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 [inline] |
m.isUnitary()
returns true if and only if the columns (equivalently, the rows) of m form an orthonormal basis.Example:
Matrix3d m = Matrix3d::Identity(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isUnitary() returns: " << m.isUnitary() << endl; cout << "m.isUnitary(1e-3) returns: " << m.isUnitary(1e-3) << endl;
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 isVector | ( | ) | const [inline] |
bool isZero | ( | RealScalar | prec = precision<Scalar>() |
) | const [inline] |
Example:
Matrix3d m = Matrix3d::Zero(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isZero() returns: " << m.isZero() << endl; cout << "m.isZero(1e-3) returns: " << m.isZero(1e-3) << endl;
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
const Flagged< Derived, 0, EvalBeforeNestingBit|EvalBeforeAssigningBit > lazy | ( | ) | const [inline] |
Example:
Matrix2d m; m << 1,2,3,4; cout << (m*m).lazy().row(0) << endl; // this computes only one row of the product. By contrast, // if we did "(m*m).row(0);" then m*m would first be evaluated into // a temporary, because the Product expression has the EvalBeforeNestingBit.
Output:
7 10
const LDLT< typename MatrixBase< Derived >::PlainMatrixType > ldlt | ( | ) | const [inline] |
This is defined in the Cholesky module.
#include <Eigen/Cholesky>
*this
const LLT< typename MatrixBase< Derived >::PlainMatrixType > llt | ( | ) | const [inline] |
This is defined in the Cholesky module.
#include <Eigen/Cholesky>
*this
NumTraits< typename ei_traits< Derived >::Scalar >::Real lpNorm | ( | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
const LU< typename MatrixBase< Derived >::PlainMatrixType > lu | ( | ) | const [inline] |
const Flagged< Derived, Added, 0 > marked | ( | ) | const [inline] |
Matrix3d m = Matrix3d::Zero(); m.part<Eigen::UpperTriangular>().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d n = Matrix3d::Ones(); n.part<Eigen::LowerTriangular>() *= 2; cout << "Here is the matrix n:" << endl << n << endl; cout << "And now here is m.inverse()*n, taking advantage of the fact that" " m is upper-triangular:" << endl << m.marked<Eigen::UpperTriangular>().solveTriangular(n);
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
ei_traits< Derived >::Scalar maxCoeff | ( | int * | row, | |
int * | col = 0 | |||
) | const [inline] |
ei_traits< Derived >::Scalar maxCoeff | ( | ) | const [inline] |
ei_traits< Derived >::Scalar minCoeff | ( | int * | row, | |
int * | col = 0 | |||
) | const [inline] |
ei_traits< Derived >::Scalar minCoeff | ( | ) | const [inline] |
const Minor< Derived > minor | ( | int | row, | |
int | col | |||
) | const [inline] |
Minor< Derived > minor | ( | int | row, | |
int | col | |||
) | [inline] |
Example:
Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.minor(1,1):" << endl << m.minor(1,1) << endl;
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
const NestByValue< Derived > nestByValue | ( | ) | const [inline] |
int nonZeros | ( | ) | const [inline] |
Reimplemented in Transpose< MatrixType >.
NumTraits< typename ei_traits< Derived >::Scalar >::Real norm | ( | ) | const [inline] |
void normalize | ( | ) | [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.
const MatrixBase< Derived >::PlainMatrixType normalized | ( | ) | const [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.
const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr | ( | const CustomNullaryOp & | func | ) | [inline, static] |
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.
const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr | ( | int | size, | |
const CustomNullaryOp & | func | |||
) | [inline, static] |
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.
const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr | ( | int | rows, | |
int | cols, | |||
const CustomNullaryOp & | func | |||
) | [inline, static] |
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.
const MatrixBase< Derived >::ConstantReturnType Ones | ( | ) | [inline, static] |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
Example:
cout << Matrix2d::Ones() << endl; cout << 6 * RowVector4i::Ones() << endl;
Output:
1 1 1 1 6 6 6 6
const MatrixBase< Derived >::ConstantReturnType Ones | ( | int | size | ) | [inline, static] |
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:
cout << 6 * RowVectorXi::Ones(4) << endl; cout << VectorXf::Ones(2) << endl;
Output:
6 6 6 6 1 1
const MatrixBase< Derived >::ConstantReturnType Ones | ( | int | rows, | |
int | cols | |||
) | [inline, static] |
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.
cout << MatrixXi::Ones(2,3) << endl;
Output:
1 1 1 1 1 1
ei_traits< Derived >::Scalar & operator() | ( | int | index | ) | [inline] |
This is synonymous to operator[](int).
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
const ei_traits< Derived >::Scalar operator() | ( | int | index | ) | const [inline] |
This is synonymous to operator[](int) const.
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
ei_traits< Derived >::Scalar & operator() | ( | int | row, | |
int | col | |||
) | [inline] |
const ei_traits< Derived >::Scalar operator() | ( | int | row, | |
int | col | |||
) | const [inline] |
const ProductReturnType< Derived, OtherDerived >::Type operator* | ( | const MatrixBase< OtherDerived > & | other | ) | const [inline] |
*this
and other.Derived & operator*= | ( | const MatrixBase< OtherDerived > & | other | ) | [inline] |
replaces *this
by *this
* other.
*this
Derived & operator+= | ( | const MatrixBase< OtherDerived > & | other | ) | [inline] |
replaces *this
by *this
+ other.
*this
const CwiseBinaryOp< ei_scalar_difference_op< typename ei_traits< Derived >::Scalar >, Derived, OtherDerived > operator- | ( | const MatrixBase< OtherDerived > & | other | ) | const [inline] |
*this
and other const CwiseUnaryOp< ei_scalar_opposite_op< typename ei_traits< Derived >::Scalar >, Derived > operator- | ( | ) | const [inline] |
*this
Derived & operator-= | ( | const MatrixBase< OtherDerived > & | other | ) | [inline] |
replaces *this
by *this
- other.
*this
CommaInitializer< Derived > operator<< | ( | const MatrixBase< OtherDerived > & | other | ) | [inline] |
CommaInitializer< Derived > operator<< | ( | const Scalar & | s | ) | [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.
Matrix3i m1; m1 << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << m1 << endl << endl; Matrix3i m2 = Matrix3i::Identity(); m2.block(0,0, 2,2) << 10, 11, 12, 13; cout << m2 << endl << endl; Vector2i v1; v1 << 14, 15; m2 << v1.transpose(), 16, v1, m1.block(1,1,2,2); cout << m2 << endl;
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
Derived& operator= | ( | const MatrixBase< Derived > & | other | ) | [inline] |
Special case of the template operator=, in order to prevent the compiler from generating a default operator= (issue hit with g++ 4.1)
Reimplemented in MapBase< Derived >.
Derived& operator= | ( | const MatrixBase< OtherDerived > & | other | ) | [inline] |
Copies other into *this.
Reimplemented in Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >, MapBase< Derived >, Matrix< Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< Scalar, HDim, HDim >, Matrix< Complex, MatrixType::ColsAtCompileTime, 1 >, Matrix< Scalar, 4, 1 >, Matrix< Scalar, 3, 1 >, Matrix< Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< Scalar, Dim, 1 >, Matrix< Scalar, MinSize, 1 >, Matrix< int, Dynamic, 1 >, Matrix< Scalar, SizeMinusOne, 1 >, Matrix< Scalar, AmbientDimAtCompileTime, 1 >, Matrix< RealScalar, MatrixType::ColsAtCompileTime, 1 >, and Matrix< Scalar, MatrixType::ColsAtCompileTime, 1 >.
ei_traits< Derived >::Scalar & operator[] | ( | int | index | ) | [inline] |
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
const ei_traits< Derived >::Scalar operator[] | ( | int | index | ) | const [inline] |
This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit.
NumTraits< typename ei_traits< Derived >::Scalar >::Real operatorNorm | ( | ) | const [inline] |
This is defined in the QR module.
#include <Eigen/QR>
int outerSize | ( | ) | const [inline] |
ei_packet_traits< typename ei_traits< Derived >::Scalar >::type packet | ( | int | index | ) | const [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.
Reimplemented in MapBase< Derived >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
ei_packet_traits< typename ei_traits< Derived >::Scalar >::type packet | ( | int | row, | |
int | col | |||
) | const [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.
Reimplemented in MapBase< Derived >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
const Part< Derived, Mode > part | ( | ) | const [inline] |
The parameter Mode can have the following values: UpperTriangular
, StrictlyUpperTriangular
, UnitUpperTriangular
, LowerTriangular
, StrictlyLowerTriangular
, UnitLowerTriangular
.
Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the upper-triangular matrix extracted from m:" << endl << m.part<Eigen::UpperTriangular>() << endl; cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl << m.part<Eigen::StrictlyUpperTriangular>() << endl; cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl << m.part<Eigen::UnitLowerTriangular>() << endl;
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
Part< Derived, Mode > part | ( | ) | [inline] |
*this
.The Mode parameter can have the following values: UpperTriangular
, StrictlyUpperTriangular
, LowerTriangular
, StrictlyLowerTriangular
, SelfAdjoint
.
Matrix3d m = Matrix3d::Zero(); m.part<Eigen::StrictlyUpperTriangular>().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; cout << "And let us now compute m*m.adjoint() in a very optimized way" << endl << "taking advantage of the symmetry." << endl; Matrix3d n; n.part<Eigen::SelfAdjoint>() = (m*m.adjoint()).lazy(); cout << "The result is:" << endl << n << endl;
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 QR< typename MatrixBase< Derived >::PlainMatrixType > qr | ( | ) | const [inline] |
const CwiseNullaryOp< ei_scalar_random_op< typename ei_traits< Derived >::Scalar >, Derived > Random | ( | ) | [inline, static] |
This is defined in the Array module.
#include <Eigen/Array>
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
Example:
cout << 100 * Matrix2i::Random() << endl;
Output:
700 600 -200 600
const CwiseNullaryOp< ei_scalar_random_op< typename ei_traits< Derived >::Scalar >, Derived > Random | ( | int | size | ) | [inline, static] |
This is defined in the Array module.
#include <Eigen/Array>
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:
cout << VectorXi::Random(2) << endl;
Output:
7 -2
const CwiseNullaryOp< ei_scalar_random_op< typename ei_traits< Derived >::Scalar >, Derived > Random | ( | int | rows, | |
int | cols | |||
) | [inline, static] |
This is defined in the Array module.
#include <Eigen/Array>
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.
cout << MatrixXi::Random(2,3) << endl;
Output:
7 6 9 -2 6 -6
const MatrixBase< Derived >::RealReturnType real | ( | ) | const [inline] |
*this
.const MatrixBase< Derived >::RowXpr row | ( | int | i | ) | const [inline] |
This is the const version of row().
MatrixBase< Derived >::RowXpr row | ( | int | i | ) | [inline] |
Matrix3d m = Matrix3d::Identity(); m.row(1) = Vector3d(4,5,6); cout << m << endl;
Output:
1 0 0 4 5 6 0 0 1
Reimplemented in Part< MatrixType, Mode >.
int rows | ( | ) | const [inline] |
Reimplemented in Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType >, PartialReduxExpr< MatrixType, MemberOp, Direction >, NestByValue< ExpressionType >, Flagged< ExpressionType, Added, Removed >, Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >, CwiseBinaryOp< BinaryOp, Lhs, Rhs >, CwiseUnaryOp< UnaryOp, MatrixType >, CwiseNullaryOp< NullaryOp, MatrixType >, Product< LhsNested, RhsNested, ProductMode >, MapBase< Derived >, Block< MatrixType, BlockRows, BlockCols, PacketAccess, _DirectAccessStatus >, Minor< MatrixType >, Transpose< MatrixType >, DiagonalMatrix< CoeffsVectorType >, DiagonalCoeffs< MatrixType >, Part< MatrixType, Mode >, Matrix< Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< Scalar, HDim, HDim >, Matrix< Complex, MatrixType::ColsAtCompileTime, 1 >, Matrix< Scalar, 4, 1 >, Matrix< Scalar, 3, 1 >, Matrix< Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< Scalar, Dim, 1 >, Matrix< Scalar, MinSize, 1 >, Matrix< int, Dynamic, 1 >, Matrix< Scalar, SizeMinusOne, 1 >, Matrix< Scalar, AmbientDimAtCompileTime, 1 >, Matrix< RealScalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< Scalar, MatrixType::ColsAtCompileTime, 1 >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
const PartialRedux< Derived, Horizontal > rowwise | ( | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
Example:
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl; cout << "Here is the maximum absolute value of each row:" << endl << m.cwise().abs().rowwise().maxCoeff() << endl;
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
const BlockReturnType< Derived, Size >::SubVectorType segment | ( | int | start | ) | const [inline] |
This is the const version of segment<int>(int).
BlockReturnType< Derived, Size >::SubVectorType segment | ( | int | start | ) | [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:
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.segment<2>(1):" << endl << v.segment<2>(1) << endl; v.segment<2>(2).setZero(); cout << "Now the vector v is:" << endl << v << endl;
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
const BlockReturnType< Derived >::SubVectorType segment | ( | int | start, | |
int | size | |||
) | const [inline] |
This is the const version of segment(int,int).
BlockReturnType< Derived >::SubVectorType segment | ( | int | start, | |
int | size | |||
) | [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:
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.segment(1, 2):" << endl << v.segment(1, 2) << endl; v.segment(1, 2).setZero(); cout << "Now the vector v is:" << endl << v << endl;
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
const Select< Derived, NestByValue< typename ElseDerived::ConstantReturnType >, ElseDerived > select | ( | typename ElseDerived::Scalar | thenScalar, | |
const MatrixBase< ElseDerived > & | elseMatrix | |||
) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
Version of MatrixBase::select(const MatrixBase&, const MatrixBase&) with the then expression being a scalar value.
const Select< Derived, ThenDerived, NestByValue< typename ThenDerived::ConstantReturnType > > select | ( | const MatrixBase< ThenDerived > & | thenMatrix, | |
typename ThenDerived::Scalar | elseScalar | |||
) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
Version of MatrixBase::select(const MatrixBase&, const MatrixBase&) with the else expression being a scalar value.
const Select< Derived, ThenDerived, ElseDerived > select | ( | const MatrixBase< ThenDerived > & | thenMatrix, | |
const MatrixBase< ElseDerived > & | elseMatrix | |||
) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
*this
(i,j), and elseMatrix(i,j) otherwise.Example:
Output:
Derived & setConstant | ( | const Scalar & | value | ) | [inline] |
Sets all coefficients in this expression to value.
Derived & setIdentity | ( | ) | [inline] |
Writes the identity expression (not necessarily square) into *this.
Example:
Matrix4i m = Matrix4i::Zero(); m.block<3,3>(1,0).setIdentity(); cout << m << endl;
Output:
0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0
Derived & setOnes | ( | ) | [inline] |
Sets all coefficients in this expression to one.
Example:
Matrix4i m = Matrix4i::Random(); m.row(1).setOnes(); cout << m << endl;
Output:
7 9 -5 -3 1 1 1 1 6 -3 0 9 6 6 3 9
Derived & setRandom | ( | ) | [inline] |
This is defined in the Array module.
#include <Eigen/Array>
Sets all coefficients in this expression to random values.
Example:
Matrix4i m = Matrix4i::Zero(); m.col(1).setRandom(); cout << m << endl;
Output:
0 7 0 0 0 -2 0 0 0 6 0 0 0 6 0 0
Derived & setZero | ( | ) | [inline] |
Sets all coefficients in this expression to zero.
Example:
Matrix4i m = Matrix4i::Random(); m.row(1).setZero(); cout << m << endl;
Output:
7 9 -5 -3 0 0 0 0 6 -3 0 9 6 6 3 9
int size | ( | ) | const [inline] |
ei_plain_matrix_type_column_major< OtherDerived >::type solveTriangular | ( | const MatrixBase< OtherDerived > & | other | ) | const [inline] |
*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().
Matrix3d m = Matrix3d::Zero(); m.part<Eigen::UpperTriangular>().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d n = Matrix3d::Ones(); n.part<Eigen::LowerTriangular>() *= 2; cout << "Here is the matrix n:" << endl << n << endl; cout << "And now here is m.inverse()*n, taking advantage of the fact that" " m is upper-triangular:" << endl << m.marked<Eigen::UpperTriangular>().solveTriangular(n);
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.:
M * T^1 <=> T.transpose().solveTriangularInPlace(M.transpose());
void solveTriangularInPlace | ( | const MatrixBase< OtherDerived > & | _other | ) | const [inline] |
"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.
NumTraits< typename ei_traits< Derived >::Scalar >::Real squaredNorm | ( | ) | const [inline] |
const BlockReturnType< Derived, Size >::SubVectorType start | ( | void | ) | [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
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.start(2):" << endl << v.start<2>() << endl; v.start<2>().setZero(); cout << "Now the vector v is:" << endl << v << endl;
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
This is the const version of start<int>().
const BlockReturnType< Derived, Dynamic >::SubVectorType start | ( | int | size | ) | const [inline] |
This is the const version of start(int).
BlockReturnType< Derived, Dynamic >::SubVectorType start | ( | int | size | ) | [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 |
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.start(2):" << endl << v.start(2) << endl; v.start(2).setZero(); cout << "Now the vector v is:" << endl << v << endl;
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
int stride | ( | void | ) | const [inline] |
Reimplemented in NestByValue< ExpressionType >, Flagged< ExpressionType, Added, Removed >, Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >, MapBase< Derived >, Map< MatrixType, PacketAccess >, Transpose< MatrixType >, Part< MatrixType, Mode >, Matrix< Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< Scalar, HDim, HDim >, Matrix< Complex, MatrixType::ColsAtCompileTime, 1 >, Matrix< Scalar, 4, 1 >, Matrix< Scalar, 3, 1 >, Matrix< Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< Scalar, Dim, 1 >, Matrix< Scalar, MinSize, 1 >, Matrix< int, Dynamic, 1 >, Matrix< Scalar, SizeMinusOne, 1 >, Matrix< Scalar, AmbientDimAtCompileTime, 1 >, Matrix< RealScalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< Scalar, MatrixType::ColsAtCompileTime, 1 >, MapBase< Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Map< MatrixType, PacketAccess > >.
ei_traits< Derived >::Scalar sum | ( | ) | const [inline] |
SVD< typename MatrixBase< Derived >::PlainMatrixType > svd | ( | ) | const [inline] |
void swap | ( | const MatrixBase< OtherDerived > & | other | ) | [inline] |
swaps *this with the expression other.
ei_traits< Derived >::Scalar trace | ( | ) | const [inline] |
*this
, i.e. the sum of the coefficients on the main diagonal.*this
can be any matrix, not necessarily square.
const Transpose< Derived > transpose | ( | ) | const [inline] |
This is the const version of transpose().
Make sure you read the warning for transpose() !
Transpose< Derived > transpose | ( | ) | [inline] |
Example:
Matrix2i m = Matrix2i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the transpose of m:" << endl << m.transpose() << endl; cout << "Here is the coefficient (1,0) in the transpose of m:" << endl << m.transpose()(1,0) << endl; cout << "Let us overwrite this coefficient with the value 0." << endl; m.transpose()(1,0) = 0; cout << "Now the matrix m is:" << endl << m << endl;
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
m = m.transpose(); // bug!!! caused by aliasing effect
m.transposeInPlace();
m = m.transpose().eval();
void transposeInPlace | ( | ) | [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:
m = m.transpose().eval();
*this
must be a resizable matrix.const CwiseUnaryOp< CustomUnaryOp, Derived > unaryExpr | ( | const CustomUnaryOp & | func = CustomUnaryOp() |
) | const [inline] |
The template parameter CustomUnaryOp is the type of the functor of the custom unary operator.
#include <Eigen/Core> #include <Eigen/Array> USING_PART_OF_NAMESPACE_EIGEN using namespace std; // define a custom template unary functor template<typename Scalar> struct CwiseClampOp { CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {} const Scalar operator()(const Scalar& x) const { return x<m_inf ? m_inf : (x>m_sup ? m_sup : x); } Scalar m_inf, m_sup; }; int main(int, char**) { Matrix4d m1 = Matrix4d::Random(); cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(CwiseClampOp<double>(-0.5,0.5)) << endl; return 0; }
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
const MatrixBase< Derived >::BasisReturnType Unit | ( | int | i | ) | [inline, static] |
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.
const MatrixBase< Derived >::BasisReturnType Unit | ( | int | size, | |
int | i | |||
) | [inline, static] |
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.
MatrixBase< Derived >::PlainMatrixType unitOrthogonal | ( | void | ) | const [inline] |
*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().
const MatrixBase< Derived >::BasisReturnType UnitW | ( | ) | [inline, static] |
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.
const MatrixBase< Derived >::BasisReturnType UnitX | ( | ) | [inline, static] |
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.
const MatrixBase< Derived >::BasisReturnType UnitY | ( | ) | [inline, static] |
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.
const MatrixBase< Derived >::BasisReturnType UnitZ | ( | ) | [inline, static] |
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 [inline] |
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:
struct MyVisitor { // called for the first coefficient void init(const Scalar& value, int i, int j); // called for all other coefficients void operator() (const Scalar& value, int i, int j); };
ei_traits< Derived >::Scalar & w | ( | ) | [inline] |
equivalent to operator[](3).
const ei_traits< Derived >::Scalar w | ( | ) | const [inline] |
equivalent to operator[](3).
void writePacket | ( | int | index, | |
const typename ei_packet_traits< typename ei_traits< Derived >::Scalar >::type & | x | |||
) | [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.
void writePacket | ( | int | row, | |
int | col, | |||
const typename ei_packet_traits< typename ei_traits< Derived >::Scalar >::type & | x | |||
) | [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.
ei_traits< Derived >::Scalar & x | ( | ) | [inline] |
equivalent to operator[](0).
const ei_traits< Derived >::Scalar x | ( | ) | const [inline] |
equivalent to operator[](0).
ei_traits< Derived >::Scalar & y | ( | ) | [inline] |
equivalent to operator[](1).
const ei_traits< Derived >::Scalar y | ( | ) | const [inline] |
equivalent to operator[](1).
ei_traits< Derived >::Scalar & z | ( | ) | [inline] |
equivalent to operator[](2).
const ei_traits< Derived >::Scalar z | ( | ) | const [inline] |
equivalent to operator[](2).
const MatrixBase< Derived >::ConstantReturnType Zero | ( | ) | [inline, static] |
This variant is only for fixed-size MatrixBase types. For dynamic-size types, you need to use the variants taking size arguments.
Example:
cout << Matrix2d::Zero() << endl; cout << RowVector4i::Zero() << endl;
Output:
0 0 0 0 0 0 0 0
const MatrixBase< Derived >::ConstantReturnType Zero | ( | int | size | ) | [inline, static] |
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:
cout << RowVectorXi::Zero(4) << endl; cout << VectorXf::Zero(2) << endl;
Output:
0 0 0 0 0 0
const MatrixBase< Derived >::ConstantReturnType Zero | ( | int | rows, | |
int | cols | |||
) | [inline, static] |
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.
cout << MatrixXi::Zero(2,3) << endl;
Output:
0 0 0 0 0 0