MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / cpu_norm1_impl

Function cpu_norm1_impl

test/norm.cpp:37–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36template<typename T>
37double cpu_norm1_impl(af::dim4 &dims, std::vector<T> &value) {
38 int M = dims[0];
39 int N = dims[1];
40
41 double norm1 = std::numeric_limits<double>::lowest();
42 for (int n = 0; n < N; n++) {
43 T *columnN = value.data() + n * M;
44 double sum = 0;
45 for (int m = 0; m < M; m++) { sum += abs(columnN[m]); }
46 norm1 = std::max(norm1, sum);
47 }
48 return norm1;
49}
50
51template<typename T>
52double cpu_norm_pq_impl(af::dim4 &dims, std::vector<T> &value, double p, double q) {

Callers

nothing calls this directly

Calls 2

absFunction · 0.70
maxFunction · 0.70

Tested by

no test coverage detected