mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 19:29:02 +08:00
Improve inline documentation of SparseCompressedBase and its derived classes
This commit is contained in:
parent
8b0d1eb0f7
commit
715f6f049f
@ -207,6 +207,7 @@ template<typename PlainObjectType, int Options, typename StrideType> class Ref
|
|||||||
EIGEN_DEVICE_FUNC inline Ref(const DenseBase<Derived>& expr,
|
EIGEN_DEVICE_FUNC inline Ref(const DenseBase<Derived>& expr,
|
||||||
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
|
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
|
||||||
#else
|
#else
|
||||||
|
/** Implicit constructor from any dense expression */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(DenseBase<Derived>& expr)
|
inline Ref(DenseBase<Derived>& expr)
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,6 +22,16 @@ struct traits<SparseCompressedBase<Derived> > : traits<Derived>
|
|||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
|
/** \ingroup SparseCore_Module
|
||||||
|
* \class SparseCompressedBase
|
||||||
|
* \brief Common base class for sparse [compressed]-{row|column}-storage format.
|
||||||
|
*
|
||||||
|
* This class defines the common interface for all derived classes implementing the compressed sparse storage format, such as:
|
||||||
|
* - SparseMatrix
|
||||||
|
* - Ref<SparseMatrixType,Options>
|
||||||
|
* - Map<SparseMatrixType>
|
||||||
|
*
|
||||||
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
class SparseCompressedBase
|
class SparseCompressedBase
|
||||||
: public SparseMatrixBase<Derived>
|
: public SparseMatrixBase<Derived>
|
||||||
|
@ -37,11 +37,15 @@ struct traits<Map<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, St
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
template<typename Derived,
|
template<typename Derived,
|
||||||
int Level = internal::accessors_level<Derived>::has_write_access ? WriteAccessors : ReadOnlyAccessors
|
int Level = internal::accessors_level<Derived>::has_write_access ? WriteAccessors : ReadOnlyAccessors
|
||||||
> class SparseMapBase;
|
> class SparseMapBase;
|
||||||
|
|
||||||
|
/** \ingroup SparseCore_Module
|
||||||
|
* class SparseMapBase
|
||||||
|
* \brief Common base class for Map and Ref instance of sparse matrix and vector.
|
||||||
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
class SparseMapBase<Derived,ReadOnlyAccessors>
|
class SparseMapBase<Derived,ReadOnlyAccessors>
|
||||||
: public SparseCompressedBase<Derived>
|
: public SparseCompressedBase<Derived>
|
||||||
@ -71,22 +75,33 @@ class SparseMapBase<Derived,ReadOnlyAccessors>
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/** \copydoc SparseMatrixBase::rows() */
|
||||||
inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
|
inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; }
|
||||||
|
/** \copydoc SparseMatrixBase::cols() */
|
||||||
inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
|
inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; }
|
||||||
|
/** \copydoc SparseMatrixBase::innerSize() */
|
||||||
inline Index innerSize() const { return m_innerSize; }
|
inline Index innerSize() const { return m_innerSize; }
|
||||||
|
/** \copydoc SparseMatrixBase::outerSize() */
|
||||||
inline Index outerSize() const { return m_outerSize; }
|
inline Index outerSize() const { return m_outerSize; }
|
||||||
|
/** \copydoc SparseCompressedBase::nonZeros */
|
||||||
inline Index nonZeros() const { return m_zero_nnz[1]; }
|
inline Index nonZeros() const { return m_zero_nnz[1]; }
|
||||||
|
|
||||||
|
/** \copydoc SparseCompressedBase::isCompressed */
|
||||||
bool isCompressed() const { return m_innerNonZeros==0; }
|
bool isCompressed() const { return m_innerNonZeros==0; }
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
// direct access interface
|
// direct access interface
|
||||||
|
/** \copydoc SparseMatrix::valuePtr */
|
||||||
inline const Scalar* valuePtr() const { return m_values; }
|
inline const Scalar* valuePtr() const { return m_values; }
|
||||||
|
/** \copydoc SparseMatrix::innerIndexPtr */
|
||||||
inline const StorageIndex* innerIndexPtr() const { return m_innerIndices; }
|
inline const StorageIndex* innerIndexPtr() const { return m_innerIndices; }
|
||||||
|
/** \copydoc SparseMatrix::outerIndexPtr */
|
||||||
inline const StorageIndex* outerIndexPtr() const { return m_outerIndex; }
|
inline const StorageIndex* outerIndexPtr() const { return m_outerIndex; }
|
||||||
|
/** \copydoc SparseMatrix::innerNonZeroPtr */
|
||||||
inline const StorageIndex* innerNonZeroPtr() const { return m_innerNonZeros; }
|
inline const StorageIndex* innerNonZeroPtr() const { return m_innerNonZeros; }
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
||||||
|
/** \copydoc SparseMatrix::coeff */
|
||||||
inline Scalar coeff(Index row, Index col) const
|
inline Scalar coeff(Index row, Index col) const
|
||||||
{
|
{
|
||||||
const Index outer = IsRowMajor ? row : col;
|
const Index outer = IsRowMajor ? row : col;
|
||||||
@ -125,6 +140,10 @@ class SparseMapBase<Derived,ReadOnlyAccessors>
|
|||||||
inline SparseMapBase() {}
|
inline SparseMapBase() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** \ingroup SparseCore_Module
|
||||||
|
* class SparseMapBase
|
||||||
|
* \brief Common base class for writable Map and Ref instance of sparse matrix and vector.
|
||||||
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
class SparseMapBase<Derived,WriteAccessors>
|
class SparseMapBase<Derived,WriteAccessors>
|
||||||
: public SparseMapBase<Derived,ReadOnlyAccessors>
|
: public SparseMapBase<Derived,ReadOnlyAccessors>
|
||||||
@ -185,9 +204,23 @@ class SparseMapBase<Derived,WriteAccessors>
|
|||||||
inline SparseMapBase() {}
|
inline SparseMapBase() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** \ingroup SparseCore_Module
|
||||||
|
*
|
||||||
|
* \brief Specialization of class Map for SparseMatrix-like storage.
|
||||||
|
*
|
||||||
|
* \tparam SparseMatrixType the equivalent sparse matrix type of the referenced data, it must be a template instance of class SparseMatrix.
|
||||||
|
*
|
||||||
|
* \sa class Map, class SparseMatrix, class Ref<SparseMatrixType,Options>
|
||||||
|
*/
|
||||||
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename MatScalar, int MatOptions, typename MatIndex, int Options, typename StrideType>
|
template<typename MatScalar, int MatOptions, typename MatIndex, int Options, typename StrideType>
|
||||||
class Map<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType>
|
class Map<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType>
|
||||||
: public SparseMapBase<Map<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType> >
|
: public SparseMapBase<Map<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType> >
|
||||||
|
#else
|
||||||
|
template<typename SparseMatrixType>
|
||||||
|
class Map<SparseMatrixType>
|
||||||
|
: public SparseMapBase<Derived,WriteAccessors>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef SparseMapBase<Map> Base;
|
typedef SparseMapBase<Map> Base;
|
||||||
@ -196,6 +229,12 @@ class Map<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType>
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/** Constructs a read-write Map to a sparse matrix of size \a rows x \a cols, containing \a nnz non-zero coefficients,
|
||||||
|
* stored as a sparse format as defined by the pointers \a outerIndexPtr, \a innerIndexPtr, and \a valuePtr.
|
||||||
|
* If the optional parameter \a innerNonZerosPtr is the null pointer, then a standard compressed format is assumed.
|
||||||
|
*
|
||||||
|
* More details on the expected storage schemes are given in the \ref TutorialSparse "manual pages".
|
||||||
|
*/
|
||||||
inline Map(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr,
|
inline Map(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr,
|
||||||
StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZerosPtr = 0)
|
StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZerosPtr = 0)
|
||||||
: Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZerosPtr)
|
: Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZerosPtr)
|
||||||
|
@ -108,20 +108,25 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup Sparse_Module
|
* \ingroup SparseCore_Module
|
||||||
*
|
*
|
||||||
* \brief A sparse matrix expression referencing an existing sparse expression
|
* \brief A sparse matrix expression referencing an existing sparse expression
|
||||||
*
|
*
|
||||||
* \tparam PlainObjectType the equivalent sparse matrix type of the referenced data
|
* \tparam SparseMatrixType the equivalent sparse matrix type of the referenced data, it must be a template instance of class SparseMatrix.
|
||||||
* \tparam Options specifies whether the a standard compressed format is required \c Options is \c #StandardCompressedFormat, or \c 0.
|
* \tparam Options specifies whether the a standard compressed format is required \c Options is \c #StandardCompressedFormat, or \c 0.
|
||||||
* The default is \c 0.
|
* The default is \c 0.
|
||||||
* \tparam StrideType Only used for dense Ref
|
|
||||||
*
|
*
|
||||||
* \sa class Ref
|
* \sa class Ref
|
||||||
*/
|
*/
|
||||||
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename MatScalar, int MatOptions, typename MatIndex, int Options, typename StrideType>
|
template<typename MatScalar, int MatOptions, typename MatIndex, int Options, typename StrideType>
|
||||||
class Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType >
|
class Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType >
|
||||||
: public internal::SparseRefBase<Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType > >
|
: public internal::SparseRefBase<Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType > >
|
||||||
|
#else
|
||||||
|
template<typename SparseMatrixType, int Options>
|
||||||
|
class Ref<SparseMatrixType, Options>
|
||||||
|
: public SparseMapBase<Derived,WriteAccessors> // yes, that's weird to use Derived here, but that works!
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
typedef SparseMatrix<MatScalar,MatOptions,MatIndex> PlainObjectType;
|
typedef SparseMatrix<MatScalar,MatOptions,MatIndex> PlainObjectType;
|
||||||
typedef internal::traits<Ref> Traits;
|
typedef internal::traits<Ref> Traits;
|
||||||
@ -155,6 +160,7 @@ class Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType >
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(const SparseCompressedBase<Derived>& expr)
|
inline Ref(const SparseCompressedBase<Derived>& expr)
|
||||||
#else
|
#else
|
||||||
|
/** Implicit constructor from any sparse expression (2D matrix or 1D vector) */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(SparseCompressedBase<Derived>& expr)
|
inline Ref(SparseCompressedBase<Derived>& expr)
|
||||||
#endif
|
#endif
|
||||||
@ -225,19 +231,23 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup Sparse_Module
|
* \ingroup SparseCore_Module
|
||||||
*
|
*
|
||||||
* \brief A sparse vector expression referencing an existing sparse vector expression
|
* \brief A sparse vector expression referencing an existing sparse vector expression
|
||||||
*
|
*
|
||||||
* \tparam PlainObjectType the equivalent sparse matrix type of the referenced data
|
* \tparam SparseVectorType the equivalent sparse vector type of the referenced data, it must be a template instance of class SparseVector.
|
||||||
* \tparam Options Not used for SparseVector.
|
|
||||||
* \tparam StrideType Only used for dense Ref
|
|
||||||
*
|
*
|
||||||
* \sa class Ref
|
* \sa class Ref
|
||||||
*/
|
*/
|
||||||
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
template<typename MatScalar, int MatOptions, typename MatIndex, int Options, typename StrideType>
|
template<typename MatScalar, int MatOptions, typename MatIndex, int Options, typename StrideType>
|
||||||
class Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType >
|
class Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType >
|
||||||
: public internal::SparseRefBase<Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType > >
|
: public internal::SparseRefBase<Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType > >
|
||||||
|
#else
|
||||||
|
template<typename SparseVectorType>
|
||||||
|
class Ref<SparseVectorType>
|
||||||
|
: public SparseMapBase<Derived,WriteAccessors>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
typedef SparseVector<MatScalar,MatOptions,MatIndex> PlainObjectType;
|
typedef SparseVector<MatScalar,MatOptions,MatIndex> PlainObjectType;
|
||||||
typedef internal::traits<Ref> Traits;
|
typedef internal::traits<Ref> Traits;
|
||||||
@ -259,6 +269,7 @@ class Ref<SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType >
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(const SparseCompressedBase<Derived>& expr)
|
inline Ref(const SparseCompressedBase<Derived>& expr)
|
||||||
#else
|
#else
|
||||||
|
/** Implicit constructor from any 1D sparse vector expression */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(SparseCompressedBase<Derived>& expr)
|
inline Ref(SparseCompressedBase<Derived>& expr)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user