arvoelke / nengolib

Nengo library of additional extensions
Other
29 stars 6 forks source link

Option for sys.filt to not put into canonical form #168

Open arvoelke opened 5 years ago

arvoelke commented 5 years ago

Currently _CanonicalStep (used by sys.filt) converts the system into CCF. This conversion can be detrimental for difficult systems.

arvoelke commented 5 years ago

Work-in-progress:

def sys_filt(sys, u, saturate=10):
    # https://github.com/arvoelke/nengolib/issues/168
    assert sys.analog == False
    x = np.zeros((len(sys)))
    y = np.zeros((len(u), sys.size_out))
    for i in range(len(u)):
        y[i, :] = sys.C.dot(x) + sys.D.dot(u[i, :])
        x[:] = (sys.A.dot(x) + sys.B.dot(u[i, :])).clip(-saturate, saturate)
    return y
arvoelke commented 5 years ago

The sys *= z in NengoLinearFilterMixin can also be detrimental as this converts back and forth between TF and SS.

arvoelke commented 5 years ago

Also related to #106 as the current implementation for multi-output systems does not have these issues. That is, sys.X.filt is okay but sys.filt is not.