Esempio n. 1
0
def bipartite_graph_calculate_E(b0, b1, W, x0, x1, dtype):
    checkers.bipartite_graph.qubo(b0, b1, W, dtype)
    checkers.bipartite_graph.bits(W, x0, x1)
    checkers.assert_is_vector('x0', x0)
    checkers.assert_is_vector('x1', x1)
    E = np.ndarray((1), dtype)
    formulas.bipartite_graph_calculate_E(E, b0, b1, W, x0, x1, dtype)
    return E[0]
Esempio n. 2
0
def dense_graph_calculate_E_from_spin(h, J, c, q, dtype):
    checkers.dense_graph.hJc(h, J, c, dtype)
    checkers.dense_graph.bits(J, q)
    checkers.assert_is_vector('q', q)

    E = np.ndarray((1), dtype)
    formulas.dense_graph_calculate_E_from_spin(E, h, J, c, q, dtype)
    return E[0]
Esempio n. 3
0
def dense_graph_calculate_E(W, x, dtype):
    checkers.dense_graph.qubo(W, dtype)
    checkers.dense_graph.bits(W, x)
    checkers.assert_is_vector('x', x)

    E = np.ndarray((1), dtype)
    formulas.dense_graph_calculate_E(E, W, x, dtype)
    return E[0]
Esempio n. 4
0
def bipartite_graph_calculate_E_from_spin(h0, h1, J, c, q0, q1, dtype):
    checkers.bipartite_graph.hJc(h0, h1, J, c, dtype)
    checkers.bipartite_graph.bits(J, q0, q1)
    checkers.assert_is_vector('q0', q0)
    checkers.assert_is_vector('q1', q1)

    E = np.ndarray((1), dtype)
    formulas.bipartite_graph_calculate_E_from_spin(E, h0, h1, J, c, q0, q1,
                                                   dtype)
    return E[0]