Example #1
0
def energy_along_flat(a, b):
    ansatz_state = qnnops.alternating_layer_ansatz(origin + a * dx + b * dy,
                                                   n_qubits=cfg.n_qubits,
                                                   block_size=cfg.n_qubits,
                                                   n_layers=cfg.n_layers,
                                                   rot_axis=cfg.rot_axis)
    return qnnops.energy(ham_matrix, ansatz_state) - eigval[0]
Example #2
0
 def loss(_params):
     ansatz_state = qnnops.alternating_layer_ansatz(_params, n_qubits,
                                                    block_size, n_layers,
                                                    rot_axis)
     return qnnops.energy(ham_matrix, ansatz_state)
Example #3
0
 def loss_fn(params):
     ansatz_state = qnnops.alternating_layer_ansatz(params, n_qubits,
                                                    n_qubits, n_layers,
                                                    args.rot_axis)
     return qnnops.energy(ham_matrix, ansatz_state)
 def loss_fn(params):
     ansatz_state = qnnops.alternating_layer_ansatz(
         params, config.n_qubits, config.n_qubits, config.n_layers, config.rot_axis)
     return qnnops.energy(ham_matrix, ansatz_state) - ground_energy
Example #5
0
def loss(params):
    ansatz_state = circuit(params)
    return qnnops.energy(ham_matrix, ansatz_state)