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

/data/development/ViennaCL/dev/viennacl/traits/fill.hpp

Go to the documentation of this file.
00001 #ifndef VIENNACL_TRAITS_FILL_HPP_
00002 #define VIENNACL_TRAITS_FILL_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 
00024 #include <string>
00025 #include <fstream>
00026 #include <sstream>
00027 #include "viennacl/forwards.h"
00028 #include "viennacl/meta/result_of.hpp"
00029 
00030 #ifdef VIENNACL_HAVE_EIGEN  
00031 #include <Eigen/Core>
00032 #include <Eigen/Sparse>
00033 #endif
00034 
00035 #include <vector>
00036 #include <map>
00037 
00038 namespace viennacl
00039 {
00040 
00041   namespace traits
00042   {
00043     //
00044     // Resize: Change the size of vectors and matrices
00045     //
00046     template <typename MatrixType, typename SCALARTYPE>
00047     void fill(MatrixType & matrix, std::size_t row_index, std::size_t col_index, SCALARTYPE value)
00048     {
00049       matrix(row_index, col_index) = value; 
00050     }
00051     
00052     #ifdef VIENNACL_HAVE_EIGEN
00053     template <typename T, int options, typename SCALARTYPE>
00054     inline void fill(Eigen::SparseMatrix<T, options> & m,
00055                      std::size_t row_index,
00056                      std::size_t col_index,
00057                      SCALARTYPE value
00058                     )
00059     {
00060       m.fill(row_index, col_index) = value;
00061     }    
00062     #endif
00063 
00064  
00065   } //namespace traits
00066 } //namespace viennacl
00067     
00068 
00069 #endif

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