Пример #1
0
def test_build_system_loop_equals_implementation():
    data, _, sigma, lmbda = setup()

    A_new, b_new = build_system(data, data, sigma, lmbda)

    A_old, b_old = build_system_loop(data, sigma, lmbda)

    assert_close(A_new, A_old, verbose=True)
    assert_close(b_new, np.squeeze(b_old.T))
Пример #2
0
def test_compute_rhs_vector():
    data, l, sigma, lmbda = setup()

    xi_norm_2 = compute_xi_norm_2(data, data, sigma)

    kernel_dx_dx_dy = lambda x, y: SE_dx_dx_dy(x, y, l)

    _, rhs_vector = build_system(data, data, sigma, lmbda)
    rhs_loop = compute_RHS_loop(kernel_dx_dx_dy, data, xi_norm_2)

    assert_close(rhs_vector, np.squeeze(rhs_loop.T))
Пример #3
0
def test_compute_lower_submatrix():
    data, l, sigma, lmbda = setup()

    kernel_dx_dy = lambda x, y: SE_dx_dy(x, y, l)

    A_loop = compute_lower_right_submatrix_loop(kernel_dx_dy, data, lmbda)

    A, _ = build_system(data, data, sigma, lmbda)
    A_vector = A[1:, 1:]
    #     A_vector = compute_lower_right_submatrix(all_hessians, data.shape[0], lmbda)

    assert_close(A_loop, A_vector)
Пример #4
0
def test_build_system_custom_basis_execute():
    data, _, sigma, lmbda = setup()
    basis = np.random.randn(10, data.shape[1])
    build_system(basis, data, sigma, lmbda)