monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
at_insert_sort_dense.cpp
Go to the documentation of this file.
1 #include "../../../include/common/monolish_dense.hpp"
2 #include "../../../include/common/monolish_logger.hpp"
3 #include "../../../include/common/monolish_matrix.hpp"
4 #include "../../internal/monolish_internal.hpp"
5 
6 namespace monolish {
7 namespace matrix {
8 
9 template <typename T> T Dense<T>::at(const size_t i, const size_t j) const {
10  if (get_device_mem_stat()) {
11  throw std::runtime_error("at() Error, GPU vector cant use operator[]");
12  }
13 
14  assert(i <= get_row());
15  assert(j <= get_col());
16 
17  return val[get_col() * i + j];
18 }
19 template double Dense<double>::at(const size_t i, const size_t j) const;
20 template float Dense<float>::at(const size_t i, const size_t j) const;
21 
22 // insert //
23 
24 template <typename T>
25 void Dense<T>::insert(const size_t i, const size_t j, const T Val) {
26  if (get_device_mem_stat()) {
27  throw std::runtime_error("insert() Error, GPU vector cant use operator[]");
28  }
29 
30  assert(i <= get_row());
31  assert(j <= get_col());
32 
33  val[get_col() * i + j] = Val;
34 }
35 template void Dense<double>::insert(const size_t i, const size_t j,
36  const double Val);
37 template void Dense<float>::insert(const size_t i, const size_t j,
38  const float Val);
39 
40 } // namespace matrix
41 } // namespace monolish
monolish::matrix::Dense::insert
void insert(const size_t i, const size_t j, const Float Val)
get element A[i][j]
Definition: at_insert_sort_dense.cpp:25
monolish
Definition: monolish_matrix_blas.hpp:9
monolish::matrix::Dense::at
Float at(const size_t i, const size_t j) const
get element A[i][j]
Definition: at_insert_sort_dense.cpp:9