x
. y
(dot product), <x>
(normalization),
and |x|
(Euclidean length).
One ususual aspect of vcalc notation is that functions can have local variables specified in the parameter list, after a semicolon. Thus, the following two examples print the same thing:
> x = {1/2 1/3} > print(x) {0.5 0.333} > print(x; precision=6, brace=false) 0.5 0.333333 > print.precision=6 > print.brace=false > print(x) 0.5 0.333333
var.dim
, vector.dim
- dimension of newly created vectors
vector.type
- Controls whether vectors are treated as real or complex. Functions and operators behave differently for real and complex vectors. Two possible values:
standard
" - vectors of real values. Here's a quick summary of the special features of vcalc
:
x*y
): circular (wrapped) convolution
x'
): permute the elements of x
(first element stays in place, order of rest is reversed)
circular
" - vectors of complex
values, stored in polar form, with magnitude
then angle. A vector of n elements
contains n/2 complex numbers. Here's a
quick summary of how complex vectors are treated
by various functions and operators.
echo
- default "false
" (set by command line option)
store.bitvectors
- default "false
" (set by command line option)
match.sim
- default "dotProduct
"
match.print
- default "true
"
match.filter
- default "false
"
match.spread
- default 4
match.precision
- default 3
match.capacity
- default 1
blend.sim
- default "dotProduct
"
blend.transfer
- default "boundedLinear
"
blend.threshhold
- default 0.0
blend.bias
- default 0.0
blend.weight
- default 1
blend.capacity
- default 1
retrieve.sim
- default "dotProduct
"
retrieve.transfer
- default "binary
"
retrieve.bias
- default 0.0
retrieve.threshhold
- default 0.0
retrieve.weight
- default 1.0
retrieve.capacity
- default 1.0
rand.seed
- default 0 (set by command line option)
normalize.threshhold
- default 0.0
print.brace
- default "true
"
print.level
- default 3
print.precision
- default 3
print.bitspace
- default ""
print.newline
- default "true
"
print.flush
- default "true
"
bitvec.threshold
- default 0
debug.tree
- default "false
" (set by command line option)
debug.addr
- default "false
" (set by command line option)
debug.mem
- default "false
"
orthogonalize.precision
- default 1e-3
true
- constant string value "true
"
false
- constant string value "false
"
pi
- constant - value of PI
x+y
x*y
convolution or scalar multiplication
x@*y
element wise multiplication
x&*y
??? (unused)
x@/y
element wise multiplication
x**y
x^y
x-y
x=y
x==y
x?=y
same as x==y
x?<y
less than (can't use <
because we use <x>
for normalization)
x?>y
greater than
x>=y
greater than or equals
x<=y
less than or equals
x!=y
<x>
normalization
|x|
x'
!x
-x
x . y
dot product. Must have spaces around the dot because a dot is legally part of an identifier.
<x>
or equivalently normalize(x)
is the normalized version of x
Control:
type
: controls the type of normalization performed. Takes string values among:
logistic
"
"sigmoid
"
tanh
"
binary
"
symmetric
"
nopnorm
"
unit
"
unitbinary
"
power
"
linear
"
boundedlinear
"
Examples:
> y = {1 2 3 4} > y {1 2 3 4} > <y> {0.183 0.365 0.548 0.73} > <y;type="nopnorm"> {1 2 3 4} > normalize.type unit > normalize.type="nopnorm" > normalize(y) {1 2 3 4} > normalize(y;type="unit") {0.183 0.365 0.548 0.73}
cos(x)
- the cosine of x
Control:
????
: controls ... Takes ??? values among:
???
Examples:
blend(x,list)
- calculates a blend of x
among the vectors in list
Control:
capacity
: use this many best matches
transfer
: the function used to compute blend weights from match strengths. Takes string values among:
sigmoid
or logistic
tanh
linear
boundedlinear
: bounded between 0 and 1
sigmoid.bias
: The bias to use with logistic or tanh transfer functions. The weight is computed as sigmoid(sigmoid.bias+sigmoid.weight*matchscore)
(or tanh(.)
).
sigmoid.weight
: The weight to use with logistic or tanh transfer functions.
sim
: The type of similarity function. Takes string values among:
dotproduct
cosine
Examples:
> a = <randvec()> > b = <randvec()> > c = <randvec()> > blend.capacity = 2 > match.capacity = 3 > blend.transfer = "boundedlinear" > store(s, a,b,c) > x = 2*a + b + c > match(x, s) a 1.80447 b 0.812107 c 0.783128 > y = blend(x, s) > y {-0.605 -0.0471 0.226 -0.0293 -0.534 0.552 0.705 -0.075} > a + 0.812107 * b {-0.605 -0.0471 0.226 -0.0293 -0.534 0.552 0.705 -0.075}