From 99bef0957b218a493d8fc1649cf052677893f201 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 28 Jun 2013 22:56:26 +0200 Subject: [PATCH] Add missing sparse matrix constructor from sparse self-adjoint views, and add documentation for sparse time selfadjoint matrix --- Eigen/src/SparseCore/SparseMatrix.h | 9 +++++++++ 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 + inline SparseMatrix(const SparseSelfAdjointView& 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 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 SparseSparseProduct::Flags&RowMajorBit) ? RowMajor : ColMajor,Index>, OtherDerived> operator*(const SparseMatrixBase& rhs) const @@ -77,7 +81,11 @@ template class SparseSelfAdjointView return SparseSparseProduct::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 friend SparseSparseProduct::Flags&RowMajorBit) ? RowMajor : ColMajor,Index> > operator*(const SparseMatrixBase& lhs, const SparseSelfAdjointView& rhs)