MCPcopy Create free account
hub / github.com/numpy/numpy / abs2

Function abs2

numpy/linalg/umath_linalg.cpp:3970–3979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3968/** Compute the squared l2 norm of a contiguous vector */
3969template<typename typ>
3970static basetype_t<typ>
3971abs2(typ *p, npy_intp n, scalar_trait) {
3972 npy_intp i;
3973 basetype_t<typ> res = 0;
3974 for (i = 0; i < n; i++) {
3975 typ el = p[i];
3976 res += el*el;
3977 }
3978 return res;
3979}
3980template<typename typ>
3981static basetype_t<typ>
3982abs2(typ *p, npy_intp n, complex_trait) {

Callers 1

lstsqFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected