exponent
is a 1D array. This means that exponent[0]
is a scalar, and exponent[0][i]
is trying to access it as if it were an array.
Did you mean to say:
L = identity(len(l)) for i in xrange(len(l)): L[i][i] = exponent[i]
or even
L = diag(exponent)
?