| 121 | |
| 122 | template<typename Scalar_, int Options_, typename StorageIndex_> |
| 123 | class SparseMatrix |
| 124 | : public SparseCompressedBase<SparseMatrix<Scalar_, Options_, StorageIndex_> > |
| 125 | { |
| 126 | typedef SparseCompressedBase<SparseMatrix> Base; |
| 127 | using Base::convert_index; |
| 128 | friend class SparseVector<Scalar_,0,StorageIndex_>; |
| 129 | template<typename, typename, typename, typename, typename> |
| 130 | friend struct internal::Assignment; |
| 131 | public: |
| 132 | using Base::isCompressed; |
| 133 | using Base::nonZeros; |
| 134 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix) |
| 135 | using Base::operator+=; |
| 136 | using Base::operator-=; |
| 137 | |
| 138 | typedef Eigen::Map<SparseMatrix<Scalar,Options_,StorageIndex>> Map; |
| 139 | typedef Diagonal<SparseMatrix> DiagonalReturnType; |
| 140 | typedef Diagonal<const SparseMatrix> ConstDiagonalReturnType; |
| 141 | typedef typename Base::InnerIterator InnerIterator; |
| 142 | typedef typename Base::ReverseInnerIterator ReverseInnerIterator; |
| 143 | |
| 144 | |
| 145 | using Base::IsRowMajor; |
| 146 | typedef internal::CompressedStorage<Scalar,StorageIndex> Storage; |
| 147 | enum { |
| 148 | Options = Options_ |
| 149 | }; |
| 150 | |
| 151 | typedef typename Base::IndexVector IndexVector; |
| 152 | typedef typename Base::ScalarVector ScalarVector; |
| 153 | protected: |
| 154 | typedef SparseMatrix<Scalar, IsRowMajor ? ColMajor : RowMajor, StorageIndex> TransposedSparseMatrix; |
| 155 | |
| 156 | Index m_outerSize; |
| 157 | Index m_innerSize; |
| 158 | StorageIndex* m_outerIndex; |
| 159 | StorageIndex* m_innerNonZeros; // optional, if null then the data is compressed |
| 160 | Storage m_data; |
| 161 | |
| 162 | public: |
| 163 | |
| 164 | /** \returns the number of rows of the matrix */ |
| 165 | inline Index rows() const { return IsRowMajor ? m_outerSize : m_innerSize; } |
| 166 | /** \returns the number of columns of the matrix */ |
| 167 | inline Index cols() const { return IsRowMajor ? m_innerSize : m_outerSize; } |
| 168 | |
| 169 | /** \returns the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major) */ |
| 170 | inline Index innerSize() const { return m_innerSize; } |
| 171 | /** \returns the number of columns (resp. rows) of the matrix if the storage order column major (resp. row major) */ |
| 172 | inline Index outerSize() const { return m_outerSize; } |
| 173 | |
| 174 | /** \returns a const pointer to the array of values. |
| 175 | * This function is aimed at interoperability with other libraries. |
| 176 | * \sa innerIndexPtr(), outerIndexPtr() */ |
| 177 | inline const Scalar* valuePtr() const { return m_data.valuePtr(); } |
| 178 | /** \returns a non-const pointer to the array of values. |
| 179 | * This function is aimed at interoperability with other libraries. |
| 180 | * \sa innerIndexPtr(), outerIndexPtr() */ |
nothing calls this directly
no test coverage detected