• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

/data/development/ViennaCL/dev/viennacl/linalg/detail/spai/sparse_vector.hpp

Go to the documentation of this file.
00001 #ifndef VIENNACL_LINALG_DETAIL_SPAI_SPARSE_VECTOR_HPP
00002 #define VIENNACL_LINALG_DETAIL_SPAI_SPARSE_VECTOR_HPP
00003 
00004 /* =========================================================================
00005    Copyright (c) 2010-2011, Institute for Microelectronics,
00006                             Institute for Analysis and Scientific Computing,
00007                             TU Wien.
00008 
00009                             -----------------
00010                   ViennaCL - The Vienna Computing Library
00011                             -----------------
00012 
00013    Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at
00014                
00015    (A list of authors and contributors can be found in the PDF manual)
00016 
00017    License:         MIT (X11), see file LICENSE in the base directory
00018 ============================================================================= */
00019 
00026 #include <utility>
00027 #include <iostream>
00028 #include <fstream>
00029 #include <string>
00030 #include <algorithm>
00031 #include <vector>
00032 #include <math.h>
00033 #include <map>
00034 //local includes
00035 //#include <omp.h>
00036 
00037 
00038 namespace viennacl
00039 {
00040   namespace linalg
00041   {
00042     namespace detail
00043     {
00044       namespace spai
00045       {
00046         
00050         template <typename ScalarType>
00051         class sparse_vector{
00052         public:
00053             typedef typename std::map<unsigned int, ScalarType>::iterator iterator;
00054             typedef typename std::map<unsigned int, ScalarType>::const_iterator const_iterator;
00055             sparse_vector(){
00056             }
00057             
00061             //getter
00062             ScalarType& operator[] (const unsigned int ind){
00063                 return _v[ind];
00064                 
00065             }
00066             
00067             void clear(){
00068                 _v.clear();
00069             }
00070             
00071             const_iterator find(const unsigned int var) const{
00072                 return _v.find(var);
00073             }
00074             
00075             iterator find(const unsigned int var){
00076                 return _v.find(var);
00077             }
00078             
00079             const_iterator begin() const{
00080                 return _v.begin();
00081             }
00082             
00083             const_iterator end() const{
00084                 return _v.end();
00085             }
00086             
00087             
00088             iterator begin(){
00089                 return _v.begin();
00090             }
00091             
00092             iterator end(){
00093                 return _v.end();
00094             }
00095             
00096             
00097         private:
00098             unsigned int _size;
00099             std::map<unsigned int, ScalarType> _v;
00100         };
00101       }
00102     }
00103   }
00104 }
00105 
00106 #endif

Generated on Fri Dec 30 2011 23:20:43 for ViennaCL - The Vienna Computing Library by  doxygen 1.7.1