10 #ifndef EIGEN_SPARSEMATRIXBASE_H
11 #define EIGEN_SPARSEMATRIXBASE_H
33 typedef typename internal::traits<Derived>::Scalar
Scalar;
40 typedef typename internal::packet_traits<Scalar>::type
PacketScalar;
41 typedef typename internal::traits<Derived>::StorageKind
StorageKind;
45 typedef typename internal::traits<Derived>::StorageIndex
StorageIndex;
47 typedef typename internal::add_const_on_value_type_if_arithmetic<
48 typename internal::packet_traits<Scalar>::type
56 template<
typename OtherDerived>
95 Flags = internal::traits<Derived>::Flags,
105 #ifndef EIGEN_PARSED_BY_DOXYGEN
111 typedef std::conditional_t<NumTraits<Scalar>::IsComplex,
121 #ifndef EIGEN_PARSED_BY_DOXYGEN
132 typedef std::conditional_t<HasDirectAccess_, const Scalar&, Scalar> CoeffReturnType;
143 inline const Derived&
derived()
const {
return *
static_cast<const Derived*
>(
this); }
144 inline Derived&
derived() {
return *
static_cast<Derived*
>(
this); }
152 #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase
153 #ifdef EIGEN_PARSED_BY_DOXYGEN
154 #define EIGEN_DOC_UNARY_ADDONS(METHOD,OP)
155 #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
156 #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
158 #define EIGEN_DOC_UNARY_ADDONS(X,Y)
159 #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
160 #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
162 # include "../plugins/CommonCwiseUnaryOps.h"
163 # include "../plugins/CommonCwiseBinaryOps.h"
164 # include "../plugins/MatrixCwiseUnaryOps.h"
165 # include "../plugins/MatrixCwiseBinaryOps.h"
166 # include "../plugins/BlockMethods.h"
167 # ifdef EIGEN_SPARSEMATRIXBASE_PLUGIN
168 # include EIGEN_SPARSEMATRIXBASE_PLUGIN
170 #undef EIGEN_CURRENT_STORAGE_BASE_CLASS
171 #undef EIGEN_DOC_UNARY_ADDONS
172 #undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
173 #undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF
200 template<
typename OtherDerived>
203 template<
typename OtherDerived>
206 inline Derived&
operator=(
const Derived& other);
210 template<
typename OtherDerived>
211 inline Derived&
assign(
const OtherDerived& other);
213 template<
typename OtherDerived>
220 typedef typename Derived::Nested Nested;
225 Nested nm(
m.derived());
226 internal::evaluator<NestedCleaned> thisEval(nm);
230 for (
typename internal::evaluator<NestedCleaned>::InnerIterator it(thisEval,
row); it; ++it)
232 for ( ;
col<it.index(); ++
col)
234 s << it.value() <<
" ";
244 Nested nm(
m.derived());
245 internal::evaluator<NestedCleaned> thisEval(nm);
248 for (
typename internal::evaluator<NestedCleaned>::InnerIterator it(thisEval, 0); it; ++it)
250 for ( ;
row<it.index(); ++
row)
251 s <<
"0" << std::endl;
252 s << it.value() << std::endl;
256 s <<
"0" << std::endl;
261 s << static_cast<const SparseMatrixBase<SparseMatrix<Scalar, RowMajorBit, StorageIndex> >&>(trans);
268 template<
typename OtherDerived>
270 template<
typename OtherDerived>
273 template<
typename OtherDerived>
275 template<
typename OtherDerived>
278 template<
typename OtherDerived>
280 template<
typename OtherDerived>
288 typename internal::traits<Derived>::Scalar,
289 typename internal::traits<OtherDerived>::Scalar
296 template<
typename OtherDerived>
301 template<
typename OtherDerived>
307 template<
typename OtherDerived>
friend
313 template<
typename OtherDerived>
318 template<
typename OtherDerived>
324 template<
typename OtherDerived>
friend
335 template<
typename OtherDerived>
344 template<
unsigned int UpLo>
inline
346 template<
unsigned int UpLo>
inline
352 RealScalar
norm()
const;
361 return DenseMatrixType(
derived());
364 template<
typename OtherDerived>
368 template<
typename OtherDerived>
371 {
return toDense().isApprox(other,prec); }
378 inline const typename internal::eval<Derived>::type
eval()
const
379 {
return typename internal::eval<Derived>::type(
derived()); }
391 return internal::convert_index<StorageIndex>(idx);
394 template<
typename Dest>
void evalTo(Dest &)
const;
RowXpr row(Index i)
This is the const version of row(). */.
ColXpr col(Index i)
This is the const version of col().
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Generic expression of a matrix where all coefficients are defined by a functor.
Generic expression where a coefficient-wise unary operator is applied to an expression.
Base class for diagonal matrices and expressions.
const Derived & derived() const
Base class for all dense matrices, vectors, and expressions.
Expression of the product of two arbitrary matrices or vectors.
Base class of any sparse matrices or sparse expressions.
Derived & operator*=(const Scalar &other)
internal::traits< Derived >::StorageIndex StorageIndex
RealScalar blueNorm() const
Scalar dot(const SparseMatrixBase< OtherDerived > &other) const
void evalTo(Dest &) const
const ConstTransposeReturnType transpose() const
friend std::ostream & operator<<(std::ostream &s, const SparseMatrixBase &m)
Derived & operator=(const EigenBase< OtherDerived > &other)
Derived & operator/=(const Scalar &other)
internal::traits< Derived >::Scalar Scalar
Scalar dot(const MatrixBase< OtherDerived > &other) const
const Product< Derived, OtherDerived > operator*(const MatrixBase< OtherDerived > &other) const
void assignGeneric(const OtherDerived &other)
Transpose< Derived > TransposeReturnType
SparseSymmetricPermutationProduct< Derived, Upper|Lower > twistedBy(const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
std::conditional_t< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, Eigen::Transpose< const Derived > >, Transpose< const Derived > > AdjointReturnType
SparseMatrix< Scalar, Flags &RowMajorBit ? RowMajor :ColMajor, StorageIndex > PlainObject
RealScalar squaredNorm() const
Derived & operator-=(const SparseMatrixBase< OtherDerived > &other)
internal::packet_traits< Scalar >::type PacketScalar
const TriangularView< const Derived, Mode > triangularView() const
DenseMatrixType toDense() const
bool isApprox(const SparseMatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Transpose< const Derived > ConstTransposeReturnType
const internal::eval< Derived >::type eval() const
Derived & operator+=(const SparseMatrixBase< OtherDerived > &other)
Matrix< StorageIndex, Dynamic, 1 > IndexVector
const CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct(const MatrixBase< OtherDerived > &other) const
internal::traits< Derived >::StorageKind StorageKind
friend const Product< OtherDerived, Derived > operator*(const DiagonalBase< OtherDerived > &lhs, const SparseMatrixBase &rhs)
SelfAdjointViewReturnType< UpLo >::Type selfadjointView()
bool isApprox(const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Derived & assign(const OtherDerived &other)
SparseMatrixBase StorageBaseType
Derived & operator*=(const SparseMatrixBase< OtherDerived > &other)
friend const Product< OtherDerived, Derived > operator*(const MatrixBase< OtherDerived > &lhs, const SparseMatrixBase &rhs)
const Product< Derived, OtherDerived > operator*(const DiagonalBase< OtherDerived > &other) const
TransposeReturnType transpose()
ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView() const
const SparseView< Derived > pruned(const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const
const AdjointReturnType adjoint() const
internal::add_const_on_value_type_if_arithmetic< typename internal::packet_traits< Scalar >::type >::type PacketReturnType
Matrix< Scalar, Dynamic, 1 > ScalarVector
static StorageIndex convert_index(const Index idx)
A versatible sparse matrix representation.
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Expression of a dense or sparse matrix with zero or too small values removed.
Expression of the transpose of a matrix.
Expression of a triangular part in a matrix.
const unsigned int DirectAccessBit
const unsigned int RowMajorBit
constexpr int size_at_compile_time(int rows, int cols)
typename remove_all< T >::type remove_all_t
constexpr int max_size_prefer_dynamic(A a, B b)
Eigen::Index Index
The interface type of indices.
Derived & const_cast_derived() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
const SparseSelfAdjointView< const Derived, UpLo > Type
CwiseBinaryOp< internal::scalar_product_op< typename ScalarBinaryOpTraits< typename internal::traits< Derived >::Scalar, typename internal::traits< OtherDerived >::Scalar >::ReturnType >, const Derived, const OtherDerived > Type
SparseSelfAdjointView< Derived, UpLo > Type