Matrix-based predictions and complex variables

As an edit to the above, note that the issue around multiple lines in the scan file, namely

def step(w, mass_mat):
            Z_pred = 1j*w*mass_mat
            Y_pred  = pt.linalg.inv(Z_pred)
            return pt.abs(Y_pred)

        results, _ = pytensor.scan(fn=step, sequences=[w], outputs_info=None, non_sequences=[mass_mat])

Was resolved by ensuring the observation was reformatted as a tensor variable.

Issue with gradient implementation remains!