LAMA
/home/brandes/workspace/LAMA/src/lama/openmp/OpenMPDenseUtils.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_OPENMP_DENSE_UTILS_HPP_
00034 #define LAMA_OPENMP_DENSE_UTILS_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // others
00040 #include <lama/LAMATypes.hpp>
00041 
00042 // assert
00043 #include <lama/exception/LAMAAssert.hpp>
00044 
00045 // logging
00046 #include <logging/logging.hpp>
00047 
00048 #include <cmath>
00049 
00050 namespace lama
00051 {
00052 
00056 class LAMA_DLL_IMPORTEXPORT OpenMPDenseUtils
00057 {
00058 public:
00059 
00062     template<typename DenseValueType>
00063     static void getCSRSizes( IndexType csrSizes[],
00064                              bool diagonalFlag,
00065                              const IndexType numRows,
00066                              const IndexType numColumns,
00067                              const DenseValueType denseValues[],
00068                              const DenseValueType eps );
00069 
00072     template<typename DenseValueType, typename CSRValueType>
00073     static void getCSRValues( IndexType csrJA[],
00074                               CSRValueType csrValues[],
00075                               const IndexType csrIA[],
00076                               const bool diagonalFlag,
00077                               const IndexType numRows,
00078                               const IndexType numColumns,
00079                               const DenseValueType denseValues[],
00080                               const DenseValueType eps );
00081 
00084     template<typename DenseValueType1, typename DenseValueType2>
00085     static void copyDenseValues( DenseValueType1 newValues[],
00086                                  const IndexType numRows,
00087                                  const IndexType numColumns,
00088                                  const DenseValueType2 oldValues[] );
00089 
00092     template<typename DenseValueType, typename CSRValueType>
00093     static void setCSRValues( DenseValueType denseValues[],
00094                               const IndexType numRows,
00095                               const IndexType numColumns,
00096                               const IndexType csrIA[],
00097                               const IndexType csrJA[],
00098                               const CSRValueType csrValues[] );
00099 
00102     template<typename DiagonalValueType, typename DenseValueType>
00103     static void getDiagonal( DiagonalValueType diagonalValues[],
00104                              const IndexType numDiagonalValues,
00105                              const DenseValueType denseValues[],
00106                              const IndexType numRows,
00107                              const IndexType numColumns );
00108 
00111     template<typename DenseValueType, typename DiagonalValueType>
00112     static void setDiagonal( DenseValueType denseValues[],
00113                              const IndexType numRows,
00114                              const IndexType numColumns,
00115                              const DiagonalValueType diagonalValues[],
00116                              const IndexType numDiagonalValues );
00117 
00120     template<typename DenseValueType>
00121     static void scaleValue( DenseValueType denseValues[],
00122                             const IndexType numRows,
00123                             const IndexType numColumns,
00124                             const DenseValueType val );
00125 
00128     template<typename DenseValueType>
00129     static void setDiagonalValue( DenseValueType denseValues[],
00130                                   const IndexType numRows,
00131                                   const IndexType numColumns,
00132                                   const DenseValueType val );
00133 
00136     static void setInterface( struct DenseUtilsInterface& DenseUtils );
00137 
00138 private:
00139 
00140     static inline IndexType denseindex( const IndexType i, const IndexType j,
00141                                         const IndexType /* numRows */, const IndexType numColumns )
00142     {
00143         return i * numColumns + j;
00144     }
00145 
00146     LAMA_LOG_DECL_STATIC_LOGGER( logger );
00147 
00148 };
00149 
00150 /* --------------------------------------------------------------------------- */
00151 
00152 }  // namespace lama
00153 
00154 #endif  //  LAMA_DENSE_STORAGE_UTILS_HPP_