Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
Vector arithmetic
Factor documentation
>
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
( u -- v )
vabs
( u -- v )
vsqrt
( u -- v )
vfloor
( u -- v )
vceiling
( u -- v )
vtruncate
( u -- v )
Vector/scalar and scalar/vector binary operations:
vneg
( u -- v )
v*n
( u n -- w )
n*v
( n v -- w )
v/n
( u n -- w )
n/v
( n v -- w )
v+n
( u n -- w )
n+v
( n v -- w )
v-n
( u n -- w )
n-v
( n v -- w )
v^n
( u 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
( u -- v )
p-norm
( v p -- x )
Comparing entire vectors:
distance
( u v -- x )
v~
( a b epsilon -- ? )