edu.memphis.ccrg.lida.episodicmemory.sdm
Class SparseDistributedMemoryImpl

java.lang.Object
  extended by edu.memphis.ccrg.lida.episodicmemory.sdm.SparseDistributedMemoryImpl
All Implemented Interfaces:
SparseDistributedMemory

public class SparseDistributedMemoryImpl
extends java.lang.Object
implements SparseDistributedMemory

Implementation of Kanerva's sparse distributed memory. This implementation is based on the model described in P. Kanerva, "Sparse Distributed Memory and Related Models" in Associative Neural Memories: Theory and Implementation , pp. 50-76, Oxford University Press, 1993.

Author:
Javier Snaider

Constructor Summary
SparseDistributedMemoryImpl(int memorySize, int radius, int wordLength)
          Constructor of the class that receives all the parameters necessary for this sparse distributed memory.
SparseDistributedMemoryImpl(int memorySize, int radious, int wordLength, int addrLength)
          Constructor of the class that receives all the parameters necessary for this sparse distributed memory.
 
Method Summary
 void mappedStore(cern.colt.bitvector.BitVector wrd, cern.colt.bitvector.BitVector mapping)
          Stores word in this sparse distributed memory using the word as address.
 cern.colt.bitvector.BitVector retrieve(cern.colt.bitvector.BitVector addr)
          Retrieves the contents of this sparse distributed memory at the given address.
 cern.colt.bitvector.BitVector retrieve(cern.colt.bitvector.BitVector addr, cern.colt.bitvector.BitVector mapping)
          Retrieves the contents of this SDM at addr.
 cern.colt.bitvector.BitVector retrieveIterating(cern.colt.bitvector.BitVector addr)
          Retrieves the contents of this sparse distributed memory at the given address iterating this process until result is equal to the address.
 cern.colt.bitvector.BitVector retrieveIterating(cern.colt.bitvector.BitVector addr, cern.colt.bitvector.BitVector mapping)
          Retrieves the contents of this SDM at addr.
 void store(cern.colt.bitvector.BitVector wrd)
          Stores word in this sparse distributed memory using the word as address.
 void store(cern.colt.bitvector.BitVector wrd, cern.colt.bitvector.BitVector addr)
          Stores word in the given address in this sparse distributed memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SparseDistributedMemoryImpl

public SparseDistributedMemoryImpl(int memorySize,
                                   int radius,
                                   int wordLength)
Constructor of the class that receives all the parameters necessary for this sparse distributed memory.

Parameters:
memorySize - the size of the memory
radius - the activation radius
wordLength - the word size

SparseDistributedMemoryImpl

public SparseDistributedMemoryImpl(int memorySize,
                                   int radious,
                                   int wordLength,
                                   int addrLength)
Constructor of the class that receives all the parameters necessary for this sparse distributed memory.

Parameters:
memorySize - the size of the memory
radious - the activation radius
wordLength - the word size
addrLength - the address size
Method Detail

store

public void store(cern.colt.bitvector.BitVector wrd,
                  cern.colt.bitvector.BitVector addr)
Description copied from interface: SparseDistributedMemory
Stores word in the given address in this sparse distributed memory.

Specified by:
store in interface SparseDistributedMemory
Parameters:
wrd - the word to be stored
addr - the address where the word is to be stored

store

public void store(cern.colt.bitvector.BitVector wrd)
Description copied from interface: SparseDistributedMemory
Stores word in this sparse distributed memory using the word as address.

Specified by:
store in interface SparseDistributedMemory
Parameters:
wrd - the word to be stored

mappedStore

public void mappedStore(cern.colt.bitvector.BitVector wrd,
                        cern.colt.bitvector.BitVector mapping)
Description copied from interface: SparseDistributedMemory
Stores word in this sparse distributed memory using the word as address. The word is mapped (using XOR) with the mapping address.

Specified by:
mappedStore in interface SparseDistributedMemory
Parameters:
wrd - the word to be stored.
mapping - the mapping address.

retrieve

public cern.colt.bitvector.BitVector retrieve(cern.colt.bitvector.BitVector addr)
Description copied from interface: SparseDistributedMemory
Retrieves the contents of this sparse distributed memory at the given address.

Specified by:
retrieve in interface SparseDistributedMemory
Parameters:
addr - the address of the contents to be retrieved
Returns:
the contents of this sparse distributed memory associated with the given address

retrieve

public cern.colt.bitvector.BitVector retrieve(cern.colt.bitvector.BitVector addr,
                                              cern.colt.bitvector.BitVector mapping)
Description copied from interface: SparseDistributedMemory
Retrieves the contents of this SDM at addr. addr is first mapped using mapping. then retrieve contents of this SDM with mapped address.
Note that the retrieved vector is mapped back before return it.

Specified by:
retrieve in interface SparseDistributedMemory
Parameters:
addr - the address vector
mapping - the mapping vector
Returns:
the contents of this sparse distributed memory associated with the given address or null if the iteration did not converge

retrieveIterating

public cern.colt.bitvector.BitVector retrieveIterating(cern.colt.bitvector.BitVector addr)
Description copied from interface: SparseDistributedMemory
Retrieves the contents of this sparse distributed memory at the given address iterating this process until result is equal to the address.

Specified by:
retrieveIterating in interface SparseDistributedMemory
Parameters:
addr - the address of the contents to be retrieved
Returns:
the contents of this sparse distributed memory associated with the given address or null if the iteration did not converge

retrieveIterating

public cern.colt.bitvector.BitVector retrieveIterating(cern.colt.bitvector.BitVector addr,
                                                       cern.colt.bitvector.BitVector mapping)
Description copied from interface: SparseDistributedMemory
Retrieves the contents of this SDM at addr. addr is first mapped using mapping. then retrieve contents of this SDM with mapped address until result of retrieval is equal to address.

Specified by:
retrieveIterating in interface SparseDistributedMemory
Parameters:
addr - bitvector address that is being retreived
mapping - mapping to use
Returns:
the contents of this sparse distributed memory associated with the given address or null if the iteration did not converge