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 )

normalize ( 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:
vdot ( u v -- x )

norm-sq ( v -- x )

l1-norm ( k -- x )

norm ( k -- x )

l-infinity-norm ( k -- x )

p-norm ( k p -- x )


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

v~ ( a b epsilon -- ? )