diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-06-28 22:56:26 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-06-28 22:56:26 +0200 |
commit | 99bef0957b218a493d8fc1649cf052677893f201 (patch) | |
tree | 110c89e77f0cb6bc2e84588d7125569876450854 /Eigen/src | |
parent | 9f035c876a9d84f32b39bacba179e9b2a542b57c (diff) |
Add missing sparse matrix constructor from sparse self-adjoint views, and add documentation for sparse time selfadjoint matrix
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/SparseCore/SparseMatrix.h | 9 | ||||
-rw-r--r-- | Eigen/src/SparseCore/SparseSelfAdjointView.h | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index 5a3918e2d..2386dfecc 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -647,6 +647,15 @@ class SparseMatrix check_template_parameters(); *this = other.derived(); } + + /** Constructs a sparse matrix from the sparse selfadjoint view \a other */ + template<typename OtherDerived, unsigned int UpLo> + inline SparseMatrix(const SparseSelfAdjointView<OtherDerived, UpLo>& other) + : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) + { + check_template_parameters(); + *this = other; + } /** Copy constructor (it performs a deep copy) */ inline SparseMatrix(const SparseMatrix& other) diff --git a/Eigen/src/SparseCore/SparseSelfAdjointView.h b/Eigen/src/SparseCore/SparseSelfAdjointView.h index 1770f21e6..60fcf3f40 100644 --- a/Eigen/src/SparseCore/SparseSelfAdjointView.h +++ b/Eigen/src/SparseCore/SparseSelfAdjointView.h @@ -69,7 +69,11 @@ template<typename MatrixType, unsigned int UpLo> class SparseSelfAdjointView const _MatrixTypeNested& matrix() const { return m_matrix; } _MatrixTypeNested& matrix() { return m_matrix.const_cast_derived(); } - /** Sparse self-adjoint matrix times sparse matrix product */ + /** \returns an expression of the matrix product between a sparse self-adjoint matrix \c *this and a sparse matrix \a rhs. + * + * Note that there is no algorithmic advantage of performing such a product compared to a general sparse-sparse matrix product. + * Indeed, the SparseSelfadjointView operand is first copied into a temporary SparseMatrix before computing the product. + */ template<typename OtherDerived> SparseSparseProduct<SparseMatrix<Scalar, (internal::traits<OtherDerived>::Flags&RowMajorBit) ? RowMajor : ColMajor,Index>, OtherDerived> operator*(const SparseMatrixBase<OtherDerived>& rhs) const @@ -77,7 +81,11 @@ template<typename MatrixType, unsigned int UpLo> class SparseSelfAdjointView return SparseSparseProduct<SparseMatrix<Scalar, (internal::traits<OtherDerived>::Flags&RowMajorBit) ? RowMajor : ColMajor, Index>, OtherDerived>(*this, rhs.derived()); } - /**sparse matrix times Sparse self-adjoint matrix product */ + /** \returns an expression of the matrix product between a sparse matrix \a lhs and a sparse self-adjoint matrix \a rhs. + * + * Note that there is no algorithmic advantage of performing such a product compared to a general sparse-sparse matrix product. + * Indeed, the SparseSelfadjointView operand is first copied into a temporary SparseMatrix before computing the product. + */ template<typename OtherDerived> friend SparseSparseProduct<OtherDerived, SparseMatrix<Scalar, (internal::traits<OtherDerived>::Flags&RowMajorBit) ? RowMajor : ColMajor,Index> > operator*(const SparseMatrixBase<OtherDerived>& lhs, const SparseSelfAdjointView& rhs) |