arvoelke / nengolib

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

General mapping when derivatives are known #95

Open arvoelke opened 7 years ago

arvoelke commented 7 years ago

Would be good to expose this to the user in case they have derivatives they can supply, e.g.,

from numpy.linalg import matrix_power

def deriv_mapping(sys, H):  # both analog or both discretized
    gain = np.sum(H.num)
    c = H.den / gain
    k = len(H)
    A, B, C, D = sys.ss
    powA = [matrix_power(A, i) for i in range(k + 1)]
    AH = np.sum([c[i] * powA[i] for i in range(k + 1)], axis=0)
    BH = [np.dot(np.sum([c[i] * powA[i-j-1] for i in range(j+1, k+1)], axis=0), B)
          for j in range(k)]
    return AH, BH
arvoelke commented 7 years ago

This depends on #42 in the following way: in order to supply the LinearNetwork with the correct signals post-normalization, each of the individual B^H matrices need to be normalized by the same similarity transform.