Symbol

Symbol

new Symbol(nameopt, tauopt, sigmaopt)

Description:
  • Creates a macroscopic ersatz of a VSA symbol.

    • For convenience the constructs
      • Symbol(String name, double tau, double sigma)
      • Symbol(String name, const Belief& belief)
    • Note: a symbol can not be copied, use the clone() method instead.
Parameters:
Name Type Attributes Default Description
name String | Symbol <optional>

The symbol name.

  • If omitted, the name is set to #id where id is an automatic unique number, see getID().
  • If given as a symbol, the symbol name is used.
tau double <optional>
1

The symbol degree of belief.

sigma double <optional>
0

The symbol standard-deviation of the related level of noise.

Members

(static) nill :Symbol

Description:
  • The nill symbol, with the empty string as name, with tau=0.

The nill symbol, with the empty string as name, with tau=0.

Type:

Methods

getName() → {String}

Description:
  • Returns the symbol name.

Returns:

The read-only symbol name value.

Type
String

getID() → {uint}

Description:
  • Returns the symbol ID.

    • This ID is a unique number for a given symbol.
      • Two atomic symbols with the same ID are equal, possibly with different belief level.
      • This does not apply to non atomic symbols: binding or bundling.
Returns:

The read-only symbol id value.

Type
uint

getType() → {SymbolType}

Description:
  • Returns the symbol type.

Returns:

Either Symbol::SymbolType::atomic, Symbol::SymbolType::binding, or Symbol::SymbolType::bundling.

Type
SymbolType

getVector() → {Array}

Description:
  • Returns a randomly drawn unary vector coresponding to this symbol.

Returns:

The double[] read-only symbol vector value.

Type
Array

getBelief()()

Returns:

The degree of belief

  • tau between -1 (false), 0 (unknown) and true (1), 1 by default and
  • sigma the standard-deviation of the related level of noise, 0 by default.

setBelief()(belief)

Parameters:
Name Type Description
belief Belief

The degree of belief, the setBelief(tau, sigma) is also available.

equals(symbol, whatopt) → {bool}

Description:
  • Tests if two symbol are indistiguishable.

    • Two symbols are ``colinear´´ if they have the same corresponds to the same vector, up to the magnitude.
    • Two symbols are ``indistiguishable´´ if colinear and with the same belief, up to some precision:
      `|tau - symbol.tau| < 2 |sigma_0 + sigma + symbol.sigma|
    • The == C++ operator corresponds to indistiguishable.
Parameters:
Name Type Attributes Default Description
symbol Symbol

The symbol to compare with this one.

what char <optional>
'i'

either 'c' for colinear or 'i' for indistiguishable

Returns:

True if equal, false otherwise.

Type
bool

asString() → {String}

Description:
  • Returns the value as a string.

Returns:

A string of the form name<tau+-sigma>:

  • omitting the belief if tau=1, sigma=0,
  • adding the _type if it is an unexpected _bundling or a _binding symbol.
Type
String

(static) getDimension() → {uint}

Description:
  • Returns the underlying VSA space dimension.

Returns:

The VSA space dimension, default value is d=10000.

Type
uint

(static) setDimension(dopt)

Description:
  • Changes the underlying VSA space dimension.

    • All computed values are reseted.
Parameters:
Name Type Attributes Default Description
d uint <optional>
10000

The new VSA space dimension. It must be a square of an integer.

(static) clone(symbol, tauopt, sigmaopt) → {Symbol}

Description:
  • Properly clone a atomic, binding or bundling symbol, possibly with a different belief.

    • The created symbol is available until program end.
    • The clone(const Symbol& symbol, const Belief& belief) form is also available.
Parameters:
Name Type Attributes Default Description
symbol Symbol

The symbol to compare with this one.

tau double <optional>
1

The symbol degree of belief.

sigma double <optional>
0

The symbol standard-deviation of the related level of noise.

Returns:

A pointer to the new symbol to be deleted after use.

Type
Symbol

(static) fromJSON(symbol) → {Symbol}

Description:
  • Parses a weak json string to generate a symbol.

    • In order to input expression we use the usual JSON syntax in a weak form, namely:
      • Bundlings are represented by lists:
        [symbol_1 ...].
      • Bindings are represented by the construct:
        {b y: symbol x: symbol },
        where b stands for binding and is replaced by u for unbinding.
      • Atomic symbols are represented by the construct:
        { name: symbol-name tau: tau-value sigma: tau-value }, <br/> tauandsigmabeing optional, while atomic symbols withtau=1andsigma=0` are also represented by strings.
Parameters:
Name Type Description
symbol JSON | string

The weak json string to parse.

Returns:

A reference to the built symbol.

  • The built symbol is editable and remanent, i.e., available until program end.
Type
Symbol

(static) toJSON(symbol) → {string}

Description:
  • Returns a symbol using the weak JSON syntax of the fromJSON.

Parameters:
Name Type Description
symbol Symbol

The symbol to encode in JSON.

Returns:

The weak JSON syntax output.

Type
string

(static) dump()

Description:
  • Prints on stdout, for debugging and statistics purposes, global informations on symbol data.