10 #ifndef EIGEN_SPARSEMATRIXBASE_H 11 #define EIGEN_SPARSEMATRIXBASE_H 31 typedef typename internal::traits<Derived>::Scalar Scalar;
38 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
39 typedef typename internal::traits<Derived>::StorageKind StorageKind;
43 typedef typename internal::traits<Derived>::StorageIndex
StorageIndex;
45 typedef typename internal::add_const_on_value_type_if_arithmetic<
46 typename internal::packet_traits<Scalar>::type
47 >::type PacketReturnType;
54 template<
typename OtherDerived>
72 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
73 internal::traits<Derived>::ColsAtCompileTime>::ret),
81 MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
82 MaxColsAtCompileTime>::ret),
95 Flags = internal::traits<Derived>::Flags,
105 #ifndef EIGEN_PARSED_BY_DOXYGEN
111 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
114 >::type AdjointReturnType;
121 #ifndef EIGEN_PARSED_BY_DOXYGEN 132 typedef typename internal::conditional<_HasDirectAccess, const Scalar&, Scalar>::type CoeffReturnType;
143 inline const Derived&
derived()
const {
return *
static_cast<const Derived*
>(
this); }
144 inline Derived&
derived() {
return *
static_cast<Derived*
>(
this); }
145 inline Derived& const_cast_derived()
const 150 #endif // not EIGEN_PARSED_BY_DOXYGEN 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 194 bool isRValue()
const {
return m_isRValue; }
195 Derived& markAsRValue() { m_isRValue =
true;
return derived(); }
200 template<
typename OtherDerived>
201 Derived& operator=(
const ReturnByValue<OtherDerived>& other);
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>
214 inline void assignGeneric(
const OtherDerived& other);
218 friend std::ostream & operator << (std::ostream & s,
const SparseMatrixBase& m)
220 typedef typename Derived::Nested Nested;
221 typedef typename internal::remove_all<Nested>::type NestedCleaned;
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() <<
" ";
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);
267 template<
typename OtherDerived>
269 template<
typename OtherDerived>
272 template<
typename OtherDerived>
273 Derived& operator+=(
const DiagonalBase<OtherDerived>& other);
274 template<
typename OtherDerived>
275 Derived& operator-=(
const DiagonalBase<OtherDerived>& other);
277 template<
typename OtherDerived>
279 template<
typename OtherDerived>
282 Derived& operator*=(
const Scalar& other);
283 Derived& operator/=(
const Scalar& other);
285 template<
typename OtherDerived>
struct CwiseProductDenseReturnType {
287 typename internal::traits<Derived>::Scalar,
288 typename internal::traits<OtherDerived>::Scalar
295 template<
typename OtherDerived>
296 EIGEN_STRONG_INLINE
const typename CwiseProductDenseReturnType<OtherDerived>::Type
300 template<
typename OtherDerived>
302 operator*(
const DiagonalBase<OtherDerived> &other)
const 306 template<
typename OtherDerived>
friend 312 template<
typename OtherDerived>
317 template<
typename OtherDerived>
323 template<
typename OtherDerived>
friend 331 return SparseSymmetricPermutationProduct<Derived,Upper|Lower>(
derived(), perm);
334 template<
typename OtherDerived>
343 template<
unsigned int UpLo>
inline 344 typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView()
const;
345 template<
unsigned int UpLo>
inline 346 typename SelfAdjointViewReturnType<UpLo>::Type selfadjointView();
350 RealScalar squaredNorm()
const;
351 RealScalar norm()
const;
352 RealScalar blueNorm()
const;
354 TransposeReturnType transpose() {
return TransposeReturnType(
derived()); }
355 const ConstTransposeReturnType transpose()
const {
return ConstTransposeReturnType(
derived()); }
356 const AdjointReturnType adjoint()
const {
return AdjointReturnType(transpose()); }
358 DenseMatrixType toDense()
const 360 return DenseMatrixType(
derived());
363 template<
typename OtherDerived>
367 template<
typename OtherDerived>
370 {
return toDense().isApprox(other,prec); }
377 inline const typename internal::eval<Derived>::type
eval()
const 378 {
return typename internal::eval<Derived>::type(
derived()); }
389 static inline StorageIndex convert_index(
const Index idx) {
390 return internal::convert_index<StorageIndex>(idx);
393 template<
typename Dest>
void evalTo(Dest &)
const;
398 #endif // EIGEN_SPARSEMATRIXBASE_H Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:60
const CwiseBinaryOp< internal::scalar_product_op< Derived ::Scalar, OtherDerived ::Scalar >, const Derived, const OtherDerived > cwiseProduct(const Eigen::SparseMatrixBase< OtherDerived > &other) const
Definition: SparseMatrixBase.h:24
Index innerSize() const
Definition: SparseMatrixBase.h:192
Index cols() const
Definition: SparseMatrixBase.h:178
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:71
A versatible sparse matrix representation.
Definition: SparseMatrix.h:96
Expression of the transpose of a matrix.
Definition: Transpose.h:52
const unsigned int DirectAccessBit
Definition: Constants.h:155
RowXpr row(Index i)
Definition: SparseMatrixBase.h:1119
Namespace containing all symbols from the Eigen library.
Definition: Core:141
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition: SparseSelfAdjointView.h:43
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:232
Index outerSize() const
Definition: SparseMatrixBase.h:189
Derived & derived()
Definition: EigenBase.h:46
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
const unsigned int RowMajorBit
Definition: Constants.h:66
bool isVector() const
Definition: SparseMatrixBase.h:186
Definition: EigenBase.h:29
Index size() const
Definition: SparseMatrixBase.h:181
const SparseView< Derived > pruned(const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const
Definition: SparseView.h:246
internal::traits< Derived >::StorageIndex StorageIndex
Definition: SparseMatrixBase.h:43
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:77
Index rows() const
Definition: SparseMatrixBase.h:176
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:26
Definition: SparseMatrixBase.h:84
const CwiseBinaryOp< internal::scalar_product_op< Scalar, T >, Derived, Constant< T > > operator*(const T &scalar) const
Definition: SparseMatrixBase.h:72
Definition: SparseMatrixBase.h:95
Expression of a dense or sparse matrix with zero or too small values removed.
Definition: SparseUtil.h:59
Scalar value_type
Definition: SparseMatrixBase.h:36
Expression of a triangular part in a matrix.
Definition: TriangularMatrix.h:187
SparseSymmetricPermutationProduct< Derived, Upper|Lower > twistedBy(const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
Definition: SparseMatrixBase.h:329
Definition: SparseMatrixBase.h:59
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition: XprHelper.h:801
const internal::eval< Derived >::type eval() const
Definition: SparseMatrixBase.h:377
Definition: SparseMatrixBase.h:65
ColXpr col(Index i)
Definition: SparseMatrixBase.h:1098
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: SparseMatrixBase.h:90