diff --git a/Eigen/SparseCore b/Eigen/SparseCore index 76966c4c4..b2db46ba8 100644 --- a/Eigen/SparseCore +++ b/Eigen/SparseCore @@ -41,7 +41,6 @@ #include "src/SparseCore/SparseCompressedBase.h" #include "src/SparseCore/SparseMatrix.h" #include "src/SparseCore/SparseMap.h" -#include "src/SparseCore/MappedSparseMatrix.h" #include "src/SparseCore/SparseVector.h" #include "src/SparseCore/SparseRef.h" #include "src/SparseCore/SparseCwiseUnaryOp.h" diff --git a/Eigen/src/CholmodSupport/CholmodSupport.h b/Eigen/src/CholmodSupport/CholmodSupport.h index a56ebfd68..d33af5487 100644 --- a/Eigen/src/CholmodSupport/CholmodSupport.h +++ b/Eigen/src/CholmodSupport/CholmodSupport.h @@ -157,9 +157,9 @@ cholmod_dense viewAsCholmod(MatrixBase& mat) /** Returns a view of the Cholmod sparse matrix \a cm as an Eigen sparse matrix. * The data are not copied but shared. */ template -MappedSparseMatrix viewAsEigen(cholmod_sparse& cm) +Map > viewAsEigen(cholmod_sparse& cm) { - return MappedSparseMatrix + return Map > (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); } diff --git a/Eigen/src/SparseCore/MappedSparseMatrix.h b/Eigen/src/SparseCore/MappedSparseMatrix.h deleted file mode 100644 index efb7b490d..000000000 --- a/Eigen/src/SparseCore/MappedSparseMatrix.h +++ /dev/null @@ -1,69 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008-2014 Gael Guennebaud -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef EIGEN_MAPPED_SPARSEMATRIX_H -#define EIGEN_MAPPED_SPARSEMATRIX_H - -#include "./InternalHeaderCheck.h" - -namespace Eigen { - -/** \deprecated Use Map > - * \class MappedSparseMatrix - * - * \brief Sparse matrix - * - * \param Scalar_ the scalar type, i.e. the type of the coefficients - * - * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. - * - */ -namespace internal { -template -struct traits > : traits > -{}; -} // end namespace internal - -template -class MappedSparseMatrix - : public Map > -{ - typedef Map > Base; - - public: - - typedef typename Base::StorageIndex StorageIndex; - typedef typename Base::Scalar Scalar; - - inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) - : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) - {} - - /** Empty destructor */ - inline ~MappedSparseMatrix() {} -}; - -namespace internal { - -template -struct evaluator > - : evaluator > > -{ - typedef MappedSparseMatrix XprType; - typedef evaluator > Base; - - evaluator() : Base() {} - explicit evaluator(const XprType &mat) : Base(mat) {} -}; - -} - -} // end namespace Eigen - -#endif // EIGEN_MAPPED_SPARSEMATRIX_H diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index e905ff5be..9cb5d2110 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -110,7 +110,7 @@ class SparseMatrix using Base::operator+=; using Base::operator-=; - typedef MappedSparseMatrix Map; + typedef Eigen::Map> Map; typedef Diagonal DiagonalReturnType; typedef Diagonal ConstDiagonalReturnType; typedef typename Base::InnerIterator InnerIterator; diff --git a/Eigen/src/SparseCore/SparseRef.h b/Eigen/src/SparseCore/SparseRef.h index 166b17e8b..26403ac4d 100644 --- a/Eigen/src/SparseCore/SparseRef.h +++ b/Eigen/src/SparseCore/SparseRef.h @@ -135,7 +135,7 @@ class Ref template inline Ref(const SparseMatrix& expr); template - inline Ref(const MappedSparseMatrix& expr); + inline Ref(const Map>& expr); public: typedef internal::SparseRefBase Base; @@ -150,15 +150,15 @@ class Ref eigen_assert( ((Options & int(StandardCompressedFormat))==0) || (expr.isCompressed()) ); Base::construct(expr.derived()); } - + template - inline Ref(MappedSparseMatrix& expr) + inline Ref(Map >& expr) { EIGEN_STATIC_ASSERT(bool(Traits::template match >::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); eigen_assert( ((Options & int(StandardCompressedFormat))==0) || (expr.isCompressed()) ); Base::construct(expr.derived()); } - + template inline Ref(const SparseCompressedBase& expr) #else diff --git a/Eigen/src/SparseCore/SparseUtil.h b/Eigen/src/SparseCore/SparseUtil.h index 3127c7ec5..19b59d100 100644 --- a/Eigen/src/SparseCore/SparseUtil.h +++ b/Eigen/src/SparseCore/SparseUtil.h @@ -53,7 +53,6 @@ const int RandomAccessPattern = 0x8 | OuterRandomAccessPattern | InnerRand template class SparseMatrix; template class SparseVector; -template class MappedSparseMatrix; template class SparseSelfAdjointView; template class SparseDiagonalProduct; diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index cdc2b73aa..1516d26b0 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -252,9 +252,9 @@ class SparseLU : public SparseSolverBase >, * y = b; matrixU().solveInPlace(y); * \endcode */ - SparseLUMatrixUReturnType > matrixU() const + SparseLUMatrixUReturnType > > matrixU() const { - return SparseLUMatrixUReturnType >(m_Lstore, m_Ustore); + return SparseLUMatrixUReturnType > >(m_Lstore, m_Ustore); } /** @@ -476,7 +476,7 @@ class SparseLU : public SparseSolverBase >, std::string m_lastError; NCMatrix m_mat; // The input (permuted ) matrix SCMatrix m_Lstore; // The lower triangular matrix (supernodal) - MappedSparseMatrix m_Ustore; // The upper triangular matrix + Map> m_Ustore; // The upper triangular matrix PermutationType m_perm_c; // Column permutation PermutationType m_perm_r ; // Row permutation IndexVector m_etree; // Column elimination tree @@ -791,7 +791,7 @@ void SparseLU::factorize(const MatrixType& matrix) // Create supernode matrix L m_Lstore.setInfos(m, n, m_glu.lusup, m_glu.xlusup, m_glu.lsub, m_glu.xlsub, m_glu.supno, m_glu.xsup); // Create the column major upper sparse matrix U; - new (&m_Ustore) MappedSparseMatrix ( m, n, m_nnzU, m_glu.xusub.data(), m_glu.usub.data(), m_glu.ucol.data() ); + new (&m_Ustore) Map> ( m, n, m_nnzU, m_glu.xusub.data(), m_glu.usub.data(), m_glu.ucol.data() ); m_info = Success; m_factorizationIsOk = true; diff --git a/Eigen/src/SuperLUSupport/SuperLUSupport.h b/Eigen/src/SuperLUSupport/SuperLUSupport.h index f9a9a43eb..4bac22d4b 100644 --- a/Eigen/src/SuperLUSupport/SuperLUSupport.h +++ b/Eigen/src/SuperLUSupport/SuperLUSupport.h @@ -297,14 +297,14 @@ SluMatrix asSluMatrix(MatrixType& mat) /** View a Super LU matrix as an Eigen expression */ template -MappedSparseMatrix map_superlu(SluMatrix& sluMat) +Map > map_superlu(SluMatrix& sluMat) { eigen_assert(((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR) || ((Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC)); Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow; - return MappedSparseMatrix( + return Map >( sluMat.nrow, sluMat.ncol, sluMat.storage.outerInd[outerSize], sluMat.storage.outerInd, sluMat.storage.innerInd, reinterpret_cast(sluMat.storage.values) ); } diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index 9453111b7..93c30a5ed 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp @@ -431,12 +431,6 @@ template void sparse_basic(const SparseMatrixType& re VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); } - { - MappedSparseMatrix mapMat2(m2.rows(), m2.cols(), m2.nonZeros(), m2.outerIndexPtr(), m2.innerIndexPtr(), m2.valuePtr(), m2.innerNonZeroPtr()); - MappedSparseMatrix mapMat3(m3.rows(), m3.cols(), m3.nonZeros(), m3.outerIndexPtr(), m3.innerIndexPtr(), m3.valuePtr(), m3.innerNonZeroPtr()); - VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); - VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); - } Index i = internal::random(0,rows-1); Index j = internal::random(0,cols-1); diff --git a/test/sparse_solver.h b/test/sparse_solver.h index 58927944b..2b3b403ce 100644 --- a/test/sparse_solver.h +++ b/test/sparse_solver.h @@ -88,7 +88,7 @@ void check_sparse_solving(Solver& solver, const typename Solver::MatrixType& A, x.setZero(); // test with Map - MappedSparseMatrix Am(A.rows(), A.cols(), A.nonZeros(), const_cast(A.outerIndexPtr()), const_cast(A.innerIndexPtr()), const_cast(A.valuePtr())); + Map> Am(A.rows(), A.cols(), A.nonZeros(), const_cast(A.outerIndexPtr()), const_cast(A.innerIndexPtr()), const_cast(A.valuePtr())); solver.compute(Am); VERIFY(solver.info() == Success && "factorization failed when using Map"); DenseRhs dx(refX); @@ -217,7 +217,7 @@ void check_sparse_solving(Eigen::SparseLU >& solver, x1.setZero(); // test with Map - MappedSparseMatrix Am(A.rows(), A.cols(), A.nonZeros(), const_cast(A.outerIndexPtr()), const_cast(A.innerIndexPtr()), const_cast(A.valuePtr())); + Map > Am(A.rows(), A.cols(), A.nonZeros(), const_cast(A.outerIndexPtr()), const_cast(A.innerIndexPtr()), const_cast(A.valuePtr())); solver.compute(Am); VERIFY(solver.info() == Success && "factorization failed when using Map"); DenseRhs dx(refX1); diff --git a/test/sparse_solvers.cpp b/test/sparse_solvers.cpp index 3b7cd7788..1f4948ae2 100644 --- a/test/sparse_solvers.cpp +++ b/test/sparse_solvers.cpp @@ -62,7 +62,7 @@ template void sparse_solvers(int rows, int cols) { SparseMatrix cm2(m2); //Index rows, Index cols, Index nnz, Index* outerIndexPtr, Index* innerIndexPtr, Scalar* valuePtr - MappedSparseMatrix mm2(rows, cols, cm2.nonZeros(), cm2.outerIndexPtr(), cm2.innerIndexPtr(), cm2.valuePtr()); + Map > mm2(rows, cols, cm2.nonZeros(), cm2.outerIndexPtr(), cm2.innerIndexPtr(), cm2.valuePtr()); VERIFY_IS_APPROX(refMat2.conjugate().template triangularView().solve(vec2), mm2.conjugate().template triangularView().solve(vec3)); }