| 3968 | /** Compute the squared l2 norm of a contiguous vector */ |
| 3969 | template<typename typ> |
| 3970 | static basetype_t<typ> |
| 3971 | abs2(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 | } |
| 3980 | template<typename typ> |
| 3981 | static basetype_t<typ> |
| 3982 | abs2(typ *p, npy_intp n, complex_trait) { |