monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
matmax.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace monolish {
4 namespace {
5 template <typename F1, typename F2, typename F3>
6 void mmmax_core(const F1 &A, const F2 &B, F3 &C) {
7  Logger &logger = Logger::get_instance();
8  logger.func_in(monolish_func);
9 
10  // err
11  assert(util::is_same_size(A, B, C));
12  assert(util::is_same_structure(A, B, C));
13  assert(util::is_same_device_mem_stat(A, B, C));
14 
15  internal::vmax(C.get_nnz(), A.val.data(), B.val.data(), C.val.data(),
16  C.get_device_mem_stat());
17 
18  logger.func_out();
19 }
20 
21 template <typename F1, typename F2> F2 mmax_core(const F1 &C) {
22  Logger &logger = Logger::get_instance();
23  logger.func_in(monolish_func);
24 
25  F2 max = internal::vmax(C.get_nnz(), C.val.data(), C.get_device_mem_stat());
26 
27  logger.func_out();
28  if (typeid(F1) == typeid(matrix::Dense<F2>)) {
29  return max;
30  } else {
31  return std::max(max, (F2)0.0);
32  }
33 }
34 } // namespace
35 } // namespace monolish
monolish::util::is_same_size
bool is_same_size(const T &x, const U &y)
compare size of vector or 1Dview (same as is_same_structure())
Definition: monolish_common.hpp:358
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::util::is_same_structure
bool is_same_structure(const T A, const U B)
compare matrix structure
Definition: monolish_common.hpp:268
monolish::vml::max
void max(const matrix::CRS< double > &A, const matrix::CRS< double > &B, matrix::CRS< double > &C)
Create a new CRS matrix with greatest elements of two matrices (C[0:nnz] = max(A[0:nnz],...
Definition: matrix_vml.cpp:382
monolish::util::is_same_device_mem_stat
bool is_same_device_mem_stat(const T &arg1, const U &arg2)
compare same device memory status
Definition: monolish_common.hpp:431
monolish
Definition: monolish_matrix_blas.hpp:9
monolish::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42