1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_MAPPED_SPARSEMATRIX_H
11#define EIGEN_MAPPED_SPARSEMATRIX_H
12
13namespace Eigen {
14
15/** \deprecated Use Map<SparseMatrix<> >
16  * \class MappedSparseMatrix
17  *
18  * \brief Sparse matrix
19  *
20  * \param _Scalar the scalar type, i.e. the type of the coefficients
21  *
22  * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme.
23  *
24  */
25namespace internal {
26template<typename _Scalar, int _Flags, typename _StorageIndex>
27struct traits<MappedSparseMatrix<_Scalar, _Flags, _StorageIndex> > : traits<SparseMatrix<_Scalar, _Flags, _StorageIndex> >
28{};
29} // end namespace internal
30
31template<typename _Scalar, int _Flags, typename _StorageIndex>
32class MappedSparseMatrix
33  : public Map<SparseMatrix<_Scalar, _Flags, _StorageIndex> >
34{
35    typedef Map<SparseMatrix<_Scalar, _Flags, _StorageIndex> > Base;
36
37  public:
38
39    typedef typename Base::StorageIndex StorageIndex;
40    typedef typename Base::Scalar Scalar;
41
42    inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0)
43      : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr)
44    {}
45
46    /** Empty destructor */
47    inline ~MappedSparseMatrix() {}
48};
49
50namespace internal {
51
52template<typename _Scalar, int _Options, typename _StorageIndex>
53struct evaluator<MappedSparseMatrix<_Scalar,_Options,_StorageIndex> >
54  : evaluator<SparseCompressedBase<MappedSparseMatrix<_Scalar,_Options,_StorageIndex> > >
55{
56  typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType;
57  typedef evaluator<SparseCompressedBase<XprType> > Base;
58
59  evaluator() : Base() {}
60  explicit evaluator(const XprType &mat) : Base(mat) {}
61};
62
63}
64
65} // end namespace Eigen
66
67#endif // EIGEN_MAPPED_SPARSEMATRIX_H
68