norm-sq ( v -- x )
Factor documentation > Factor handbook > The language > Numbers > Vector operations > Vector arithmetic
Prev:norm ( v -- x )
Next:normalize ( u -- v )


Vocabulary
math.vectors

Inputs and outputs
va sequence of numbers
xa non-negative real number


Word description
Computes the squared length of a mathematical vector.

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 v. assert-positive ; inline