MappedSparseMatrix.h 2.14 KB
Newer Older
LM's avatar
LM committed
1 2 3
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
4
// Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr>
LM's avatar
LM committed
5
//
Don Gagne's avatar
Don Gagne committed
6 7 8
// 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/.
LM's avatar
LM committed
9 10 11 12

#ifndef EIGEN_MAPPED_SPARSEMATRIX_H
#define EIGEN_MAPPED_SPARSEMATRIX_H

13
namespace Eigen {
Don Gagne's avatar
Don Gagne committed
14

15 16
/** \deprecated Use Map<SparseMatrix<> >
  * \class MappedSparseMatrix
LM's avatar
LM committed
17 18 19 20 21 22 23 24 25
  *
  * \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 {
26 27
template<typename _Scalar, int _Flags, typename _StorageIndex>
struct traits<MappedSparseMatrix<_Scalar, _Flags, _StorageIndex> > : traits<SparseMatrix<_Scalar, _Flags, _StorageIndex> >
LM's avatar
LM committed
28
{};
29
} // end namespace internal
LM's avatar
LM committed
30

31
template<typename _Scalar, int _Flags, typename _StorageIndex>
LM's avatar
LM committed
32
class MappedSparseMatrix
33
  : public Map<SparseMatrix<_Scalar, _Flags, _StorageIndex> >
LM's avatar
LM committed
34
{
35
    typedef Map<SparseMatrix<_Scalar, _Flags, _StorageIndex> > Base;
LM's avatar
LM committed
36 37

  public:
38
    
39 40
    typedef typename Base::StorageIndex StorageIndex;
    typedef typename Base::Scalar Scalar;
LM's avatar
LM committed
41

42 43
    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)
LM's avatar
LM committed
44 45 46 47 48 49
    {}

    /** Empty destructor */
    inline ~MappedSparseMatrix() {}
};

50
namespace internal {
LM's avatar
LM committed
51

52 53 54
template<typename _Scalar, int _Options, typename _StorageIndex>
struct evaluator<MappedSparseMatrix<_Scalar,_Options,_StorageIndex> >
  : evaluator<SparseCompressedBase<MappedSparseMatrix<_Scalar,_Options,_StorageIndex> > >
Don Gagne's avatar
Don Gagne committed
55
{
56 57 58 59 60
  typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType;
  typedef evaluator<SparseCompressedBase<XprType> > Base;
  
  evaluator() : Base() {}
  explicit evaluator(const XprType &mat) : Base(mat) {}
Don Gagne's avatar
Don Gagne committed
61 62
};

63 64
}

Don Gagne's avatar
Don Gagne committed
65 66
} // end namespace Eigen

LM's avatar
LM committed
67
#endif // EIGEN_MAPPED_SPARSEMATRIX_H