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"
9 template <
typename T> T
COO<T>::at(
const size_t i,
const size_t j)
const {
11 assert(i <= get_row());
12 assert(j <= get_col());
17 for (
size_t k = nnz; k > 0; --k) {
18 if (row_index[k - 1] == (
int)i && col_index[k - 1] == (
int)j) {
26 template float COO<float>::at(
const size_t i,
const size_t j)
const;
33 assert(rownum <= get_row());
34 assert(colnum <= get_col());
36 row_index.push_back(rownum);
37 col_index.push_back(colnum);
57 int p1 = row_index[p];
58 int p2 = col_index[p];
62 while ((l < h) && ((row_index[l] != row_index[p])
63 ? (row_index[l] - row_index[p])
64 : (col_index[l] - col_index[p])) <= 0) {
67 while ((h > l) && ((row_index[h] != row_index[p])
68 ? (row_index[h] - row_index[p])
69 : (col_index[h] - col_index[p])) >= 0) {
74 row_index[l] = row_index[h];
78 col_index[l] = col_index[h];
87 row_index[p] = row_index[l];
90 col_index[p] = col_index[l];
97 if (l - lo < hi - l) {
121 for (
size_t i = 1; i < nnz; i++) {
122 if ((row_index[k] != row_index[i]) || (col_index[k] != col_index[i])) {
124 row_index[k] = row_index[i];
125 col_index[k] = col_index[i];