ViennaCL - The Vienna Computing Library  1.2.0
sparse_vector.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_DETAIL_SPAI_SPARSE_VECTOR_HPP
2 #define VIENNACL_LINALG_DETAIL_SPAI_SPARSE_VECTOR_HPP
3 
4 /* =========================================================================
5  Copyright (c) 2010-2011, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8 
9  -----------------
10  ViennaCL - The Vienna Computing Library
11  -----------------
12 
13  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
14 
15  (A list of authors and contributors can be found in the PDF manual)
16 
17  License: MIT (X11), see file LICENSE in the base directory
18 ============================================================================= */
19 
26 #include <utility>
27 #include <iostream>
28 #include <fstream>
29 #include <string>
30 #include <algorithm>
31 #include <vector>
32 #include <math.h>
33 #include <map>
34 //local includes
35 //#include <omp.h>
36 
37 
38 namespace viennacl
39 {
40  namespace linalg
41  {
42  namespace detail
43  {
44  namespace spai
45  {
46 
50  template <typename ScalarType>
52  public:
53  typedef typename std::map<unsigned int, ScalarType>::iterator iterator;
54  typedef typename std::map<unsigned int, ScalarType>::const_iterator const_iterator;
56  }
57 
61  //getter
62  ScalarType& operator[] (const unsigned int ind){
63  return _v[ind];
64 
65  }
66 
67  void clear(){
68  _v.clear();
69  }
70 
71  const_iterator find(const unsigned int var) const{
72  return _v.find(var);
73  }
74 
75  iterator find(const unsigned int var){
76  return _v.find(var);
77  }
78 
80  return _v.begin();
81  }
82 
84  return _v.end();
85  }
86 
87 
89  return _v.begin();
90  }
91 
93  return _v.end();
94  }
95 
96 
97  private:
98  unsigned int _size;
99  std::map<unsigned int, ScalarType> _v;
100  };
101  }
102  }
103  }
104 }
105 
106 #endif