openfermioncirq.VariationalAnsatz¶
-
class
openfermioncirq.VariationalAnsatz(qubits: Optional[Sequence[cirq.ops.raw_types.Qid]] = None)[source]¶ A variational ansatz.
A variational ansatz is a parameterized circuit. The VariationalAnsatz class stores parameters as instances of the Symbol class. A Symbol is simply a named object that can be used in a circuit and whose numerical value is determined at run time. The Symbols are stored in a dictionary whose keys are the names of the corresponding parameters. For instance, the Symbol corresponding to the parameter ‘theta_0’ would be obtained with the expression self.params[‘theta_0’].
-
params[source]¶ A dictionary storing the parameters by name. Key is the string name of a parameter and the corresponding value is a Symbol with the same name.
-
circuit¶ The ansatz circuit.
-
qubits¶ A list containing the qubits used by the ansatz circuit.
-
__init__(qubits: Optional[Sequence[cirq.ops.raw_types.Qid]] = None) → None[source]¶ Parameters: qubits – Qubits to be used by the ansatz circuit. If not specified, then qubits will automatically be generated by the _generate_qubits method.
Methods
__init__(qubits)param qubits: Qubits to be used by the ansatz circuit. If not specified, default_initial_params()Suggested initial parameter settings. operations(qubits)Produce the operations of the ansatz circuit. param_bounds()Optional bounds on the parameters. param_resolver(param_values)Interprets parameters input as an array of real numbers. param_scale_factors()Coefficients to scale parameters by during optimization. params()The parameters of the ansatz. qubit_permutation(qubits)The qubit permutation induced by the ansatz circuit. -