Description Usage Arguments Details Value Author(s) References See Also Examples
Specific functions for creating and working with Holographic Reduced
Representations. Supplies functions for all standard algebraic VSA
operations on vectors: multiplication, addition, superposition, scaling,
powers (including inverses), approximate inverse, and similarity. These
work in functional and operator form (e.g., add(x, y)
and x
* y
both call the add
method for class realhrr
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  ## S3 method for class 'realhrr'
newVec(what = c("rand", "I", "1", "0", "NA"), len = options("vsalen")[[1]],
elts = NULL, cnorm = getOption("vsacnorm", TRUE), opnorm = getOption("vsaopnorm", FALSE),
vsatype = getOption("vsatype"))
## S3 method for class 'realhrr'
vsaprod(e1, e2, method = c("fft", "outer"))
## S3 method for class 'realhrr'
appinv(e1)
## S3 method for class 'realhrr'
add(e1, ...)
## S3 method for class 'realhrr'
vnorm(e1)
## S3 method for class 'realhrr'
dot(e1, e2)
## S3 method for class 'realhrr'
equiv(e1, e2, tol)
## S3 method for class 'realhrr'
cosine(e1, e2, mag1, mag2)
## S3 method for class 'realhrr'
mag(e1, actual)
## S3 method for class 'realhrr'
vsapower(e1, e2)
## S3 method for class 'realhrr'
vsascale(e1, e2)
addnorm(...)

what 
the type of vector wanted: one of

len 
the number of elements in the vector 
elts 
the raw elements for the vector 
cnorm 
a logical value ( 
opnorm 
a logical value ( 
vsatype 
ignored for 
e1 
a 
e2 
a 
mag1,mag2 
precomputed magnitudes for 
actual 
work with data values from this object (in this mode of
invocation 
method 
computational method for convolution ( 
tol 
numerical tolerance for 
... 
addtional 
These functions provide implementations of VSA operations for
realvalued Holographic Reduced Representations (in the "spatial"
domain). All of these functions take as arguments one or more
realhrr
VSA vectors, and possibily a scalar. The result is a
realhrr
VSA vector, or a scalar with class simval
. To
catch some errors due to misunderstanding of R's precedence, a simval
scalar cannot be supplied as the argument of one of these functions (to
do, remove the simval
class using the function scalar
).
mag
computes the magnitude of a vector (scalar value) as
the L2 norm (sum(e1^2)
)
vnorm
normalizes a vector so that its magnitude is 1 (vector value)
vsaprod
and its synonym *
compute the circular
(wrapped) convolution of two vectors (vector value)
appinv
and its synonym !
computes an approximate
inverse of a vector, which for realhrr
is
e1[c(1,seq(len(e1), 2)]
. The expression x / y
where x
and y
are vectors computes x * appinv(y)
. (vector value)
vsascale
and its synonym *
multiple a vector
elementwise by a
scalar (vector value).
add
computes the vector superposition of a collection of
vectors (supplied as arguments). For realhrr
s this is simply
the elementwise sum of its arguments. x
+ y
is a synonym for add(x, y)
. x  y
is a synonym for
add(x, vsascale(y, 1))
. (vector value)
addnorm
computes the vector superposition of a collection of
vectors (supplied as arguments) and normalizes the result.
vsapower
and its synonym ^
compute the power of a vector. Negative powers are allowed (vector value)
equiv
compares two vectors for approximate relative equality (to a quite strict tolerance) (logical value)
cosine
and its synonym %cos%
compute the
normalized similarity of two vectors (normalized dot product) (scalar
value with class simval
). For realhrr
s, the normalized
similarity is the cosine of the angle
between the two vectors.
dot
and its synonym %.%
compute the
unnormalized similarity of two vectors (scalar value with class
simval
). For realhrr
s, the unnormalized
similarity is the dotproduct of the two vectors.
vsaprod
, appinv
, add
, vnorm
, vsapower
, vsascale
return a vsa
object of the same class as their argument.
mag
, dot
and cosine
return a scalar value with class simval
Tony Plate [email protected]
vsa
, vsa.mem
, for operator precedence: Syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  library(vsa)
a < newVec()
a
b < newVec()
b
dot(a, b)
a
elts(a)[1:10]
x < a * b
(!a)
(!a * x)
((!a) * x)
(appinv(a) * x)
(x / a)
c < newVec()
d < newVec()
e < newVec()
f < newVec()
x < vnorm(a * b + c * d + e * f)
mem < vsamem(a, b, c, d, e, f)
cosmem(mem, a)
dotmem(mem, x / b)
cosmem(mem, x / b)
cosmem(mem, x / c)
cosmem(mem, x / f)
bestmatch(mem, x / b, cos=TRUE)
bestmatch(mem, x / b, cos=FALSE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.