Handbook
Glossary
norm-sq ( v -- x )
Factor handbook
»
The language
»
Numbers
»
Vector operations
»
Vector arithmetic
Prev:
vdot ( u v -- x )
Next:
l1-norm ( k -- x )
Vocabulary
math
.
vectors
Inputs
v
a
sequence
of
number
s
Outputs
x
a non-negative real number
Word description
Computes the squared length of a mathematical vector.
See also
l1-norm
,
norm
,
l-infinity-norm
,
p-norm
Definition
IN:
math.vectors
GENERIC:
norm-sq
( v -- x )
Methods
USING:
math
math.vectors
sequences.cords
;
M:
cord
norm-sq
[
norm-sq
]
cord-both
+
;
inline
USING:
kernel
math
math.functions
math.vectors
sequences
;
M:
object
norm-sq
[
absq
]
[
+
]
map-reduce
;
inline
USING:
kernel
math.vectors
math.vectors.simd
math.vectors.simd.intrinsics
;
M:
simd-128
norm-sq
dup
vdot
(simd-positive)
;
inline