2323// THE POSSIBILITY OF SUCH DAMAGE.
2424// *****************************************************************************
2525
26- #include " validation_utils.hpp"
26+ #include " ext/ validation_utils.hpp"
2727#include " utils/memory_overlap.hpp"
2828
29- using statistics::validation::array_names;
30- using statistics::validation::array_ptr;
31-
32- namespace
29+ namespace ext ::validation
3330{
34-
35- sycl::queue get_queue (const std::vector<array_ptr> &inputs,
36- const std::vector<array_ptr> &outputs)
31+ inline sycl::queue get_queue (const std::vector<array_ptr> &inputs,
32+ const std::vector<array_ptr> &outputs)
3733{
3834 auto it = std::find_if (inputs.cbegin (), inputs.cend (),
3935 [](const array_ptr &arr) { return arr != nullptr ; });
@@ -51,11 +47,8 @@ sycl::queue get_queue(const std::vector<array_ptr> &inputs,
5147
5248 throw py::value_error (" No input or output arrays found" );
5349}
54- } // namespace
5550
56- namespace statistics ::validation
57- {
58- std::string name_of (const array_ptr &arr, const array_names &names)
51+ inline std::string name_of (const array_ptr &arr, const array_names &names)
5952{
6053 auto name_it = names.find (arr);
6154 assert (name_it != names.end ());
@@ -66,8 +59,8 @@ std::string name_of(const array_ptr &arr, const array_names &names)
6659 return " 'unknown'" ;
6760}
6861
69- void check_writable (const std::vector<array_ptr> &arrays,
70- const array_names &names)
62+ inline void check_writable (const std::vector<array_ptr> &arrays,
63+ const array_names &names)
7164{
7265 for (const auto &arr : arrays) {
7366 if (arr != nullptr && !arr->is_writable ()) {
@@ -77,8 +70,8 @@ void check_writable(const std::vector<array_ptr> &arrays,
7770 }
7871}
7972
80- void check_c_contig (const std::vector<array_ptr> &arrays,
81- const array_names &names)
73+ inline void check_c_contig (const std::vector<array_ptr> &arrays,
74+ const array_names &names)
8275{
8376 for (const auto &arr : arrays) {
8477 if (arr != nullptr && !arr->is_c_contiguous ()) {
@@ -88,9 +81,9 @@ void check_c_contig(const std::vector<array_ptr> &arrays,
8881 }
8982}
9083
91- void check_queue (const std::vector<array_ptr> &arrays,
92- const array_names &names,
93- const sycl::queue &exec_q)
84+ inline void check_queue (const std::vector<array_ptr> &arrays,
85+ const array_names &names,
86+ const sycl::queue &exec_q)
9487{
9588 auto unequal_queue =
9689 std::find_if (arrays.cbegin (), arrays.cend (), [&](const array_ptr &arr) {
@@ -104,9 +97,9 @@ void check_queue(const std::vector<array_ptr> &arrays,
10497 }
10598}
10699
107- void check_no_overlap (const array_ptr &input,
108- const array_ptr &output,
109- const array_names &names)
100+ inline void check_no_overlap (const array_ptr &input,
101+ const array_ptr &output,
102+ const array_names &names)
110103{
111104 if (input == nullptr || output == nullptr ) {
112105 return ;
@@ -121,9 +114,9 @@ void check_no_overlap(const array_ptr &input,
121114 }
122115}
123116
124- void check_no_overlap (const std::vector<array_ptr> &inputs,
125- const std::vector<array_ptr> &outputs,
126- const array_names &names)
117+ inline void check_no_overlap (const std::vector<array_ptr> &inputs,
118+ const std::vector<array_ptr> &outputs,
119+ const array_names &names)
127120{
128121 for (const auto &input : inputs) {
129122 for (const auto &output : outputs) {
@@ -132,9 +125,9 @@ void check_no_overlap(const std::vector<array_ptr> &inputs,
132125 }
133126}
134127
135- void check_num_dims (const array_ptr &arr,
136- const size_t ndim,
137- const array_names &names)
128+ inline void check_num_dims (const array_ptr &arr,
129+ const size_t ndim,
130+ const array_names &names)
138131{
139132 size_t arr_n_dim = arr != nullptr ? arr->get_ndim () : 0 ;
140133 if (arr != nullptr && arr_n_dim != ndim) {
@@ -144,9 +137,9 @@ void check_num_dims(const array_ptr &arr,
144137 }
145138}
146139
147- void check_max_dims (const array_ptr &arr,
148- const size_t max_ndim,
149- const array_names &names)
140+ inline void check_max_dims (const array_ptr &arr,
141+ const size_t max_ndim,
142+ const array_names &names)
150143{
151144 size_t arr_n_dim = arr != nullptr ? arr->get_ndim () : 0 ;
152145 if (arr != nullptr && arr_n_dim > max_ndim) {
@@ -157,9 +150,9 @@ void check_max_dims(const array_ptr &arr,
157150 }
158151}
159152
160- void check_size_at_least (const array_ptr &arr,
161- const size_t size,
162- const array_names &names)
153+ inline void check_size_at_least (const array_ptr &arr,
154+ const size_t size,
155+ const array_names &names)
163156{
164157 size_t arr_size = arr != nullptr ? arr->get_size () : 0 ;
165158 if (arr != nullptr && arr_size < size) {
@@ -170,9 +163,9 @@ void check_size_at_least(const array_ptr &arr,
170163 }
171164}
172165
173- void common_checks (const std::vector<array_ptr> &inputs,
174- const std::vector<array_ptr> &outputs,
175- const array_names &names)
166+ inline void common_checks (const std::vector<array_ptr> &inputs,
167+ const std::vector<array_ptr> &outputs,
168+ const array_names &names)
176169{
177170 check_writable (outputs, names);
178171
@@ -187,4 +180,4 @@ void common_checks(const std::vector<array_ptr> &inputs,
187180 check_no_overlap (inputs, outputs, names);
188181}
189182
190- } // namespace statistics ::validation
183+ } // namespace ext ::validation
0 commit comments