vsa.funcs: Generic algebraic operations and functions for VSA vectors

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Generic functions for working with VSA vectors. Functions for all standard algebraic operations on vectors: multiplication, addition, superposition, scaling, powers (including inverses), approximate inverse, similarity.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
vsaprod(e1, e2, method = c("fft", "outer"))
appinv(e1)
!e1

add(e1, ...)
vnorm(e1)
addnorm(...)
dot(e1, e2)
e1 %.% e2
equiv(e1, e2, tol)
e1 %==% e2
cosine(e1, e2, mag1=NULL, mag2=NULL)
e1 %cos% e2
mag(e1, actual=NULL)
vsapower(e1, e2)
vsascale(e1, e2)
e1 * e2
e1 + e2
e1 / e2
e1 - e2
e1 ^ e2

Arguments

e1

a vsa vector – a subclass of vsa

e2

a vsa vector for vsaprod, dot, equiv, cosine, and add, or a scalar (a numeric vector of length 1) for vsapower and vsascale

method

computational method for convolution (vsaprod)

tol

numerical tolerance for equiv

mag1,mag2

precomputed magnitudes for e1 and e2

actual

work with data values from this object (in this mode of invocation e1 is a template holding the class)

...

addtional vsa vectors for add or addnorm

Details

All of these functions take as arguments one or more VSA vectors, and possibily a scalar. A VSA vector is a subclass of vsa (e.g., realhrr). The result is a 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).

Value

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

Author(s)

Tony Plate tplate@acm.org

References

http://www.d-reps.org

See Also

vsa, vsa.mem, for operator precedence: Syntax

Examples

 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)

vsa documentation built on May 2, 2019, 4:53 p.m.