Create and print VSA objects

Share:

Description

Functions for creating, extracting data from, and printing VSA objects.

Usage

1
2
3
4
5
6
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"))
elts(e1)
## S3 method for class 'vsa'
print(x, ..., values = FALSE)

Arguments

what

the type of vector wanted: one of rand, I, 1, 0, NA:

  • rand is a random vector

  • I and 1 mean the same thing and return the identity vector (i.e., the vector satisfying x * I = x for all non-zero x)

  • 0 is the zero vector, i.e., the vector satisfying x * 0 = 0 and x + 0 = x for all vectors x

  • NA is a vector filled with NA values.

what is ignored if elts is supplied.

len

the number of elements in the vector

elts

the raw elements for the vector

vsatype

the subclass of vsa: must be a character string for which a function newVec.<vsatype> exists

cnorm

a logical value (TRUE or FALSE) - controls whether the new vectors is created to have a magnitude of 1

opnorm

a logical value (TRUE or FALSE) - controls whether the result of a vsa operation is normalized to have a magnitude of 1

e1

a vsa vector

x

a vsa vector

...

additional arguments for print

values

a logical value indicating whether or not to print the actual values elements of the vsa vector

Details

VSA objects can be of different types or classes. The vsa package currently provides an implementation of real-valued HRR vectors. Other possible types include binary vectors, frequency-domain HRRs, and more.

The length and type of the vector created by newVec() is determined by the current settings for options("vsatype"), options("vsanorm"), and options("vsalen").

Value

newVec generates a new vsa vector.

elts returns the elements of a vsa vector as the most suitable R atomic class (usually double, but other possibilities are integer, raw (bytes), or complex).

Author(s)

Tony Plate tplate@acm.org

See Also

vsa.funcs, vsa.misc, vsa.mem

Examples

1
2
3
4
5
a <- newVec()
b <- newVec()
c <- newVec()
d <- newVec()
c <- a * b