Example #1
0
def _get_jac_row_over_t(rd, tout, yout, indices, bi=0):
    # Note that you really need yout - not Cout
    Jout = np.zeros((rd.n * 2 + 1, rd.n * rd.N), order="F")
    row_out = np.zeros((yout.shape[0], len(indices), rd.n))
    for i, y in enumerate(yout):
        rd.banded_jac_cmaj(tout[i], y.flatten(), Jout)
        Jtmp = Jout[:, bi * rd.n : (bi + 1) * rd.n]
        row_out[i, :, :] = get_jac_row_from_banded(Jtmp, indices, rd.n)
    return row_out
Example #2
0
def test_get_jac_row_from_banded():
    n = 3
    A = np.arange(n*n).reshape((n, n))
    B = get_banded(A, n, 1)
    assert np.allclose(get_jac_row_from_banded(B, [0], n), A[0, :])
    assert np.allclose(get_jac_row_from_banded(B, [1, 2], n), A[1:, :])