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. |
template<typename Derived> void printFirstRow(const Eigen::MatrixBase<Derived>& x) { cout << x.row(0) << endl; }
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 | 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 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) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Derived> | |
std::ostream & | operator<< (std::ostream &s, const MatrixBase< Derived > &m) |
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] |
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;
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)
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;
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] |
cout << Vector3i(2,5,6).asDiagonal() << endl;
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] |
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; }
(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] |
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;
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;
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] |
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 Select, NestByValue, Flagged, Matrix, CwiseBinaryOp, CwiseUnaryOp, CwiseNullaryOp, Product, MapBase, Block, Transpose, DiagonalCoeffs, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::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 Select, PartialReduxExpr, NestByValue, Flagged, Matrix, CwiseBinaryOp, CwiseUnaryOp, CwiseNullaryOp, Product, MapBase, Block, Minor, Transpose, DiagonalMatrix, DiagonalCoeffs, Part, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::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 NestByValue, Flagged, Matrix, MapBase, Block, Transpose, DiagonalCoeffs, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::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 NestByValue, Flagged, Matrix, MapBase, Block, Minor, Transpose, DiagonalCoeffs, Part, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::Map< MatrixType, PacketAccess > >.
const MatrixBase< Derived >::ColXpr col | ( | int | i | ) | const [inline] |
MatrixBase< Derived >::ColXpr col | ( | int | i | ) | [inline] |
int cols | ( | ) | const [inline] |
Reimplemented in Select, PartialReduxExpr, NestByValue, Flagged, Matrix, CwiseBinaryOp, CwiseUnaryOp, CwiseNullaryOp, Product, MapBase, Block, Minor, Transpose, DiagonalMatrix, DiagonalCoeffs, Part, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::Map< MatrixType, PacketAccess > >.
const PartialRedux< Derived, Vertical > colwise | ( | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
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;
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. |
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;
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] |
const MatrixBase< Derived >::ConstantReturnType Constant | ( | const Scalar & | value | ) | [inline, static] |
The template parameter CustomNullaryOp is the type of the functor.
const MatrixBase< Derived >::ConstantReturnType Constant | ( | int | size, | |
const Scalar & | value | |||
) | [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 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] |
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. |
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;
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;
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 Cwise< Derived > cwise | ( | ) | [inline] |
Vector3d v(1,2,3); v.cwise() += 3; v.cwise() -= 2; cout << v << endl;
2 3 4
const Cwise< Derived > cwise | ( | ) | const [inline] |
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;
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().
Reimplemented in DiagonalMatrix.
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;
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] |
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] |
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;
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] |
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;
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] |
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] |
const MatrixBase< Derived >::IdentityReturnType Identity | ( | int | rows, | |
int | cols | |||
) | [inline, static] |
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;
1 0 0 0 1 0 0 0 1 0 0 0
const MatrixBase< Derived >::IdentityReturnType Identity | ( | ) | [inline, static] |
Example:
cout << Matrix<double, 3, 4>::Identity() << endl;
1 0 0 0 0 1 0 0 0 0 1 0
const MatrixBase< Derived >::ImagReturnType imag | ( | ) | const [inline] |
int innerSize | ( | ) | const [inline] |
const MatrixBase< Derived >::PlainMatrixType inverse | ( | ) | const [inline] |
This is defined in the LU module.
#include <Eigen/LU>
This method returns a matrix by value, which can be inefficient. To avoid that overhead, use computeInverse() instead.
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Its inverse is:" << endl << m.inverse() << endl;
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.
For matrices, the comparison is done using the Hilbert-Schmidt norm (aka Frobenius norm L2 norm).
Because of the multiplicativeness of this comparison, one can't use this function to check whether *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 isDiagonal | ( | RealScalar | prec = precision<Scalar>() |
) | const [inline] |
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;
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] |
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;
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.
For matrices, the comparison is done using the Hilbert-Schmidt norm.
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.
bool isOnes | ( | RealScalar | prec = precision<Scalar>() |
) | const [inline] |
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;
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] |
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;
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.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;
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] |
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;
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] |
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.
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);
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] |
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;
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.
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] |
const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr | ( | const CustomNullaryOp & | func | ) | [inline, static] |
The template parameter CustomNullaryOp is the type of the functor.
const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr | ( | int | size, | |
const CustomNullaryOp & | func | |||
) | [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 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] |
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] |
Example:
cout << Matrix2d::Ones() << endl; cout << 6 * RowVector4i::Ones() << endl;
1 1 1 1 6 6 6 6
const MatrixBase< Derived >::ConstantReturnType Ones | ( | int | size | ) | [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 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;
6 6 6 6 1 1
const MatrixBase< Derived >::ConstantReturnType Ones | ( | int | rows, | |
int | cols | |||
) | [inline, static] |
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;
1 1 1 1 1 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.
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
Reimplemented in MapBase, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::Map< MatrixType, PacketAccess > >.
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
Reimplemented in MapBase, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::Map< MatrixType, PacketAccess > >.
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;
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)
Derived& operator= | ( | const MatrixBase< OtherDerived > & | other | ) | [inline] |
Copies other into *this.
Reimplemented in Matrix, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, and Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >.
ei_traits< Derived >::Scalar & operator[] | ( | int | index | ) | [inline] |
const ei_traits< Derived >::Scalar operator[] | ( | int | index | ) | const [inline] |
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] |
Reimplemented in NestByValue, Flagged, Matrix, CwiseBinaryOp, CwiseUnaryOp, CwiseNullaryOp, MapBase, Block, Transpose, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::Map< MatrixType, PacketAccess > >.
ei_packet_traits< typename ei_traits< Derived >::Scalar >::type packet | ( | int | row, | |
int | col | |||
) | const [inline] |
Reimplemented in NestByValue, Flagged, Matrix, CwiseBinaryOp, CwiseUnaryOp, CwiseNullaryOp, Product, MapBase, Block, Transpose, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::Map< MatrixType, PacketAccess > >.
const Part< Derived, Mode > part | ( | ) | const [inline] |
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;
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
.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;
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>
Example:
cout << 100 * Matrix2i::Random() << endl;
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>
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;
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>
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;
7 6 9 -2 6 -6
const MatrixBase< Derived >::RealReturnType real | ( | ) | const [inline] |
const MatrixBase< Derived >::RowXpr row | ( | int | i | ) | const [inline] |
MatrixBase< Derived >::RowXpr row | ( | int | i | ) | [inline] |
int rows | ( | ) | const [inline] |
Reimplemented in Select, PartialReduxExpr, NestByValue, Flagged, Matrix, CwiseBinaryOp, CwiseUnaryOp, CwiseNullaryOp, Product, MapBase, Block, Minor, Transpose, DiagonalMatrix, DiagonalCoeffs, Part, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::Map< MatrixType, PacketAccess > >.
const PartialRedux< Derived, Horizontal > rowwise | ( | ) | const [inline] |
This is defined in the Array module.
#include <Eigen/Array>
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;
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
The template parameter Size is the number of coefficients in the block
start | the index of the first element of the sub-vector |
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;
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] |
start | the first coefficient in the segment | |
size | the number of coefficients in the segment |
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;
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.
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;
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;
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;
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;
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
) * 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);
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
See MatrixBase:solveTriangular() for the details.
NumTraits< typename ei_traits< Derived >::Scalar >::Real squaredNorm | ( | ) | const [inline] |
const BlockReturnType< Derived, Size >::SubVectorType start | ( | void | ) | [inline] |
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;
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
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] |
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;
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, Flagged, Matrix, MapBase, Map, Transpose, Part, Matrix< NumTraits< Scalar >::Real, MatrixType::ColsAtCompileTime, 1 >, Matrix< int, 1, MatrixType::ColsAtCompileTime >, Matrix< int, MatrixType::RowsAtCompileTime, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime >, Matrix< _Scalar, AmbientDimAtCompileTime, 1 >, Matrix< _Scalar, HDim, HDim >, Matrix< _Scalar, 4, 1 >, Matrix< MatrixType::Scalar, MatrixType::ColsAtCompileTime, 1 >, Matrix< _Scalar, AmbientDimAtCompileTime==Dynamic?Dynamic:AmbientDimAtCompileTime+1, 1 >, Matrix< MatrixType::Scalar, MinSize, 1 >, Matrix< _Scalar, Dim, 1 >, Matrix< int, Dynamic, 1 >, Matrix< _Scalar, 3, 1 >, Matrix< MatrixType::Scalar, SizeMinusOne, 1 >, Matrix< MatrixType::Scalar, MatrixType::RowsAtCompileTime, MinSize >, Matrix< std::complex< RealScalar >, MatrixType::ColsAtCompileTime, 1 >, MapBase< Eigen::Eigen::Block< MatrixType, BlockRows, BlockCols, PacketAccess, HasDirectAccess > >, and MapBase< Eigen::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.
Reimplemented in Part.
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().
Transpose< Derived > transpose | ( | ) | [inline] |
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;
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
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] |
#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; }
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 variant is for fixed-size vector only.
const MatrixBase< Derived >::BasisReturnType Unit | ( | int | size, | |
int | i | |||
) | [inline, static] |
MatrixBase< Derived >::PlainMatrixType unitOrthogonal | ( | void | ) | const [inline] |
*this
*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] |
const MatrixBase< Derived >::BasisReturnType UnitX | ( | ) | [inline, static] |
const MatrixBase< Derived >::BasisReturnType UnitY | ( | ) | [inline, static] |
const MatrixBase< Derived >::BasisReturnType UnitZ | ( | ) | [inline, static] |
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] |
Example:
cout << Matrix2d::Zero() << endl; cout << RowVector4i::Zero() << endl;
0 0 0 0 0 0 0 0
const MatrixBase< Derived >::ConstantReturnType Zero | ( | int | size | ) | [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 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;
0 0 0 0 0 0
const MatrixBase< Derived >::ConstantReturnType Zero | ( | int | rows, | |
int | cols | |||
) | [inline, static] |
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;
0 0 0 0 0 0
std::ostream & operator<< | ( | std::ostream & | s, | |
const MatrixBase< Derived > & | m | |||
) | [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.