ViennaCL - The Vienna Computing Library  1.5.2
fill.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_TRAITS_FILL_HPP_
2 #define VIENNACL_TRAITS_FILL_HPP_
3 
4 /* =========================================================================
5  Copyright (c) 2010-2014, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8  Portions of this software are copyright by UChicago Argonne, LLC.
9 
10  -----------------
11  ViennaCL - The Vienna Computing Library
12  -----------------
13 
14  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15 
16  (A list of authors and contributors can be found in the PDF manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
25 #include <string>
26 #include <fstream>
27 #include <sstream>
28 #include "viennacl/forwards.h"
30 
31 #ifdef VIENNACL_WITH_EIGEN
32 #include <Eigen/Core>
33 #include <Eigen/Sparse>
34 #endif
35 
36 #include <vector>
37 #include <map>
38 
39 namespace viennacl
40 {
41 
42  namespace traits
43  {
44 
46  template <typename MatrixType, typename SCALARTYPE>
47  void fill(MatrixType & matrix, vcl_size_t row_index, vcl_size_t col_index, SCALARTYPE value)
48  {
49  matrix(row_index, col_index) = value;
50  }
51 
52  #ifdef VIENNACL_WITH_EIGEN
53 
54  template <typename T, int options, typename SCALARTYPE>
55  inline void fill(Eigen::SparseMatrix<T, options> & m,
56  vcl_size_t row_index,
57  vcl_size_t col_index,
58  SCALARTYPE value
59  )
60  {
61  m.insert(row_index, col_index) = value;
62  }
63  #endif
64 
65 
66  } //namespace traits
67 } //namespace viennacl
68 
69 
70 #endif
std::size_t vcl_size_t
Definition: forwards.h:58
A dense matrix class.
Definition: forwards.h:293
This file provides the forward declarations for the main types used within ViennaCL.
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
void fill(MatrixType &matrix, vcl_size_t row_index, vcl_size_t col_index, SCALARTYPE value)
Generic filler routine for setting an entry of a matrix to a particular value.
Definition: fill.hpp:47
A collection of compile time type deductions.