29 typename NumTraits<typename internal::traits<Derived>::Scalar>::Real,
44 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
48 typename internal::packet_traits<Scalar>::type
56 template<
typename OtherDerived>
84 MaxColsAtCompileTime>::ret),
118#ifndef EIGEN_PARSED_BY_DOXYGEN
140 inline const Derived& derived()
const {
return *
static_cast<const Derived*
>(
this); }
141 inline Derived& derived() {
return *
static_cast<Derived*
>(
this); }
142 inline Derived& const_cast_derived()
const
143 {
return *
static_cast<Derived*
>(
const_cast<SparseMatrixBase*
>(
this)); }
145 typedef internal::special_scalar_op_base<Derived, Scalar, RealScalar, EigenBase<Derived> > Base;
146 using Base::operator*;
147 using Base::operator/;
150#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase
151# include "../plugins/CommonCwiseUnaryOps.h"
152# include "../plugins/CommonCwiseBinaryOps.h"
153# include "../plugins/MatrixCwiseUnaryOps.h"
154# include "../plugins/MatrixCwiseBinaryOps.h"
155# include "../plugins/BlockMethods.h"
156# ifdef EIGEN_SPARSEMATRIXBASE_PLUGIN
157# include EIGEN_SPARSEMATRIXBASE_PLUGIN
159# undef EIGEN_CURRENT_STORAGE_BASE_CLASS
160#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
181 bool isRValue()
const {
return m_isRValue; }
182 Derived& markAsRValue() { m_isRValue =
true;
return derived(); }
184 SparseMatrixBase() : m_isRValue(false) { }
187 template<
typename OtherDerived>
188 Derived& operator=(
const ReturnByValue<OtherDerived>& other);
190 template<
typename OtherDerived>
191 inline Derived& operator=(
const SparseMatrixBase<OtherDerived>& other);
193 inline Derived& operator=(
const Derived& other);
197 template<
typename OtherDerived>
198 inline Derived& assign(
const OtherDerived& other);
200 template<
typename OtherDerived>
201 inline void assignGeneric(
const OtherDerived& other);
205 friend std::ostream & operator << (std::ostream & s,
const SparseMatrixBase& m)
207 typedef typename Derived::Nested Nested;
208 typedef typename internal::remove_all<Nested>::type NestedCleaned;
212 const Nested nm(m.derived());
213 for (
Index row=0; row<nm.outerSize(); ++row)
216 for (
typename NestedCleaned::InnerIterator it(nm.derived(), row); it; ++it)
218 for ( ; col<it.index(); ++col)
220 s << it.value() <<
" ";
223 for ( ; col<m.cols(); ++col)
230 const Nested nm(m.derived());
233 for (
typename NestedCleaned::InnerIterator it(nm.derived(), 0); it; ++it)
235 for ( ; row<it.index(); ++row)
236 s <<
"0" << std::endl;
237 s << it.value() << std::endl;
240 for ( ; row<m.rows(); ++row)
241 s <<
"0" << std::endl;
245 SparseMatrix<Scalar, RowMajorBit, StorageIndex> trans = m;
246 s << static_cast<const SparseMatrixBase<SparseMatrix<Scalar, RowMajorBit, StorageIndex> >&>(trans);
252 template<
typename OtherDerived>
253 Derived& operator+=(
const SparseMatrixBase<OtherDerived>& other);
254 template<
typename OtherDerived>
255 Derived& operator-=(
const SparseMatrixBase<OtherDerived>& other);
257 template<
typename OtherDerived>
258 Derived& operator+=(
const DiagonalBase<OtherDerived>& other);
259 template<
typename OtherDerived>
260 Derived& operator-=(
const DiagonalBase<OtherDerived>& other);
262 Derived& operator*=(
const Scalar& other);
263 Derived& operator/=(
const Scalar& other);
275 template<
typename OtherDerived>
280 template<
typename OtherDerived>
286 template<
typename OtherDerived>
friend
292 template<
typename OtherDerived>
293 const Product<Derived,OtherDerived,AliasFreeProduct>
294 operator*(
const SparseMatrixBase<OtherDerived> &other)
const;
297 template<
typename OtherDerived>
298 const Product<Derived,OtherDerived>
299 operator*(
const MatrixBase<OtherDerived> &other)
const
300 {
return Product<Derived,OtherDerived>(derived(), other.derived()); }
303 template<
typename OtherDerived>
friend
304 const Product<OtherDerived,Derived>
305 operator*(
const MatrixBase<OtherDerived> &lhs,
const SparseMatrixBase& rhs)
306 {
return Product<OtherDerived,Derived>(lhs.derived(), rhs.derived()); }
314 template<
typename OtherDerived>
323 template<
unsigned int UpLo>
inline
325 template<
unsigned int UpLo>
inline
335 const ConstTransposeReturnType transpose()
const {
return ConstTransposeReturnType(derived()); }
336 const AdjointReturnType adjoint()
const {
return AdjointReturnType(transpose()); }
339 typedef Block<Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> InnerVectorReturnType;
340 typedef Block<const Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> ConstInnerVectorReturnType;
345 typedef Block<Derived,Dynamic,Dynamic,true> InnerVectorsReturnType;
346 typedef Block<const Derived,Dynamic,Dynamic,true> ConstInnerVectorsReturnType;
355 template<
typename OtherDerived>
356 bool isApprox(
const SparseMatrixBase<OtherDerived>& other,
357 const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const;
359 template<
typename OtherDerived>
360 bool isApprox(
const MatrixBase<OtherDerived>& other,
361 const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const
362 {
return toDense().isApprox(other,prec); }
381 static inline StorageIndex convert_index(
const Index idx) {
382 return internal::convert_index<StorageIndex>(idx);
385 template<
typename Dest>
void evalTo(Dest &)
const;
Matrix< Scalar, EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime), EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime)> SquareMatrixType
type of the equivalent square matrix
Definition SparseMatrixBase.h:138