ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
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-2015, 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 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 namespace traits
42 {
43 
45 template<typename MatrixType, typename NumericT>
46 void fill(MatrixType & matrix, vcl_size_t row_index, vcl_size_t col_index, NumericT value)
47 {
48  matrix(row_index, col_index) = value;
49 }
50 
51 #ifdef VIENNACL_WITH_EIGEN
52 
53 template<typename T, int options, typename NumericT>
54 inline void fill(Eigen::SparseMatrix<T, options> & m,
55  vcl_size_t row_index,
56  vcl_size_t col_index,
57  NumericT value
58  )
59 {
60  m.insert(row_index, col_index) = value;
61 }
62 #endif
63 
64 } //namespace traits
65 } //namespace viennacl
66 
67 
68 #endif
void fill(MatrixType &matrix, vcl_size_t row_index, vcl_size_t col_index, NumericT value)
Generic filler routine for setting an entry of a matrix to a particular value.
Definition: fill.hpp:46
This file provides the forward declarations for the main types used within ViennaCL.
A dense matrix class.
Definition: forwards.h:375
float NumericT
Definition: bisect.cpp:40
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:34
std::size_t vcl_size_t
Definition: forwards.h:75
A collection of compile time type deductions.