![]() |
Eigen
3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
|
#include <Eigen/src/SparseCore/SparseMatrixBase.h>
Base class of any sparse matrices or sparse expressions.
Derived | is the derived type, e.g. a sparse matrix type, or an expression, etc. |
This class can be extended with the help of the plugin mechanism described on the page Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_SPARSEMATRIXBASE_PLUGIN
.
Public Types | |
enum | { RowsAtCompileTime , ColsAtCompileTime , SizeAtCompileTime , MaxRowsAtCompileTime , MaxColsAtCompileTime , MaxSizeAtCompileTime , IsVectorAtCompileTime , NumDimensions , Flags , IsRowMajor , InnerSizeAtCompileTime } |
typedef NumTraits< Scalar >::Real | RealScalar |
typedef internal::traits< Derived >::StorageIndex | StorageIndex |
typedef Scalar | value_type |
![]() | |
typedef Eigen::Index | Index |
The interface type of indices. | |
Public Member Functions | |
template<typename CustomBinaryOp, typename OtherDerived> | |
const CwiseBinaryOp< CustomBinaryOp, const Derived, const OtherDerived > | binaryExpr (const Eigen::SparseMatrixBase< OtherDerived > &other, const CustomBinaryOp &func=CustomBinaryOp()) const |
template<int NRows, int NCols> | |
FixedBlockXpr< NRows, NCols >::Type | block (Index startRow, Index startCol) |
template<int NRows, int NCols> | |
const ConstFixedBlockXpr< NRows, NCols >::Type | block (Index startRow, Index startCol) const |
This is the const version of block<>(Index, Index). */. | |
template<int NRows, int NCols> | |
FixedBlockXpr< NRows, NCols >::Type | block (Index startRow, Index startCol, Index blockRows, Index blockCols) |
template<int NRows, int NCols> | |
const ConstFixedBlockXpr< NRows, NCols >::Type | block (Index startRow, Index startCol, Index blockRows, Index blockCols) const |
This is the const version of block<>(Index, Index, Index, Index). | |
template<typename NRowsType, typename NColsType> | |
FixedBlockXpr<...,... >::Type | block (Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) |
template<typename NRowsType, typename NColsType> | |
const ConstFixedBlockXpr<...,... >::Type | block (Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) const |
This is the const version of block(Index,Index,NRowsType,NColsType) | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | bottomLeftCorner () |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | bottomLeftCorner () const |
This is the const version of bottomLeftCorner<int, int>(). | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | bottomLeftCorner (Index cRows, Index cCols) |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | bottomLeftCorner (Index cRows, Index cCols) const |
This is the const version of bottomLeftCorner<int, int>(Index, Index). | |
template<typename NRowsType, typename NColsType> | |
FixedBlockXpr<...,... >::Type | bottomLeftCorner (NRowsType cRows, NColsType cCols) |
template<typename NRowsType, typename NColsType> | |
ConstFixedBlockXpr<...,... >::Type | bottomLeftCorner (NRowsType cRows, NColsType cCols) const |
This is the const version of bottomLeftCorner(NRowsType, NColsType). | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | bottomRightCorner () |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | bottomRightCorner () const |
This is the const version of bottomRightCorner<int, int>(). | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | bottomRightCorner (Index cRows, Index cCols) |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | bottomRightCorner (Index cRows, Index cCols) const |
This is the const version of bottomRightCorner<int, int>(Index, Index). | |
template<typename NRowsType, typename NColsType> | |
FixedBlockXpr<...,... >::Type | bottomRightCorner (NRowsType cRows, NColsType cCols) |
template<typename NRowsType, typename NColsType> | |
const ConstFixedBlockXpr<...,... >::Type | bottomRightCorner (NRowsType cRows, NColsType cCols) const |
This is the const version of bottomRightCorner(NRowsType, NColsType). | |
template<int N> | |
NRowsBlockXpr< N >::Type | bottomRows (Index n=N) |
template<int N> | |
ConstNRowsBlockXpr< N >::Type | bottomRows (Index n=N) const |
This is the const version of bottomRows<int>(). | |
template<typename NRowsType> | |
NRowsBlockXpr<... >::Type | bottomRows (NRowsType n) |
template<typename NRowsType> | |
const ConstNRowsBlockXpr<... >::Type | bottomRows (NRowsType n) const |
This is the const version of bottomRows(NRowsType). | |
template<typename NewType> | |
CastXpr< NewType >::Type | cast () const |
ColXpr | col (Index i) |
ConstColXpr | col (Index i) const |
This is the const version of col(). | |
Index | cols () const |
ConjugateReturnType | conjugate () const |
template<bool Cond> | |
std::conditional_t< Cond, ConjugateReturnType, const Derived & > | conjugateIf () const |
const CwiseAbsReturnType | cwiseAbs () const |
const CwiseAbs2ReturnType | cwiseAbs2 () const |
const CwiseArgReturnType | cwiseArg () const |
const CwiseCbrtReturnType | cwiseCbrt () const |
template<typename OtherDerived> | |
const CwiseBinaryEqualReturnType< OtherDerived > | cwiseEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const CwiseScalarEqualReturnType | cwiseEqual (const Scalar &s) const |
template<typename OtherDerived> | |
const CwiseBinaryGreaterReturnType< OtherDerived > | cwiseGreater (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const CwiseScalarGreaterReturnType | cwiseGreater (const Scalar &s) const |
template<typename OtherDerived> | |
const CwiseBinaryGreaterOrEqualReturnType< OtherDerived > | cwiseGreaterOrEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const CwiseScalarGreaterOrEqualReturnType | cwiseGreaterOrEqual (const Scalar &s) const |
const CwiseInverseReturnType | cwiseInverse () const |
template<typename OtherDerived> | |
const CwiseBinaryLessReturnType< OtherDerived > | cwiseLess (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const CwiseScalarLessReturnType | cwiseLess (const Scalar &s) const |
template<typename OtherDerived> | |
const CwiseBinaryLessOrEqualReturnType< OtherDerived > | cwiseLessOrEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const CwiseScalarLessOrEqualReturnType | cwiseLessOrEqual (const Scalar &s) const |
template<int NaNPropagation = PropagateFast, typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_max_op< Scalar, Scalar, NaNPropagation >, const Derived, const OtherDerived > | cwiseMax (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<int NaNPropagation = PropagateFast> | |
const CwiseBinaryOp< internal::scalar_max_op< Scalar, Scalar, NaNPropagation >, const Derived, const ConstantReturnType > | cwiseMax (const Scalar &other) const |
template<int NaNPropagation = PropagateFast, typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_min_op< Scalar, Scalar, NaNPropagation >, const Derived, const OtherDerived > | cwiseMin (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<int NaNPropagation = PropagateFast> | |
const CwiseBinaryOp< internal::scalar_min_op< Scalar, Scalar, NaNPropagation >, const Derived, const ConstantReturnType > | cwiseMin (const Scalar &other) const |
template<typename OtherDerived> | |
const CwiseBinaryNotEqualReturnType< OtherDerived > | cwiseNotEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const CwiseScalarNotEqualReturnType | cwiseNotEqual (const Scalar &s) const |
template<typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_product_op< Derived ::Scalar, OtherDerived ::Scalar >, const Derived, const OtherDerived > | cwiseProduct (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const Derived, const OtherDerived > | cwiseQuotient (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const CwiseSignReturnType | cwiseSign () const |
const CwiseSqrtReturnType | cwiseSqrt () const |
const CwiseSquareReturnType | cwiseSquare () const |
const internal::eval< Derived >::type | eval () const |
template<int N> | |
FixedSegmentReturnType< N >::Type | head (Index n=N) |
template<int N> | |
ConstFixedSegmentReturnType< N >::Type | head (Index n=N) const |
This is the const version of head<int>(). | |
template<typename NType> | |
FixedSegmentReturnType<... >::Type | head (NType n) |
template<typename NType> | |
const ConstFixedSegmentReturnType<... >::Type | head (NType n) const |
This is the const version of head(NType). | |
NonConstImagReturnType | imag () |
const ImagReturnType | imag () const |
Index | innerSize () const |
InnerVectorReturnType | innerVector (Index outer) |
const ConstInnerVectorReturnType | innerVector (Index outer) const |
InnerVectorsReturnType | innerVectors (Index outerStart, Index outerSize) |
const ConstInnerVectorsReturnType | innerVectors (Index outerStart, Index outerSize) const |
bool | isVector () const |
template<int N> | |
NColsBlockXpr< N >::Type | leftCols (Index n=N) |
template<int N> | |
ConstNColsBlockXpr< N >::Type | leftCols (Index n=N) const |
This is the const version of leftCols<int>(). | |
template<typename NColsType> | |
NColsBlockXpr<... >::Type | leftCols (NColsType n) |
template<typename NColsType> | |
const ConstNColsBlockXpr<... >::Type | leftCols (NColsType n) const |
This is the const version of leftCols(NColsType). | |
template<int N> | |
NColsBlockXpr< N >::Type | middleCols (Index startCol, Index n=N) |
template<int N> | |
ConstNColsBlockXpr< N >::Type | middleCols (Index startCol, Index n=N) const |
This is the const version of middleCols<int>(). | |
template<typename NColsType> | |
NColsBlockXpr<... >::Type | middleCols (Index startCol, NColsType numCols) |
template<typename NColsType> | |
const ConstNColsBlockXpr<... >::Type | middleCols (Index startCol, NColsType numCols) const |
This is the const version of middleCols(Index,NColsType). | |
template<int N> | |
NRowsBlockXpr< N >::Type | middleRows (Index startRow, Index n=N) |
template<int N> | |
ConstNRowsBlockXpr< N >::Type | middleRows (Index startRow, Index n=N) const |
This is the const version of middleRows<int>(). | |
template<typename NRowsType> | |
NRowsBlockXpr<... >::Type | middleRows (Index startRow, NRowsType n) |
template<typename NRowsType> | |
const ConstNRowsBlockXpr<... >::Type | middleRows (Index startRow, NRowsType n) const |
This is the const version of middleRows(Index,NRowsType). | |
template<typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_bitwise_and_op< Scalar >, const Derived, const OtherDerived > | operator& (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_boolean_and_op< Scalar >, const Derived, const OtherDerived > | operator&& (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<typename OtherDerived> | |
const Product< Derived, OtherDerived, AliasFreeProduct > | operator* (const SparseMatrixBase< OtherDerived > &other) const |
template<typename OtherDerived> | |
const CwiseBinaryOp< sum< Scalar >, const Derived, const OtherDerived > | operator+ (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
const NegativeReturnType | operator- () const |
template<typename OtherDerived> | |
const CwiseBinaryOp< difference< Scalar >, const Derived, const OtherDerived > | operator- (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_bitwise_xor_op< Scalar >, const Derived, const OtherDerived > | operator^ (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_bitwise_or_op< Scalar >, const Derived, const OtherDerived > | operator| (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
template<typename OtherDerived> | |
const CwiseBinaryOp< internal::scalar_boolean_or_op< Scalar >, const Derived, const OtherDerived > | operator|| (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
Index | outerSize () const |
const SparseView< Derived > | pruned (const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const |
NonConstRealReturnType | real () |
RealReturnType | real () const |
template<int N> | |
NColsBlockXpr< N >::Type | rightCols (Index n=N) |
template<int N> | |
ConstNColsBlockXpr< N >::Type | rightCols (Index n=N) const |
This is the const version of rightCols<int>(). | |
template<typename NColsType> | |
NColsBlockXpr<... >::Type | rightCols (NColsType n) |
template<typename NColsType> | |
const ConstNColsBlockXpr<... >::Type | rightCols (NColsType n) const |
This is the const version of rightCols(NColsType). | |
RowXpr | row (Index i) |
ConstRowXpr | row (Index i) const |
This is the const version of row(). */. | |
Index | rows () const |
template<int N> | |
FixedSegmentReturnType< N >::Type | segment (Index start, Index n=N) |
template<int N> | |
ConstFixedSegmentReturnType< N >::Type | segment (Index start, Index n=N) const |
This is the const version of segment<int>(Index). | |
template<typename NType> | |
FixedSegmentReturnType<... >::Type | segment (Index start, NType n) |
template<typename NType> | |
const ConstFixedSegmentReturnType<... >::Type | segment (Index start, NType n) const |
This is the const version of segment(Index,NType). | |
Index | size () const |
template<DirectionType Direction> | |
std::conditional_t< Direction==Vertical, ColXpr, RowXpr > | subVector (Index i) |
template<DirectionType Direction> | |
std::conditional_t< Direction==Vertical, ConstColXpr, ConstRowXpr > | subVector (Index i) const |
template<DirectionType Direction> | |
EIGEN_CONSTEXPR Index | subVectors () const |
template<int N> | |
FixedSegmentReturnType< N >::Type | tail (Index n=N) |
template<int N> | |
ConstFixedSegmentReturnType< N >::Type | tail (Index n=N) const |
This is the const version of tail<int>. | |
template<typename NType> | |
FixedSegmentReturnType<... >::Type | tail (NType n) |
template<typename NType> | |
const ConstFixedSegmentReturnType<... >::Type | tail (NType n) const |
This is the const version of tail(Index). | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | topLeftCorner () |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | topLeftCorner () const |
This is the const version of topLeftCorner<int, int>(). | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | topLeftCorner (Index cRows, Index cCols) |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | topLeftCorner (Index cRows, Index cCols) const |
This is the const version of topLeftCorner<int, int>(Index, Index). | |
template<typename NRowsType, typename NColsType> | |
FixedBlockXpr<...,... >::Type | topLeftCorner (NRowsType cRows, NColsType cCols) |
template<typename NRowsType, typename NColsType> | |
const ConstFixedBlockXpr<...,... >::Type | topLeftCorner (NRowsType cRows, NColsType cCols) const |
This is the const version of topLeftCorner(Index, Index). | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | topRightCorner () |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | topRightCorner () const |
This is the const version of topRightCorner<int, int>(). | |
template<int CRows, int CCols> | |
FixedBlockXpr< CRows, CCols >::Type | topRightCorner (Index cRows, Index cCols) |
template<int CRows, int CCols> | |
const ConstFixedBlockXpr< CRows, CCols >::Type | topRightCorner (Index cRows, Index cCols) const |
This is the const version of topRightCorner<int, int>(Index, Index). | |
template<typename NRowsType, typename NColsType> | |
FixedBlockXpr<...,... >::Type | topRightCorner (NRowsType cRows, NColsType cCols) |
template<typename NRowsType, typename NColsType> | |
const ConstFixedBlockXpr<...,... >::Type | topRightCorner (NRowsType cRows, NColsType cCols) const |
This is the const version of topRightCorner(NRowsType, NColsType). | |
template<int N> | |
NRowsBlockXpr< N >::Type | topRows (Index n=N) |
template<int N> | |
ConstNRowsBlockXpr< N >::Type | topRows (Index n=N) const |
This is the const version of topRows<int>(). | |
template<typename NRowsType> | |
NRowsBlockXpr<... >::Type | topRows (NRowsType n) |
template<typename NRowsType> | |
const ConstNRowsBlockXpr<... >::Type | topRows (NRowsType n) const |
This is the const version of topRows(NRowsType). | |
SparseSymmetricPermutationProduct< Derived, Upper|Lower > | twistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const |
template<typename CustomUnaryOp> | |
const CwiseUnaryOp< CustomUnaryOp, const Derived > | unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const |
Apply a unary operator coefficient-wise. | |
template<typename CustomViewOp> | |
CwiseUnaryView< CustomViewOp, Derived > | unaryViewExpr (const CustomViewOp &func=CustomViewOp()) |
template<typename CustomViewOp> | |
const CwiseUnaryView< CustomViewOp, const Derived > | unaryViewExpr (const CustomViewOp &func=CustomViewOp()) const |
![]() | |
EIGEN_CONSTEXPR Index | cols () const EIGEN_NOEXCEPT |
constexpr Derived & | derived () |
constexpr const Derived & | derived () const |
EIGEN_CONSTEXPR Index | rows () const EIGEN_NOEXCEPT |
EIGEN_CONSTEXPR Index | size () const EIGEN_NOEXCEPT |
typedef NumTraits<Scalar>::Real Eigen::SparseMatrixBase< Derived >::RealScalar |
This is the "real scalar" type; if the Scalar type is already real numbers (e.g. int, float or double) then RealScalar is just the same as Scalar. If Scalar is std::complex<T> then RealScalar is T.
typedef internal::traits<Derived>::StorageIndex Eigen::SparseMatrixBase< Derived >::StorageIndex |
The integer type used to store indices within a SparseMatrix. For a SparseMatrix<Scalar,Options,IndexType>
it an alias of the third template parameter IndexType
.
typedef Scalar Eigen::SparseMatrixBase< Derived >::value_type |
The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.
It is an alias for the Scalar type
anonymous enum |
Enumerator | |
---|---|
RowsAtCompileTime | The number of rows at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant.
|
ColsAtCompileTime | The number of columns at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant.
|
SizeAtCompileTime | This is equal to the number of coefficients, i.e. the number of rows times the number of columns, or to Dynamic if this is not known at compile-time.
|
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). |
NumDimensions | This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors, and 2 for matrices. |
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. |
|
inline |
The template parameter CustomBinaryOp is the type of the functor of the custom operator (see class CwiseBinaryOp for an example)
Here is an example illustrating the use of custom functors:
Output:
(0.696,-0.727) (-0.47,-0.216) (0.0241,-0.778) (0.134,0.0072) (0.205,0.74) (0.928,0.852) (0.0723,-0.758) (-0.16,0.22) (-0.415,-0.757) (0.445,0.835) (0.432,-0.711) (-0.00986,0.859) (0.334,0.741) (-0.633,-0.834) (-0.046,-0.467) (-0.498,-0.316)
|
inline |
*this
.The template parameters NRows and NCols are the number of rows and columns in the block.
startRow | the first row in the block |
startCol | the first column in the block |
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.block<2,2>(1,1): -1122281286 304089172 -1364114958 35005211 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 0 0 -1868760786 -189735855 0 0 -2309581 719885386 2044897763 -1852781081 1101513929
|
inline |
*this
.NRows | number of rows in block as specified at compile-time |
NCols | number of columns in block as specified at compile-time |
startRow | the first row in the block |
startCol | the first column in the block |
blockRows | number of rows in block as specified at run-time |
blockCols | number of columns in block as specified at run-time |
This function is mainly useful for blocks where the number of rows is specified at compile-time and the number of columns is specified at run-time, or vice versa. The compile-time and run-time information should not contradict. In other words, blockRows should equal NRows unless NRows is Dynamic, and the same for the number of columns.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is the block: -1122281286 304089172 -1868760786 -1364114958 35005211 -2309581 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 0 0 0 -189735855 0 0 0 719885386 2044897763 -1852781081 1101513929
|
inline |
*this
with either dynamic or fixed sizes.startRow | the first row in the block |
startCol | the first column in the block |
blockRows | number of rows in the block, specified at either run-time or compile-time |
blockCols | number of columns in the block, specified at either run-time or compile-time |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example using runtime (aka dynamic) sizes:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.block(1, 1, 2, 2): -1122281286 304089172 -1364114958 35005211 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 0 0 -1868760786 -189735855 0 0 -2309581 719885386 2044897763 -1852781081 1101513929
New in Eigen 3.4.:
The number of rows blockRows and columns blockCols can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. In the later case, n
plays the role of a runtime fallback value in case N
equals Eigen\Dynamic. Here is an example with a fixed number of rows NRows
and dynamic number of columns cols:
This function thus fully covers the features offered by the following overloads block<NRows,NCols>(Index, Index), and block<NRows,NCols>(Index, Index, Index, Index) that are thus obsolete. Indeed, this generic version avoids redundancy, it preserves the argument order, and prevents the need to rely on the template keyword in templated code.
but with less redundancy and more consistency as it does not modify the argument order and seamlessly enable hybrid fixed/dynamic sizes.
|
inline |
*this
.The template parameters CRows and CCols are the number of rows and columns in the corner.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.bottomLeftCorner<2,2>(): -189735855 -1364114958 719885386 2044897763 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 0 0 35005211 -2309581 0 0 -1852781081 1101513929
|
inline |
*this
.CRows | number of rows in corner as specified at compile-time |
CCols | number of columns in corner as specified at compile-time |
cRows | number of rows in corner as specified at run-time |
cCols | number of columns in corner as specified at run-time |
This function is mainly useful for corners where the number of rows is specified at compile-time and the number of columns is specified at run-time, or vice versa. The compile-time and run-time information should not contradict. In other words, cRows should equal CRows unless CRows is Dynamic, and the same for the number of columns.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.bottomLeftCorner<2,Dynamic>(2,2): -189735855 -1364114958 719885386 2044897763 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 0 0 35005211 -2309581 0 0 -1852781081 1101513929
|
inline |
*this
with either dynamic or fixed sizes.cRows | the number of rows in the corner |
cCols | the number of columns in the corner |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.bottomLeftCorner(2, 2): -189735855 -1364114958 719885386 2044897763 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 0 0 35005211 -2309581 0 0 -1852781081 1101513929
The number of rows blockRows and columns blockCols can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
.The template parameters CRows and CCols are the number of rows and columns in the corner.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.bottomRightCorner<2,2>(): 35005211 -2309581 -1852781081 1101513929 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 0 0 719885386 2044897763 0 0
|
inline |
*this
.CRows | number of rows in corner as specified at compile-time |
CCols | number of columns in corner as specified at compile-time |
cRows | number of rows in corner as specified at run-time |
cCols | number of columns in corner as specified at run-time |
This function is mainly useful for corners where the number of rows is specified at compile-time and the number of columns is specified at run-time, or vice versa. The compile-time and run-time information should not contradict. In other words, cRows should equal CRows unless CRows is Dynamic, and the same for the number of columns.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.bottomRightCorner<2,Dynamic>(2,2): 35005211 -2309581 -1852781081 1101513929 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 0 0 719885386 2044897763 0 0
|
inline |
*this
with either dynamic or fixed sizes.cRows | the number of rows in the corner |
cCols | the number of columns in the corner |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.bottomRightCorner(2, 2): 35005211 -2309581 -1852781081 1101513929 Now the matrix m is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 0 0 719885386 2044897763 0 0
The number of rows blockRows and columns blockCols can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
.N | the number of rows in the block as specified at compile-time |
n | the number of rows in the block as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.bottomRows<2>(): -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Now the array a is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 0 0 0 0 0 0 0 0
|
inline |
*this
.n | the number of rows in the block |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.bottomRows(2): -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Now the array a is: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 0 0 0 0 0 0 0 0
The number of rows n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
with the Scalar type casted to NewScalar.The template parameter NewScalar is the type we are casting the scalars to.
This method does not change the sparsity of *this
: the conversion function is applied to explicitly stored coefficients only.
|
inline |
*this
. Note that the numbering starts at 0.Example:
Output:
1 4 0 0 5 0 0 6 1
|
inline |
|
inline |
*this
. This method does not change the sparsity of *this
: the complex conjugate is applied to explicitly stored coefficients only.
|
inline |
*this
if Cond==true, returns derived() otherwise. This method does not change the sparsity of *this
: the complex conjugate is applied to explicitly stored coefficients only.
|
inline |
*this
Example:
Output:
2 4 6 5 1 0
This method does not change the sparsity of *this
: the absolute value is applied to explicitly stored coefficients only.
|
inline |
*this
Example:
Output:
4 16 36 25 1 0
This method does not change the sparsity of *this
: the squared absolute value is applied to explicitly stored coefficients only.
|
inline |
*this
Example:
Output:
(0.924,-0.824) (0.146,-0.237) (0.633,-0.779) (-0.199,-0.0532) (0.334,0.634) (0.982,-0.573) -0.728 -1.02 -0.889 -2.88 1.09 -0.528
This method does not change the sparsity of *this
: the arg is applied to explicitly stored coefficients only.
|
inline |
This method does not change the sparsity of *this
: the cube - root is applied to explicitly stored coefficients only.
|
inline |
Example:
Output:
Comparing m with identity matrix: 1 1 0 1 Number of coefficients that are equal: 3
|
inline |
*this
and a scalar s
|
inline |
|
inline |
*this
and a scalar s
|
inline |
|
inline |
*this
and a scalar s
|
inline |
Example:
Output:
0.5 2 1 0.333 4 1
This method does not change the sparsity of *this
: the inverse is applied to explicitly stored coefficients only.
|
inline |
|
inline |
*this
and a scalar s
|
inline |
|
inline |
*this
and a scalar s
|
inline |
Example:
Output:
4 3 4
|
inline |
|
inline |
Example:
Output:
2 2 3
|
inline |
|
inline |
Example:
Output:
Comparing m with identity matrix: 0 0 1 0 Number of coefficients that are not equal: 1
|
inline |
*this
and a scalar s
|
inline |
Example:
Output:
a: 1804289383 719885386 -1364114958 -465790871 -1550966999 2044897763 -189735855 -1122281286 1365180540 b: 304089172 336465782 1101513929 35005211 -1868760786 1315634022 -1852781081 -2309581 -778350579 c: -1900151348 1274064924 1451757314 1178627603 -1395361186 1323254130 982755863 -343432946 1494074956
|
inline |
Example:
Output:
0.5 1.5 1.33
|
inline |
Example:
Output:
1 -1 1 -1 1 0
This method does not change the sparsity of *this
: the sign function is applied to explicitly stored coefficients only.
|
inline |
Example:
Output:
1 1.41 2
This method does not change the sparsity of *this
: the square - root is applied to explicitly stored coefficients only.
|
inline |
This method does not change the sparsity of *this
: the square is applied to explicitly stored coefficients only.
|
inline |
Notice that in the case of a plain matrix or vector (not an expression) this function just returns a const reference, in order to avoid a useless copy.
|
inline |
*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.
N | the number of coefficients in the segment as specified at compile-time |
n | the number of coefficients in the segment as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
Here is the vector v: 1804289383 -465790871 -189735855 719885386 Here is v.head(2): 1804289383 -465790871 Now the vector v is: 0 0 -189735855 719885386
|
inline |
*this
with either dynamic or fixed sizes.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.
n | the number of coefficients in the segment |
NType | the type of the value handling the number of coefficients in the segment, typically Index. |
Example:
Output:
Here is the vector v: 1804289383 -465790871 -189735855 719885386 Here is v.head(2): 1804289383 -465790871 Now the vector v is: 0 0 -189735855 719885386
The number of coefficients n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
. This method does not change the sparsity of *this
: the imaginary part function is applied to explicitly stored coefficients only.
|
inline |
*this
. This method does not change the sparsity of *this
: the imaginary part function is applied to explicitly stored coefficients only.
|
inline |
|
inline |
*this
if *this
is col-major (resp. row-major).
|
inline |
*this
if *this
is col-major (resp. row-major). Read-only.
|
inline |
*this
if *this
is col-major (resp. row-major).
|
inline |
*this
if *this
is col-major (resp. row-major). Read-only.
|
inline |
|
inline |
*this
.N | the number of columns in the block as specified at compile-time |
n | the number of columns in the block as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.leftCols<2>(): 1804289383 -1550966999 -465790871 -1122281286 -189735855 -1364114958 719885386 2044897763 Now the array a is: 0 0 1365180540 336465782 0 0 304089172 -1868760786 0 0 35005211 -2309581 0 0 -1852781081 1101513929
|
inline |
*this
.n | the number of columns in the block |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.leftCols(2): 1804289383 -1550966999 -465790871 -1122281286 -189735855 -1364114958 719885386 2044897763 Now the array a is: 0 0 1365180540 336465782 0 0 304089172 -1868760786 0 0 35005211 -2309581 0 0 -1852781081 1101513929
The number of columns n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
.N | the number of columns in the block as specified at compile-time |
startCol | the index of the first column in the block |
n | the number of columns in the block as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
A = 1804289383 -1122281286 35005211 1101513929 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 -189735855 2044897763 336465782 -778350579 -1539069864 719885386 1365180540 -1868760786 1059961393 1734575198 -1550966999 304089172 -2309581 628175011 149798315 A(:,1..3) = -1122281286 35005211 1101513929 -1364114958 -1852781081 1315634022 2044897763 336465782 -778350579 1365180540 -1868760786 1059961393 304089172 -2309581 628175011
|
inline |
*this
.startCol | the index of the first column in the block |
numCols | the number of columns in the block |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example:
Output:
A = 1804289383 -1122281286 35005211 1101513929 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 -189735855 2044897763 336465782 -778350579 -1539069864 719885386 1365180540 -1868760786 1059961393 1734575198 -1550966999 304089172 -2309581 628175011 149798315 A(1..3,:) = -1122281286 35005211 1101513929 -1364114958 -1852781081 1315634022 2044897763 336465782 -778350579 1365180540 -1868760786 1059961393 304089172 -2309581 628175011
The number of columns n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
.N | the number of rows in the block as specified at compile-time |
startRow | the index of the first row in the block |
n | the number of rows in the block as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
A = 1804289383 -1122281286 35005211 1101513929 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 -189735855 2044897763 336465782 -778350579 -1539069864 719885386 1365180540 -1868760786 1059961393 1734575198 -1550966999 304089172 -2309581 628175011 149798315 A(1..3,:) = -465790871 -1364114958 -1852781081 1315634022 -1287999227 -189735855 2044897763 336465782 -778350579 -1539069864 719885386 1365180540 -1868760786 1059961393 1734575198
|
inline |
*this
.startRow | the index of the first row in the block |
n | the number of rows in the block |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
Example:
Output:
A = 1804289383 -1122281286 35005211 1101513929 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 -189735855 2044897763 336465782 -778350579 -1539069864 719885386 1365180540 -1868760786 1059961393 1734575198 -1550966999 304089172 -2309581 628175011 149798315 A(2..3,:) = -189735855 2044897763 336465782 -778350579 -1539069864 719885386 1365180540 -1868760786 1059961393 1734575198
The number of rows n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
and other
|
inline |
*this
scaled by the scalar factor scalar T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
*this
divided by the scalar value scalar T | is the scalar type of scalar. It must be compatible with the scalar type of the given expression. |
*this
and other Example:
Output:
0 0 0
|
inline |
ref
is a meaningful non zero reference value. const CwiseBinaryOp< sum< Scalar >, const Derived, const OtherDerived > Eigen::SparseMatrixBase< Derived >::operator+ | ( | const Eigen::SparseMatrixBase< OtherDerived > & | other | ) | const |
*this
and other
|
inline |
*this
This method does not change the sparsity of *this
: the opposite is applied to explicitly stored coefficients only.
const CwiseBinaryOp< difference< Scalar >, const Derived, const OtherDerived > Eigen::SparseMatrixBase< Derived >::operator- | ( | const Eigen::SparseMatrixBase< OtherDerived > & | other | ) | const |
*this
and other
|
inline |
|
inline |
*this
and other
|
inline |
*this
and other Example:
Output:
1 0 1
|
inline |
|
inline |
*this
with values smaller than reference * epsilon removed.This method is typically used in conjunction with the product of two sparse matrices to automatically prune the smallest values as follows:
where ref
is a meaningful non zero reference value.
|
inline |
*this
. This method does not change the sparsity of *this
: the real part function is applied to explicitly stored coefficients only.
|
inline |
*this
. This method does not change the sparsity of *this
: the real part function is applied to explicitly stored coefficients only.
|
inline |
*this
.N | the number of columns in the block as specified at compile-time |
n | the number of columns in the block as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.rightCols<2>(): 1365180540 336465782 304089172 -1868760786 35005211 -2309581 -1852781081 1101513929 Now the array a is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 -189735855 -1364114958 0 0 719885386 2044897763 0 0
|
inline |
*this
.n | the number of columns in the block |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.rightCols(2): 1365180540 336465782 304089172 -1868760786 35005211 -2309581 -1852781081 1101513929 Now the array a is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 -189735855 -1364114958 0 0 719885386 2044897763 0 0
The number of columns n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
. Note that the numbering starts at 0.Example:
Output:
1 0 0 4 5 6 0 0 1
|
inline |
|
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.
N | the number of coefficients in the segment as specified at compile-time |
start | the index of the first element in the segment |
n | the number of coefficients in the segment as specified at compile-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
Here is the vector v: 1804289383 -465790871 -189735855 719885386 Here is v.segment<2>(1): -465790871 -189735855 Now the vector v is: 1804289383 -465790871 0 0
|
inline |
*this
with either dynamic or fixed sizes.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 |
n | the number of coefficients in the segment |
NType | the type of the value handling the number of coefficients in the segment, typically Index. |
Example:
Output:
Here is the vector v: 1804289383 -465790871 -189735855 719885386 Here is v.segment(1, 2): -465790871 -189735855 Now the vector v is: 1804289383 0 0 719885386
The number of coefficients n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
|
inline |
Direction
|
inline |
This is the const version of subVector(Index)
|
inline |
Direction
|
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.
N | the number of coefficients in the segment as specified at compile-time |
n | the number of coefficients in the segment as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
Here is the vector v: 1804289383 -465790871 -189735855 719885386 Here is v.tail(2): -189735855 719885386 Now the vector v is: 1804289383 -465790871 0 0
|
inline |
*this
with either dynamic or fixed sizes.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.
n | the number of coefficients in the segment |
NType | the type of the value handling the number of coefficients in the segment, typically Index. |
Example:
Output:
Here is the vector v: 1804289383 -465790871 -189735855 719885386 Here is v.tail(2): -189735855 719885386 Now the vector v is: 1804289383 -465790871 0 0
The number of coefficients n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
.The template parameters CRows and CCols are the number of rows and columns in the corner.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.topLeftCorner<2,2>(): 1804289383 -1550966999 -465790871 -1122281286 Now the matrix m is: 0 0 1365180540 336465782 0 0 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
|
inline |
*this
.CRows | number of rows in corner as specified at compile-time |
CCols | number of columns in corner as specified at compile-time |
cRows | number of rows in corner as specified at run-time |
cCols | number of columns in corner as specified at run-time |
This function is mainly useful for corners where the number of rows is specified at compile-time and the number of columns is specified at run-time, or vice versa. The compile-time and run-time information should not contradict. In other words, cRows should equal CRows unless CRows is Dynamic, and the same for the number of columns.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.topLeftCorner<2,Dynamic>(2,2): 1804289383 -1550966999 -465790871 -1122281286 Now the matrix m is: 0 0 1365180540 336465782 0 0 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
|
inline |
*this
with either dynamic or fixed sizes.cRows | the number of rows in the corner |
cCols | the number of columns in the corner |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.topLeftCorner(2, 2): 1804289383 -1550966999 -465790871 -1122281286 Now the matrix m is: 0 0 1365180540 336465782 0 0 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
The number of rows blockRows and columns blockCols can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
.CRows | the number of rows in the corner |
CCols | the number of columns in the corner |
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.topRightCorner<2,2>(): 1365180540 336465782 304089172 -1868760786 Now the matrix m is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
|
inline |
*this
.CRows | number of rows in corner as specified at compile-time |
CCols | number of columns in corner as specified at compile-time |
cRows | number of rows in corner as specified at run-time |
cCols | number of columns in corner as specified at run-time |
This function is mainly useful for corners where the number of rows is specified at compile-time and the number of columns is specified at run-time, or vice versa. The compile-time and run-time information should not contradict. In other words, cRows should equal CRows unless CRows is Dynamic, and the same for the number of columns.
Example:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.topRightCorner<2,Dynamic>(2,2): 1365180540 336465782 304089172 -1868760786 Now the matrix m is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
|
inline |
*this
with either dynamic or fixed sizes.cRows | the number of rows in the corner |
cCols | the number of columns in the corner |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
NColsType | the type of the value handling the number of columns in the block, typically Index. |
Example with dynamic sizes:
Output:
Here is the matrix m: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is m.topRightCorner(2, 2): 1365180540 336465782 304089172 -1868760786 Now the matrix m is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
The number of rows blockRows and columns blockCols can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
.N | the number of rows in the block as specified at compile-time |
n | the number of rows in the block as specified at run-time |
The compile-time and run-time information should not contradict. In other words, n should equal N unless N is Dynamic.
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.topRows<2>(): 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 Now the array a is: 0 0 0 0 0 0 0 0 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
|
inline |
*this
.n | the number of rows in the block |
NRowsType | the type of the value handling the number of rows in the block, typically Index. |
Example:
Output:
Here is the array a: 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929 Here is a.topRows(2): 1804289383 -1550966999 1365180540 336465782 -465790871 -1122281286 304089172 -1868760786 Now the array a is: 0 0 0 0 0 0 0 0 -189735855 -1364114958 35005211 -2309581 719885386 2044897763 -1852781081 1101513929
The number of rows n can also be specified at compile-time by passing Eigen\fix<N>, or Eigen::fix<N>(n) as arguments. See block() for the details.
|
inline |
*this
|
inline |
Apply a unary operator coefficient-wise.
[in] | func | Functor implementing the unary operator |
CustomUnaryOp | Type of func |
The function ptr_fun()
from the C++ standard library can be used to make functors out of normal functions.
Example:
Output:
0.696 -0.47 0.0241 0.134 0.205 0.928 0.0723 -0.16 -0.415 0.445 0.432 -0.00986 0.334 -0.633 -0.046 -0.498 becomes: 0.696 0 0.0241 0.134 0.205 0.928 0.0723 0 0 0.445 0.432 0 0.334 0 0 0
Genuine functors allow for more possibilities, for instance it may contain a state.
Example:
Output:
0.696 -0.47 0.0241 0.134 0.205 0.928 0.0723 -0.16 -0.415 0.445 0.432 -0.00986 0.334 -0.633 -0.046 -0.498 becomes: 0.5 -0.47 0.0241 0.134 0.205 0.5 0.0723 -0.16 -0.415 0.445 0.432 -0.00986 0.334 -0.5 -0.046 -0.498
This method does not change the sparsity of *this
: the unary function is applied to explicitly stored coefficients only.
|
inline |
The template parameter CustomUnaryOp is the type of the functor of the custom unary operator.
This method does not change the sparsity of *this
: the unary function is applied to explicitly stored coefficients only.
|
inline |
The template parameter CustomUnaryOp is the type of the functor of the custom unary operator.
Example:
Output:
0.696 -0.47 0.0241 0.134 0.205 0.928 0.0723 -0.16 -0.415 0.445 0.432 -0.00986 0.334 -0.633 -0.046 -0.498 becomes: 0.5 -0.47 0.0241 0.134 0.205 0.5 0.0723 -0.16 -0.415 0.445 0.432 -0.00986 0.334 -0.5 -0.046 -0.498
This method does not change the sparsity of *this
: the unary function is applied to explicitly stored coefficients only.