![]() |
Eigen
5.0.1
|
#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.
Inheritance diagram for Eigen::SparseMatrixBase< Derived >:Public Types | |
| enum | { RowsAtCompileTime , ColsAtCompileTime , SizeAtCompileTime , MaxRowsAtCompileTime , MaxColsAtCompileTime , MaxSizeAtCompileTime , IsVectorAtCompileTime , NumDimensions , Flags , IsRowMajor , InnerSizeAtCompileTime } |
| using | RealScalar |
| using | StorageIndex |
| using | value_type |
Public Types inherited from Eigen::EigenBase< Derived > | |
| using | Index |
| The interface type of indices. | |
Public Member Functions | |
| template<typename CustomBinaryOp, typename OtherDerived> | |
| constexpr const CwiseBinaryOp< CustomBinaryOp, const Derived, const OtherDerived > | binaryExpr (const Eigen::SparseMatrixBase< OtherDerived > &other, const CustomBinaryOp &func=CustomBinaryOp()) const |
| template<int NRows, int NCols> | |
| constexpr FixedBlockXpr< NRows, NCols >::Type | block (Index startRow, Index startCol) |
| template<int NRows, int NCols> | |
| constexpr 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> | |
| constexpr FixedBlockXpr< NRows, NCols >::Type | block (Index startRow, Index startCol, Index blockRows, Index blockCols) |
| template<int NRows, int NCols> | |
| constexpr 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> | |
| constexpr FixedBlockXpr<...,... >::Type | block (Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) |
| template<typename NRowsType, typename NColsType> | |
| constexpr 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> | |
| constexpr FixedBlockXpr< CRows, CCols >::Type | bottomLeftCorner () |
| template<int CRows, int CCols> | |
| constexpr 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> | |
| constexpr FixedBlockXpr<...,... >::Type | bottomLeftCorner (NRowsType cRows, NColsType cCols) |
| template<typename NRowsType, typename NColsType> | |
| constexpr ConstFixedBlockXpr<...,... >::Type | bottomLeftCorner (NRowsType cRows, NColsType cCols) const |
| This is the const version of bottomLeftCorner(NRowsType, NColsType). | |
| template<int CRows, int CCols> | |
| constexpr FixedBlockXpr< CRows, CCols >::Type | bottomRightCorner () |
| template<int CRows, int CCols> | |
| constexpr const ConstFixedBlockXpr< CRows, CCols >::Type | bottomRightCorner () const |
| This is the const version of bottomRightCorner<int, int>(). | |
| template<int CRows, int CCols> | |
| constexpr FixedBlockXpr< CRows, CCols >::Type | bottomRightCorner (Index cRows, Index cCols) |
| template<int CRows, int CCols> | |
| constexpr 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> | |
| constexpr FixedBlockXpr<...,... >::Type | bottomRightCorner (NRowsType cRows, NColsType cCols) |
| template<typename NRowsType, typename NColsType> | |
| constexpr const ConstFixedBlockXpr<...,... >::Type | bottomRightCorner (NRowsType cRows, NColsType cCols) const |
| This is the const version of bottomRightCorner(NRowsType, NColsType). | |
| template<int N> | |
| constexpr NRowsBlockXpr< N >::Type | bottomRows (Index n=N) |
| template<int N> | |
| constexpr ConstNRowsBlockXpr< N >::Type | bottomRows (Index n=N) const |
| This is the const version of bottomRows<int>(). | |
| template<typename NRowsType> | |
| constexpr NRowsBlockXpr<... >::Type | bottomRows (NRowsType n) |
| template<typename NRowsType> | |
| constexpr const ConstNRowsBlockXpr<... >::Type | bottomRows (NRowsType n) const |
| This is the const version of bottomRows(NRowsType). | |
| template<typename NewType> | |
| constexpr CastXpr< NewType >::Type | cast () const |
| constexpr ColXpr | col (Index i) |
| constexpr ConstColXpr | col (Index i) const |
| This is the const version of col(). | |
| Index | cols () const |
| constexpr ConjugateReturnType | conjugate () const |
| template<bool Cond> | |
| constexpr std::conditional_t< Cond, ConjugateReturnType, const Derived & > | conjugateIf () const |
| const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > | cwiseAbs () const |
| const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > | cwiseAbs2 () const |
| const CwiseUnaryOp< internal::scalar_arg_op< Scalar >, const Derived > | cwiseArg () const |
| const CwiseUnaryOp< internal::scalar_cbrt_op< Scalar >, const Derived > | cwiseCbrt () const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryEqualReturnType< OtherDerived > | cwiseEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| constexpr const CwiseScalarEqualReturnType | cwiseEqual (const Scalar &s) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryGreaterReturnType< OtherDerived > | cwiseGreater (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| constexpr const CwiseScalarGreaterReturnType | cwiseGreater (const Scalar &s) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryGreaterOrEqualReturnType< OtherDerived > | cwiseGreaterOrEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| constexpr const CwiseScalarGreaterOrEqualReturnType | cwiseGreaterOrEqual (const Scalar &s) const |
| const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > | cwiseInverse () const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryLessReturnType< OtherDerived > | cwiseLess (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| constexpr const CwiseScalarLessReturnType | cwiseLess (const Scalar &s) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryLessOrEqualReturnType< OtherDerived > | cwiseLessOrEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| constexpr const CwiseScalarLessOrEqualReturnType | cwiseLessOrEqual (const Scalar &s) const |
| template<int NaNPropagation = PropagateFast, typename OtherDerived> | |
| constexpr const CwiseBinaryOp< internal::scalar_max_op< Scalar, Scalar, NaNPropagation >, const Derived, const OtherDerived > | cwiseMax (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| template<int NaNPropagation = PropagateFast> | |
| constexpr const CwiseBinaryOp< internal::scalar_max_op< Scalar, Scalar, NaNPropagation >, const Derived, const ConstantReturnType > | cwiseMax (const Scalar &other) const |
| template<int NaNPropagation = PropagateFast, typename OtherDerived> | |
| constexpr const CwiseBinaryOp< internal::scalar_min_op< Scalar, Scalar, NaNPropagation >, const Derived, const OtherDerived > | cwiseMin (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| template<int NaNPropagation = PropagateFast> | |
| constexpr const CwiseBinaryOp< internal::scalar_min_op< Scalar, Scalar, NaNPropagation >, const Derived, const ConstantReturnType > | cwiseMin (const Scalar &other) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryNotEqualReturnType< OtherDerived > | cwiseNotEqual (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| constexpr const CwiseScalarNotEqualReturnType | cwiseNotEqual (const Scalar &s) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryOp< internal::scalar_product_op< Derived ::Scalar, OtherDerived ::Scalar >, const Derived, const OtherDerived > | cwiseProduct (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const Derived, const OtherDerived > | cwiseQuotient (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| const CwiseUnaryOp< internal::scalar_sign_op< Scalar >, const Derived > | cwiseSign () const |
| const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > | cwiseSqrt () const |
| const CwiseUnaryOp< internal::scalar_square_op< Scalar >, const Derived > | cwiseSquare () const |
| const internal::eval< Derived >::type | eval () const |
| template<int N> | |
| constexpr FixedSegmentReturnType< N >::Type | head (Index n=N) |
| template<int N> | |
| constexpr ConstFixedSegmentReturnType< N >::Type | head (Index n=N) const |
| This is the const version of head<int>(). | |
| template<typename NType> | |
| constexpr FixedSegmentReturnType<... >::Type | head (NType n) |
| template<typename NType> | |
| constexpr const ConstFixedSegmentReturnType<... >::Type | head (NType n) const |
| This is the const version of head(NType). | |
| constexpr NonConstImagReturnType | imag () |
| constexpr const ImagReturnType | imag () const |
| Index | innerSize () const |
| constexpr InnerVectorReturnType | innerVector (Index outer) |
| constexpr const ConstInnerVectorReturnType | innerVector (Index outer) const |
| constexpr InnerVectorsReturnType | innerVectors (Index outerStart, Index outerSize) |
| constexpr const ConstInnerVectorsReturnType | innerVectors (Index outerStart, Index outerSize) const |
| bool | isVector () const |
| template<int N> | |
| constexpr NColsBlockXpr< N >::Type | leftCols (Index n=N) |
| template<int N> | |
| constexpr ConstNColsBlockXpr< N >::Type | leftCols (Index n=N) const |
| This is the const version of leftCols<int>(). | |
| template<typename NColsType> | |
| constexpr NColsBlockXpr<... >::Type | leftCols (NColsType n) |
| template<typename NColsType> | |
| constexpr const ConstNColsBlockXpr<... >::Type | leftCols (NColsType n) const |
| This is the const version of leftCols(NColsType). | |
| template<int N> | |
| constexpr NColsBlockXpr< N >::Type | middleCols (Index startCol, Index n=N) |
| template<int N> | |
| constexpr ConstNColsBlockXpr< N >::Type | middleCols (Index startCol, Index n=N) const |
| This is the const version of middleCols<int>(). | |
| template<typename NColsType> | |
| constexpr NColsBlockXpr<... >::Type | middleCols (Index startCol, NColsType numCols) |
| template<typename NColsType> | |
| constexpr const ConstNColsBlockXpr<... >::Type | middleCols (Index startCol, NColsType numCols) const |
| This is the const version of middleCols(Index,NColsType). | |
| template<int N> | |
| constexpr NRowsBlockXpr< N >::Type | middleRows (Index startRow, Index n=N) |
| template<int N> | |
| constexpr ConstNRowsBlockXpr< N >::Type | middleRows (Index startRow, Index n=N) const |
| This is the const version of middleRows<int>(). | |
| template<typename NRowsType> | |
| constexpr NRowsBlockXpr<... >::Type | middleRows (Index startRow, NRowsType n) |
| template<typename NRowsType> | |
| constexpr const ConstNRowsBlockXpr<... >::Type | middleRows (Index startRow, NRowsType n) const |
| This is the const version of middleRows(Index,NRowsType). | |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryOp< internal::scalar_bitwise_and_op< Scalar >, const Derived, const OtherDerived > | operator& (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| template<typename OtherDerived> | |
| constexpr 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< internal::scalar_sum_op< Scalar, typename OtherDerived::Scalar >, const Derived, const OtherDerived > | operator+ (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| constexpr const NegativeReturnType | operator- () const |
| template<typename OtherDerived> | |
| const CwiseBinaryOp< internal::scalar_difference_op< Scalar, typename OtherDerived::Scalar >, const Derived, const OtherDerived > | operator- (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryOp< internal::scalar_bitwise_xor_op< Scalar >, const Derived, const OtherDerived > | operator^ (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| template<typename OtherDerived> | |
| constexpr const CwiseBinaryOp< internal::scalar_bitwise_or_op< Scalar >, const Derived, const OtherDerived > | operator| (const Eigen::SparseMatrixBase< OtherDerived > &other) const |
| template<typename OtherDerived> | |
| constexpr 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 |
| constexpr NonConstRealReturnType | real () |
| constexpr RealReturnType | real () const |
| template<int N> | |
| constexpr NColsBlockXpr< N >::Type | rightCols (Index n=N) |
| template<int N> | |
| constexpr ConstNColsBlockXpr< N >::Type | rightCols (Index n=N) const |
| This is the const version of rightCols<int>(). | |
| template<typename NColsType> | |
| constexpr NColsBlockXpr<... >::Type | rightCols (NColsType n) |
| template<typename NColsType> | |
| constexpr const ConstNColsBlockXpr<... >::Type | rightCols (NColsType n) const |
| This is the const version of rightCols(NColsType). | |
| constexpr RowXpr | row (Index i) |
| constexpr ConstRowXpr | row (Index i) const |
| This is the const version of row(). | |
| Index | rows () const |
| template<int N> | |
| constexpr FixedSegmentReturnType< N >::Type | segment (Index start, Index n=N) |
| template<int N> | |
| constexpr ConstFixedSegmentReturnType< N >::Type | segment (Index start, Index n=N) const |
| This is the const version of segment<int>(Index). | |
| template<typename NType> | |
| constexpr FixedSegmentReturnType<... >::Type | segment (Index start, NType n) |
| template<typename NType> | |
| constexpr const ConstFixedSegmentReturnType<... >::Type | segment (Index start, NType n) const |
| This is the const version of segment(Index,NType). | |
| Index | size () const |
| template<DirectionType Direction> | |
| constexpr std::conditional_t< Direction==Vertical, ColXpr, RowXpr > | subVector (Index i) |
| template<DirectionType Direction> | |
| constexpr std::conditional_t< Direction==Vertical, ConstColXpr, ConstRowXpr > | subVector (Index i) const |
| template<DirectionType Direction> | |
| constexpr Index | subVectors () const |
| template<int N> | |
| constexpr FixedSegmentReturnType< N >::Type | tail (Index n=N) |
| template<int N> | |
| constexpr ConstFixedSegmentReturnType< N >::Type | tail (Index n=N) const |
| This is the const version of tail<int>(). | |
| template<typename NType> | |
| constexpr FixedSegmentReturnType<... >::Type | tail (NType n) |
| template<typename NType> | |
| constexpr const ConstFixedSegmentReturnType<... >::Type | tail (NType n) const |
| This is the const version of tail(NType). | |
| template<int CRows, int CCols> | |
| constexpr FixedBlockXpr< CRows, CCols >::Type | topLeftCorner () |
| template<int CRows, int CCols> | |
| constexpr const ConstFixedBlockXpr< CRows, CCols >::Type | topLeftCorner () const |
| This is the const version of topLeftCorner<int, int>(). | |
| template<int CRows, int CCols> | |
| constexpr FixedBlockXpr< CRows, CCols >::Type | topLeftCorner (Index cRows, Index cCols) |
| template<int CRows, int CCols> | |
| constexpr 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> | |
| constexpr FixedBlockXpr<...,... >::Type | topLeftCorner (NRowsType cRows, NColsType cCols) |
| template<typename NRowsType, typename NColsType> | |
| constexpr const ConstFixedBlockXpr<...,... >::Type | topLeftCorner (NRowsType cRows, NColsType cCols) const |
| This is the const version of topLeftCorner(Index, Index). | |
| template<int CRows, int CCols> | |
| constexpr FixedBlockXpr< CRows, CCols >::Type | topRightCorner () |
| template<int CRows, int CCols> | |
| constexpr const ConstFixedBlockXpr< CRows, CCols >::Type | topRightCorner () const |
| This is the const version of topRightCorner<int, int>(). | |
| template<int CRows, int CCols> | |
| constexpr FixedBlockXpr< CRows, CCols >::Type | topRightCorner (Index cRows, Index cCols) |
| template<int CRows, int CCols> | |
| constexpr 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> | |
| constexpr FixedBlockXpr<...,... >::Type | topRightCorner (NRowsType cRows, NColsType cCols) |
| template<typename NRowsType, typename NColsType> | |
| constexpr const ConstFixedBlockXpr<...,... >::Type | topRightCorner (NRowsType cRows, NColsType cCols) const |
| This is the const version of topRightCorner(NRowsType, NColsType). | |
| template<int N> | |
| constexpr NRowsBlockXpr< N >::Type | topRows (Index n=N) |
| template<int N> | |
| constexpr ConstNRowsBlockXpr< N >::Type | topRows (Index n=N) const |
| This is the const version of topRows<int>(). | |
| template<typename NRowsType> | |
| constexpr NRowsBlockXpr<... >::Type | topRows (NRowsType n) |
| template<typename NRowsType> | |
| constexpr 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> | |
| constexpr const CwiseUnaryOp< CustomUnaryOp, const Derived > | unaryExpr (const CustomUnaryOp &func=CustomUnaryOp()) const |
| Apply a unary operator coefficient-wise. | |
| template<typename CustomViewOp> | |
| constexpr CwiseUnaryView< CustomViewOp, Derived > | unaryViewExpr (const CustomViewOp &func=CustomViewOp()) |
| template<typename CustomViewOp> | |
| constexpr const CwiseUnaryView< CustomViewOp, const Derived > | unaryViewExpr (const CustomViewOp &func=CustomViewOp()) const |
Public Member Functions inherited from Eigen::EigenBase< Derived > | |
| constexpr Index | cols () const noexcept |
| constexpr Derived & | derived () |
| constexpr const Derived & | derived () const |
| constexpr Index | rows () const noexcept |
| constexpr Index | size () const noexcept |
| using 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.
| using Eigen::SparseMatrixBase< Derived >::StorageIndex |
The integer type used to store indices within a SparseMatrix. For a SparseMatrix<Scalar,Options,IndexType> it is an alias of the third template parameter IndexType.
| using Eigen::SparseMatrixBase< Derived >::value_type |
The numeric type of the expression's 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. |
|
inlineconstexpr |
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.211,-0.408) (0.108,0.54) (0.435,0.899) (-0.198,-0.96) (0.597,0.0486) (0.258,0.783) (0.214,-0.828) (-0.782,-0.874) (-0.605,0.946) (0.0268,-0.295) (-0.514,0.326) (-0.563,0.941) (0.536,0.543) (0.832,0.838) (0.608,-0.302) (0.678,0.702)
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.block<2,2>(1,1): -1122281286 -1843394476 -1364114958 35005211 Now the matrix m is: 1804289383 -1550966999 -782303108 336465782 -465790871 0 0 278722862 1957747793 0 0 2145174067 -1427598262 -102585885 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is the block: -1122281286 -1843394476 278722862 -1364114958 35005211 2145174067 Now the matrix m is: 1804289383 -1550966999 -782303108 336465782 -465790871 0 0 0 1957747793 0 0 0 -1427598262 -102585885 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.block(1, 1, 2, 2): -1122281286 -1843394476 -1364114958 35005211 Now the matrix m is: 1804289383 -1550966999 -782303108 336465782 -465790871 0 0 278722862 1957747793 0 0 2145174067 -1427598262 -102585885 -1852781081 -1045969719
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.
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is m.bottomLeftCorner<2,2>():
1957747793 -1364114958
-1427598262 -102585885
Now the matrix m is:
1804289383 -1550966999 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
0 0 35005211 2145174067
0 0 -1852781081 -1045969719
|
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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is m.bottomLeftCorner<2,Dynamic>(2,2):
1957747793 -1364114958
-1427598262 -102585885
Now the matrix m is:
1804289383 -1550966999 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
0 0 35005211 2145174067
0 0 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is m.bottomLeftCorner(2, 2):
1957747793 -1364114958
-1427598262 -102585885
Now the matrix m is:
1804289383 -1550966999 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
0 0 35005211 2145174067
0 0 -1852781081 -1045969719
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.
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.bottomRightCorner<2,2>(): 35005211 2145174067 -1852781081 -1045969719 Now the matrix m is: 1804289383 -1550966999 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 0 0 -1427598262 -102585885 0 0
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.bottomRightCorner<2,Dynamic>(2,2): 35005211 2145174067 -1852781081 -1045969719 Now the matrix m is: 1804289383 -1550966999 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 0 0 -1427598262 -102585885 0 0
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.bottomRightCorner(2, 2): 35005211 2145174067 -1852781081 -1045969719 Now the matrix m is: 1804289383 -1550966999 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 0 0 -1427598262 -102585885 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.
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is a.bottomRows<2>():
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Now the array a is:
1804289383 -1550966999 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
0 0 0 0
0 0 0 0
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is a.bottomRows(2):
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Now the array a is:
1804289383 -1550966999 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
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.
|
inlineconstexpr |
*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.
|
inlineconstexpr |
*this. Note that the numbering starts at 0.Example:
Output:
1 4 0 0 5 0 0 6 1
|
inline |
|
inlineconstexpr |
*this. This method does not change the sparsity of *this: the complex conjugate is applied to explicitly stored coefficients only.
|
inlineconstexpr |
*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.
| const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseAbs | ( | ) | const |
*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.
| const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseAbs2 | ( | ) | const |
*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.
| const CwiseUnaryOp< internal::scalar_arg_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseArg | ( | ) | const |
*this Example:
Output:
(0.68,-0.211) (0.823,-0.605) (-0.444,0.108) (0.566,0.597) (-0.33,0.536) (-0.0452,0.258) -0.301 -0.634 2.9 0.812 2.12 1.74
This method does not change the sparsity of *this: the arg is applied to explicitly stored coefficients only.
| const CwiseUnaryOp< internal::scalar_cbrt_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseCbrt | ( | ) | const |
This method does not change the sparsity of *this: the cube - root is applied to explicitly stored coefficients only.
|
inlineconstexpr |
Example:
Output:
Comparing m with identity matrix: 1 1 0 1 Number of coefficients that are equal: 3
|
inlineconstexpr |
*this and a scalar s
|
inlineconstexpr |
|
inlineconstexpr |
*this and a scalar s
|
inlineconstexpr |
|
inlineconstexpr |
*this and a scalar s | const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseInverse | ( | ) | const |
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.
|
inlineconstexpr |
|
inlineconstexpr |
*this and a scalar s
|
inlineconstexpr |
|
inlineconstexpr |
*this and a scalar s
|
inlineconstexpr |
Example:
Output:
4 3 4
|
inlineconstexpr |
|
inlineconstexpr |
Example:
Output:
2 2 3
|
inlineconstexpr |
|
inlineconstexpr |
Example:
Output:
Comparing m with identity matrix: 0 0 1 0 Number of coefficients that are not equal: 1
|
inlineconstexpr |
*this and a scalar s
|
inlineconstexpr |
Example:
Output:
a: 1804289383 -1427598262 -1364114958 -465790871 -1550966999 -102585885 1957747793 -1122281286 -782303108 b: -1843394476 336465782 -1045969719 35005211 278722862 1315634022 -1852781081 2145174067 -778350579 c: 247332300 1274064924 1451757314 1178627603 752122462 1323254130 -1164727785 -343432946 -653408692
|
inlineconstexpr |
Example:
Output:
0.5 1.5 1.33
| const CwiseUnaryOp< internal::scalar_sign_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseSign | ( | ) | const |
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.
| const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseSqrt | ( | ) | const |
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.
| const CwiseUnaryOp< internal::scalar_square_op< Scalar >, const Derived > Eigen::SparseMatrixBase< Derived >::cwiseSquare | ( | ) | const |
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.
|
inlineconstexpr |
*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 1957747793 -1427598262
Here is v.head(2):
1804289383 -465790871
Now the vector v is:
0 0 1957747793 -1427598262
|
inlineconstexpr |
*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 1957747793 -1427598262
Here is v.head(2):
1804289383 -465790871
Now the vector v is:
0 0 1957747793 -1427598262
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.
|
inlineconstexpr |
*this. For real-valued objects the imaginary part is identically zero and not writable; this then returns the same read-only zero expression as the const overload. This method does not change the sparsity of *this: the imaginary part function is applied to explicitly stored coefficients only.
|
inlineconstexpr |
*this. This method does not change the sparsity of *this: the imaginary part function is applied to explicitly stored coefficients only.
|
inline |
|
inlineconstexpr |
*this if *this is col-major (resp. row-major).
|
inlineconstexpr |
*this if *this is col-major (resp. row-major). Read-only.
|
inlineconstexpr |
*this starting at outerStart if *this is col-major (resp. row-major).
|
inlineconstexpr |
*this starting at outerStart if *this is col-major (resp. row-major). Read-only.
|
inline |
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is a.leftCols<2>():
1804289383 -1550966999
-465790871 -1122281286
1957747793 -1364114958
-1427598262 -102585885
Now the array a is:
0 0 -782303108 336465782
0 0 -1843394476 278722862
0 0 35005211 2145174067
0 0 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is a.leftCols(2):
1804289383 -1550966999
-465790871 -1122281286
1957747793 -1364114958
-1427598262 -102585885
Now the array a is:
0 0 -782303108 336465782
0 0 -1843394476 278722862
0 0 35005211 2145174067
0 0 -1852781081 -1045969719
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.
|
inlineconstexpr |
*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 -1045969719 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 1957747793 -102585885 336465782 -778350579 608413784 -1427598262 -782303108 278722862 -1087522255 -412908450 -1550966999 -1843394476 2145174067 -1519308637 -1997685333 A(:,1..3) = -1122281286 35005211 -1045969719 -1364114958 -1852781081 1315634022 -102585885 336465782 -778350579 -782303108 278722862 -1087522255 -1843394476 2145174067 -1519308637
|
inlineconstexpr |
*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 -1045969719 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 1957747793 -102585885 336465782 -778350579 608413784 -1427598262 -782303108 278722862 -1087522255 -412908450 -1550966999 -1843394476 2145174067 -1519308637 -1997685333 A(1..3,:) = -1122281286 35005211 -1045969719 -1364114958 -1852781081 1315634022 -102585885 336465782 -778350579 -782303108 278722862 -1087522255 -1843394476 2145174067 -1519308637
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.
|
inlineconstexpr |
*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 -1045969719 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 1957747793 -102585885 336465782 -778350579 608413784 -1427598262 -782303108 278722862 -1087522255 -412908450 -1550966999 -1843394476 2145174067 -1519308637 -1997685333 A(1..3,:) = -465790871 -1364114958 -1852781081 1315634022 -1287999227 1957747793 -102585885 336465782 -778350579 608413784 -1427598262 -782303108 278722862 -1087522255 -412908450
|
inlineconstexpr |
*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 -1045969719 -1016307419 -465790871 -1364114958 -1852781081 1315634022 -1287999227 1957747793 -102585885 336465782 -778350579 608413784 -1427598262 -782303108 278722862 -1087522255 -412908450 -1550966999 -1843394476 2145174067 -1519308637 -1997685333 A(2..3,:) = 1957747793 -102585885 336465782 -778350579 608413784 -1427598262 -782303108 278722862 -1087522255 -412908450
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.
|
inlineconstexpr |
*this and other
|
inlineconstexpr |
*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< internal::scalar_sum_op< Scalar, typename OtherDerived::Scalar >, const Derived, const OtherDerived > Eigen::SparseMatrixBase< Derived >::operator+ | ( | const Eigen::SparseMatrixBase< OtherDerived > & | other | ) | const |
*this and other
|
inlineconstexpr |
*this bool coefficients. Cast to a signed integer type first. This method does not change the sparsity of *this: the opposite is applied to explicitly stored coefficients only.
| const CwiseBinaryOp< internal::scalar_difference_op< Scalar, typename OtherDerived::Scalar >, const Derived, const OtherDerived > Eigen::SparseMatrixBase< Derived >::operator- | ( | const Eigen::SparseMatrixBase< OtherDerived > & | other | ) | const |
*this and other bool coefficients. Cast to a signed integer type first.
|
inlineconstexpr |
|
inlineconstexpr |
*this and other
|
inlineconstexpr |
*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.
|
inlineconstexpr |
*this. This method does not change the sparsity of *this: the real part function is applied to explicitly stored coefficients only.
|
inlineconstexpr |
*this. This method does not change the sparsity of *this: the real part function is applied to explicitly stored coefficients only.
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is a.rightCols<2>(): -782303108 336465782 -1843394476 278722862 35005211 2145174067 -1852781081 -1045969719 Now the array a is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 1957747793 -1364114958 0 0 -1427598262 -102585885 0 0
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is a.rightCols(2): -782303108 336465782 -1843394476 278722862 35005211 2145174067 -1852781081 -1045969719 Now the array a is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 1957747793 -1364114958 0 0 -1427598262 -102585885 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.
|
inlineconstexpr |
*this. Note that the numbering starts at 0.Example:
Output:
1 0 0 4 5 6 0 0 1
|
inline |
|
inlineconstexpr |
*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 1957747793 -1427598262 Here is v.segment<2>(1): -465790871 1957747793 Now the vector v is: 1804289383 -465790871 0 0
|
inlineconstexpr |
*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 1957747793 -1427598262 Here is v.segment(1, 2): -465790871 1957747793 Now the vector v is: 1804289383 0 0 -1427598262
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 |
|
inlineconstexpr |
Direction
|
inlineconstexpr |
This is the const version of subVector(Index)
|
inlineconstexpr |
Direction
|
inlineconstexpr |
*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 1957747793 -1427598262 Here is v.tail(2): 1957747793 -1427598262 Now the vector v is: 1804289383 -465790871 0 0
|
inlineconstexpr |
*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 1957747793 -1427598262 Here is v.tail(2): 1957747793 -1427598262 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.
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is m.topLeftCorner<2,2>():
1804289383 -1550966999
-465790871 -1122281286
Now the matrix m is:
0 0 -782303108 336465782
0 0 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is m.topLeftCorner<2,Dynamic>(2,2):
1804289383 -1550966999
-465790871 -1122281286
Now the matrix m is:
0 0 -782303108 336465782
0 0 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is m.topLeftCorner(2, 2):
1804289383 -1550966999
-465790871 -1122281286
Now the matrix m is:
0 0 -782303108 336465782
0 0 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
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.
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.topRightCorner<2,2>(): -782303108 336465782 -1843394476 278722862 Now the matrix m is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.topRightCorner<2,Dynamic>(2,2): -782303108 336465782 -1843394476 278722862 Now the matrix m is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782 -465790871 -1122281286 -1843394476 278722862 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719 Here is m.topRightCorner(2, 2): -782303108 336465782 -1843394476 278722862 Now the matrix m is: 1804289383 -1550966999 0 0 -465790871 -1122281286 0 0 1957747793 -1364114958 35005211 2145174067 -1427598262 -102585885 -1852781081 -1045969719
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.
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is a.topRows<2>():
1804289383 -1550966999 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
Now the array a is:
0 0 0 0
0 0 0 0
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
|
inlineconstexpr |
*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 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
Here is a.topRows(2):
1804289383 -1550966999 -782303108 336465782
-465790871 -1122281286 -1843394476 278722862
Now the array a is:
0 0 0 0
0 0 0 0
1957747793 -1364114958 35005211 2145174067
-1427598262 -102585885 -1852781081 -1045969719
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
|
inlineconstexpr |
Apply a unary operator coefficient-wise.
| [in] | func | Functor implementing the unary operator |
| CustomUnaryOp | Type of func |
A lambda can be used to adapt a normal function to the functor interface expected by this method.
Example:
Output:
-0.211 0.108 0.435 -0.198
0.597 0.258 0.214 -0.782
-0.605 0.0268 -0.514 -0.563
0.536 0.832 0.608 0.678
becomes:
0 0.108 0.435 0
0.597 0.258 0.214 0
0 0.0268 0 0
0.536 0.832 0.608 0.678
Genuine functors allow for more possibilities, for instance it may contain a state.
Example:
Output:
-0.211 0.108 0.435 -0.198 0.597 0.258 0.214 -0.782 -0.605 0.0268 -0.514 -0.563 0.536 0.832 0.608 0.678 becomes: -0.211 0.108 0.435 -0.198 0.5 0.258 0.214 -0.5 -0.5 0.0268 -0.5 -0.5 0.5 0.5 0.5 0.5
This method does not change the sparsity of *this: the unary function is applied to explicitly stored coefficients only.
|
inlineconstexpr |
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.
|
inlineconstexpr |
The template parameter CustomUnaryOp is the type of the functor of the custom unary operator.
Example:
Output:
-0.211 0.108 0.435 -0.198 0.597 0.258 0.214 -0.782 -0.605 0.0268 -0.514 -0.563 0.536 0.832 0.608 0.678 becomes: -0.211 0.108 0.435 -0.198 0.5 0.258 0.214 -0.5 -0.5 0.0268 -0.5 -0.5 0.5 0.5 0.5 0.5
This method does not change the sparsity of *this: the unary function is applied to explicitly stored coefficients only.