1 #include "../../../include/common/monolish_dense.hpp"
2 #include "../../../include/common/monolish_logger.hpp"
3 #include "../../../include/common/monolish_matrix.hpp"
4 #include "../../../include/monolish_vml.hpp"
5 #include "../../internal/monolish_internal.hpp"
10 template <
typename V1,
typename V2>
11 bool equal_core(
const V1 &vec1,
const V2 &vec2,
bool compare_cpu_and_device) {
15 if (vec1.size() != vec2.size()) {
18 if (vec1.get_device_mem_stat() != vec2.get_device_mem_stat()) {
22 if (vec1.get_device_mem_stat() ==
true) {
23 if (!(internal::vequal(vec1.size(), vec1.data() + vec1.get_offset(),
24 vec2.data() + vec2.get_offset(),
true))) {
27 }
else if (vec1.get_device_mem_stat() ==
false ||
28 compare_cpu_and_device ==
false) {
29 if (!(internal::vequal(vec1.size(), vec1.data() + vec1.get_offset(),
30 vec2.data() + vec2.get_offset(),
false))) {
41 bool vector<T>::equal(
const vector<T> &vec,
bool compare_cpu_and_device)
const {
42 return equal_core(*
this, vec, compare_cpu_and_device);
45 bool compare_cpu_and_device)
const;
47 bool compare_cpu_and_device)
const;
51 bool compare_cpu_and_device)
const {
52 return equal_core(*
this, vec, compare_cpu_and_device);
55 bool compare_cpu_and_device)
const;
57 bool compare_cpu_and_device)
const;
61 bool compare_cpu_and_device)
const {
62 return equal_core(*
this, vec, compare_cpu_and_device);
66 bool compare_cpu_and_device)
const;
69 bool compare_cpu_and_device)
const;
72 return equal_core(*
this, vec,
false);
79 return equal_core(*
this, vec,
false);
88 return equal_core(*
this, vec,
false);
91 const view1D<matrix::Dense<double>,
double> &vec)
const;
96 return !equal_core(*
this, vec,
false);
101 template <
typename T>
103 return !equal_core(*
this, vec,
false);
110 template <
typename T>
112 return !equal_core(*
this, vec,
false);
115 const view1D<matrix::Dense<double>,
double> &vec)
const;