Vector arithmetic
Factor handbook > The language > Numbers > Vector operations

Next:Vector component- and bit-wise logic


Vector/vector binary operations:
v+ ( u v -- w )

v- ( u v -- w )

v+- ( u v -- w )

v* ( u v -- w )

v/ ( u v -- w )

v^ ( u v -- w )


Vector unary operations:
vneg ( v -- w )

vabs ( v -- w )

vsqrt ( v -- w )

vfloor ( v -- w )

vceiling ( v -- w )

vtruncate ( v -- w )


Vector/scalar and scalar/vector binary operations:
vneg ( v -- w )

v*n ( v n -- w )

n*v ( n v -- w )

v/n ( v n -- w )

n/v ( n v -- w )

v+n ( v n -- w )

n+v ( n v -- w )

v-n ( v n -- w )

n-v ( n v -- w )

v^n ( v n -- w )

n^v ( n v -- w )


Saturated arithmetic (only on Specialized arrays):
vs+ ( u v -- w )

vs- ( u v -- w )

vs* ( u v -- w )


Inner product and norm:
v. ( u v -- x )

norm ( v -- x )

norm-sq ( v -- x )

normalize ( v -- w )

p-norm ( v p -- x )


Comparing entire vectors:
distance ( u v -- x )

v~ ( a b epsilon -- ? )