7#ifndef KERNEL_LAFEM_ARCH_ROW_NORM_GENERIC_HPP 
    8#define KERNEL_LAFEM_ARCH_ROW_NORM_GENERIC_HPP 1 
   10#ifndef KERNEL_LAFEM_ARCH_ROW_NORM_HPP 
   11#error "Do not include this implementation-only header file directly!" 
   14#include <kernel/util/math.hpp> 
   22      template <
typename DT_, 
typename IT_>
 
   23      void RowNorm::csr_generic_norm2(DT_* row_norms, 
const DT_* 
const val, 
const IT_* 
const ,
 
   24        const IT_* 
const row_ptr, 
const Index rows)
 
   26        FEAT_PRAGMA_OMP(parallel 
for)
 
   27        for (
Index row = 0; row < rows; row++)
 
   29          Index end = row_ptr[row + 1];
 
   33          for (
Index col = row_ptr[row]; col < end; col++)
 
   43      template <
typename DT_, 
typename IT_>
 
   44      void RowNorm::csr_generic_norm2sqr(DT_* row_norms, 
const DT_* 
const val,
 
   45      const IT_* 
const , 
const IT_* 
const row_ptr, 
const Index rows)
 
   47        FEAT_PRAGMA_OMP(parallel 
for)
 
   48        for (
Index row = 0; row < rows; row++)
 
   50          Index end = row_ptr[row + 1];
 
   54          for (
Index col = row_ptr[row]; col < end; col++)
 
   59          row_norms[row] = norm;
 
   63      template <
typename DT_, 
typename IT_>
 
   64      void RowNorm::csr_generic_scaled_norm2sqr(DT_* row_norms, 
const DT_* 
const scal,
 
   65      const DT_* 
const val, 
const IT_* 
const , 
const IT_* 
const row_ptr, 
const Index rows)
 
   67        FEAT_PRAGMA_OMP(parallel 
for)
 
   68        for (
Index row = 0; row < rows; row++)
 
   70          Index end = row_ptr[row + 1];
 
   74          for (
Index col = row_ptr[row]; col < end; col++)
 
   79          row_norms[row] = norm;
 
   83      template <
typename DT_, 
typename IT_>
 
   84      void RowNorm::bcsr_generic_norm2(DT_* row_norms, 
const DT_* 
const val, 
const IT_* 
const ,
 
   85        const IT_* 
const row_ptr, 
const Index rows, 
const int BlockHeight, 
const int BlockWidth)
 
   90        FEAT_PRAGMA_OMP(parallel 
for)
 
   91        for (
Index row = 0; row < rows; row++)
 
   93          Index end = row_ptr[row + 1];
 
   95          for(
Index i = 0; i < block_height; ++i)
 
   97             row_norms[block_height*row + i] = DT_(0);
 
  100          for (
Index col = row_ptr[row]; col < end; col++)
 
  103            for(
Index i = 0; i < block_height; ++i)
 
  105              for(
Index j = 0; j < block_width; ++j)
 
  107                row_norms[block_height*row + i] += 
Math::sqr(val[block_height*block_width*col + i*block_width + j]);
 
  110              row_norms[block_height*row + i] = 
Math::sqrt(row_norms[block_height*row + i]);
 
  116      template <
typename DT_, 
typename IT_>
 
  117      void RowNorm::bcsr_generic_norm2sqr(DT_* row_norms, 
const DT_* 
const val,
 
  118      const IT_* 
const , 
const IT_* 
const row_ptr, 
const Index rows,
 
  119      const int BlockHeight, 
const int BlockWidth)
 
  124        FEAT_PRAGMA_OMP(parallel 
for)
 
  125        for (
Index row = 0; row < rows; row++)
 
  127          Index end = row_ptr[row + 1];
 
  129          for(
Index i = 0; i < block_height; ++i)
 
  131             row_norms[block_height*row + i] = DT_(0);
 
  134          for (
Index col = row_ptr[row]; col < end; col++)
 
  137            for(
Index i = 0; i < block_height; ++i)
 
  139              for(
Index j = 0; j < block_width; ++j)
 
  141                row_norms[block_height*row + i] += 
Math::sqr(val[block_height*block_width*col + i*block_width + j]);
 
  149      template <
typename DT_, 
typename IT_>
 
  150      void RowNorm::bcsr_generic_scaled_norm2sqr(DT_* row_norms, 
const DT_* 
const scal,
 
  151      const DT_* 
const val, 
const IT_* 
const col_ind, 
const IT_* 
const row_ptr, 
const Index rows,
 
  152      const int BlockHeight, 
const int BlockWidth)
 
  157        FEAT_PRAGMA_OMP(parallel 
for)
 
  158        for (
Index row = 0; row < rows; row++)
 
  160          Index end = row_ptr[row + 1];
 
  162          for(
Index i = 0; i < block_height; ++i)
 
  164             row_norms[block_height*row + i] = DT_(0);
 
  167          for (
Index col = row_ptr[row]; col < end; col++)
 
  170            for(
Index i = 0; i < block_height; ++i)
 
  172              for(
Index j = 0; j < block_width; ++j)
 
  174                row_norms[block_height*row + i] += scal[block_width*col_ind[col] + j]
 
  175                  *
Math::sqr(val[block_height*block_width*col + i*block_width + j]);
 
T_ sqrt(T_ x)
Returns the square-root of a value.
T_ sqr(T_ x)
Returns the square of a value.
std::uint64_t Index
Index data type.