All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sparse_vector.hpp
Go to the documentation of this file.
#ifndef VIENNACL_LINALG_DETAIL_SPAI_SPARSE_VECTOR_HPP
#define VIENNACL_LINALG_DETAIL_SPAI_SPARSE_VECTOR_HPP
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#include <utility>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
namespace viennacl
{
namespace linalg
{
namespace detail
{
namespace spai
{
template<typename NumericT>
class sparse_vector
{
public:
typedef typename std::map<unsigned int, NumericT>::iterator iterator;
typedef typename std::map<unsigned int, NumericT>::const_iterator const_iterator;
sparse_vector() {}
//getter
NumericT & operator[] (unsigned int ind) { return v_[ind]; }
void clear() { v_.clear(); }
const_iterator find(unsigned int var) const { return v_.find(var); }
iterator find(unsigned int var) { return v_.find(var); }
const_iterator begin() const { return v_.begin(); }
iterator begin() { return v_.begin(); }
const_iterator end() const { return v_.end(); }
iterator end() { return v_.end(); }
private:
unsigned int size_;
std::map<unsigned int, NumericT> v_;
};
}
}
}
}
#endif
viennacl::linalg::detail::spai::sparse_vector::sparse_vector
sparse_vector()
Definition: sparse_vector.hpp:56
viennacl::linalg::detail::spai::sparse_vector::const_iterator
std::map< unsigned int, NumericT >::const_iterator const_iterator
Definition: sparse_vector.hpp:54
viennacl::linalg::detail::spai::sparse_vector::begin
iterator begin()
Definition: sparse_vector.hpp:71
viennacl::linalg::detail::spai::sparse_vector::end
iterator end()
Definition: sparse_vector.hpp:73
viennacl::linalg::detail::spai::sparse_vector::iterator
std::map< unsigned int, NumericT >::iterator iterator
Definition: sparse_vector.hpp:53
NumericT
float NumericT
Definition: bisect.cpp:40
viennacl::linalg::detail::spai::sparse_vector::operator[]
NumericT & operator[](unsigned int ind)
Set the index of the vector in the original matrix.
Definition: sparse_vector.hpp:63
viennacl::linalg::detail::spai::sparse_vector::begin
const_iterator begin() const
Definition: sparse_vector.hpp:70
viennacl::linalg::detail::spai::sparse_vector::find
iterator find(unsigned int var)
Definition: sparse_vector.hpp:68
viennacl::linalg::detail::spai::sparse_vector
Represents a sparse vector based on std::map<unsigned int, NumericT>
Definition: sparse_vector.hpp:50
viennacl::linalg::detail::spai::sparse_vector::clear
void clear()
Definition: sparse_vector.hpp:65
viennacl::linalg::detail::spai::sparse_vector::end
const_iterator end() const
Definition: sparse_vector.hpp:72
viennacl::linalg::detail::spai::sparse_vector::find
const_iterator find(unsigned int var) const
Definition: sparse_vector.hpp:67