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

Function matrixNorm

src/api/c/norm.cpp:46–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44
45template<typename T>
46double matrixNorm(const Array<T> &A, double p) {
47 using RT = normReductionResult<T>;
48 if (p == 1) {
49 Array<RT> colSum = reduce<af_add_t, T, normReductionResult<T>>(A, 0);
50 return getScalar<RT>(reduce_all<af_max_t, RT, RT>(colSum));
51 }
52 if (p == af::Inf) {
53 Array<RT> rowSum = reduce<af_add_t, T, RT>(A, 1);
54 return getScalar<RT>(reduce_all<af_max_t, RT, RT>(rowSum));
55 }
56
57 AF_ERROR("This type of norm is not supported in ArrayFire\n",
58 AF_ERR_NOT_SUPPORTED);
59}
60
61template<typename T>
62double vectorNorm(const Array<T> &A, double p) {

Callers 1

normFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected