Vector exponentials with unitary semantic pointers?

Hi,

Is it possible to retrieve the exponent? Let’s say I have a SSP ensemble that represents X**n and want to connect it to a 1-D ensemble that outputs n. If I understand the SSP article correctly, a traditional (and discrete) associative memory is used instead.

My attempt is not very stable non-neurally, and does not produce expected results neurally:

import nengo_spa as spa
import nengo
import numpy as np

dimensions = 64
vocab = spa.Vocabulary(dimensions)
vocab.populate("BASE.unitary()")

scale = 1.00001 # used to avoid log(1)
base = vocab.parse("BASE").v

def power(base, e):
    return np.fft.ifft(np.fft.fft(scale*base) ** e)

def retrieve_e(y):
    e = np.median(np.log(np.absolute(np.fft.fft(y))) / np.log(np.absolute(np.fft.fft(scale*base))))
    if np.isinf(e): # happens while building with y=0
        return 0
    else:
        return e
    


with spa.Network() as model:
    
    e = nengo.Node([0])
    trans = spa.Transcode(input_vocab=vocab, output_vocab=vocab)
    state = spa.State(vocab)
    
    state_out_ens = nengo.Ensemble(100*dimensions, dimensions)
    trans.output.output = lambda t,x: x
    exponent_ens = nengo.Ensemble(100,1,radius=10)
    exponent_node = nengo.Node(size_in=1)
    
    nengo.Connection(e, trans.input, function=lambda x: power(vocab.parse("BASE").v,x))
    trans >> state
    nengo.Connection(state.output, state_out_ens)
    nengo.Connection(state_out_ens, exponent_ens, function=retrieve_e)
    nengo.Connection(trans.output, exponent_node, function=retrieve_e)

Is there a better way to compute the exponent, both neurally and non-neurally?

Thanks in advance!