| 90 | |
| 91 | template<typename _Scalar, int _Options, typename _Index> |
| 92 | class SparseMatrix |
| 93 | : public SparseCompressedBase<SparseMatrix<_Scalar, _Options, _Index> > |
| 94 | { |
| 95 | typedef SparseCompressedBase<SparseMatrix> Base; |
| 96 | using Base::convert_index; |
| 97 | public: |
| 98 | using Base::isCompressed; |
| 99 | using Base::nonZeros; |
| 100 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix) |
| 101 | using Base::operator+=; |
| 102 | using Base::operator-=; |
| 103 | |
| 104 | typedef MappedSparseMatrix<Scalar,Flags> Map; |
| 105 | typedef Diagonal<SparseMatrix> DiagonalReturnType; |
| 106 | typedef Diagonal<const SparseMatrix> ConstDiagonalReturnType; |
| 107 | typedef typename Base::InnerIterator InnerIterator; |
| 108 | typedef typename Base::ReverseInnerIterator ReverseInnerIterator; |
| 109 | |
| 110 | |
| 111 | using Base::IsRowMajor; |
| 112 | typedef internal::CompressedStorage<Scalar,StorageIndex> Storage; |
| 113 | enum { |
| 114 | Options = _Options |
| 115 | }; |
| 116 | |
| 117 | typedef typename Base::IndexVector IndexVector; |
| 118 | typedef typename Base::ScalarVector ScalarVector; |
| 119 | protected: |
| 120 | typedef SparseMatrix<Scalar,(Flags&~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix; |
| 121 | |
| 122 | Index m_outerSize; |
| 123 | Index m_innerSize; |
| 124 | StorageIndex* m_outerIndex; |
| 125 | StorageIndex* m_innerNonZeros; // optional, if null then the data is compressed |
| 126 | Storage m_data; |
| 127 | |
| 128 | public: |
| 129 | |
| 130 | /** \returns the number of rows of the matrix */ |
| 131 | inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; } |
| 132 | /** \returns the number of columns of the matrix */ |
| 133 | inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; } |
| 134 | |
| 135 | /** \returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) */ |
| 136 | inline Index innerSize() const { return m_innerSize; } |
| 137 | /** \returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) */ |
| 138 | inline Index outerSize() const { return m_outerSize; } |
| 139 | |
| 140 | /** \returns a const pointer to the array of values. |
| 141 | * This function is aimed at interoperability with other libraries. |
| 142 | * \sa innerIndexPtr(), outerIndexPtr() */ |
| 143 | inline const Scalar* valuePtr() const { return &m_data.value(0); } |
| 144 | /** \returns a non-const pointer to the array of values. |
| 145 | * This function is aimed at interoperability with other libraries. |
| 146 | * \sa innerIndexPtr(), outerIndexPtr() */ |
| 147 | inline Scalar* valuePtr() { return &m_data.value(0); } |
| 148 | |
| 149 | /** \returns a const pointer to the array of inner indices. |
nothing calls this directly
no test coverage detected