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

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

Go to the documentation of this file.
00001 #ifndef VIENNACL_TRAITS_CLEAR_HPP_
00002 #define VIENNACL_TRAITS_CLEAR_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 
00029 #ifdef VIENNACL_HAVE_UBLAS  
00030 #include <boost/numeric/ublas/matrix_sparse.hpp>
00031 #include <boost/numeric/ublas/matrix.hpp>
00032 #endif
00033 
00034 #ifdef VIENNACL_HAVE_EIGEN  
00035 #include <Eigen/Core>
00036 #include <Eigen/Sparse>
00037 #endif
00038 
00039 #ifdef VIENNACL_HAVE_MTL4
00040 #include <boost/numeric/mtl/mtl.hpp>
00041 #endif
00042 
00043 #include "viennacl/traits/size.hpp"
00044 
00045 #include <vector>
00046 #include <map>
00047 
00048 namespace viennacl
00049 {
00050   namespace traits
00051   {
00052     
00053     //clear:
00054     template <typename VectorType>
00055     void clear(VectorType & vec)
00056     {
00057       typedef typename viennacl::result_of::size_type<VectorType>::type  size_type;
00058       
00059       for (size_type i=0; i<viennacl::traits::size(vec); ++i)
00060         vec[i] = 0;  //TODO: Quantity access can also be wrapped...
00061     }
00062 
00063     template <typename ScalarType, unsigned int ALIGNMENT>
00064     void clear(viennacl::vector<ScalarType, ALIGNMENT> & vec)
00065     {
00066       vec.clear();
00067     }
00068   } //namespace traits
00069 } //namespace viennacl
00070     
00071 
00072 #endif

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