Circuit.instantiate
- Circuit.instantiate(target, method=None, multistarts=1, seed=None, multistart_gen=None, score_fn_gen=None, **kwargs)[source]
Instantiate the circuit with respect to a target state or unitary.
Attempts to change the parameters of the circuit such that the circuit either implements the target unitary or maps the zero state to the target state.
- Parameters:
target (
StateLike | UnitaryLike | StateSystem
) – The target unitary or state. If a unitary is specified, the method changes the circuit’s parameters in an effort to get closer to implementing the target. If a state is specified, the method changes the circuit’s parameters in an effort to get closer to producing the target state when starting from the zero state.method (
str | Instantiater | None
) – The method with which to instantiate the circuit. Currently, “qfactor” and “minimization” are supported. If left None, attempts to pick best method. You can also pass anInstantiater
directly through this.multistarts (
int
) – The number of starting points to sample instantiation with. (Default: 1)seed (
int | None
) – The seed for any pseudo-random number generators to use. Note that this is not guaranteed to make this method reproducible.multistart_gen (
MultiStartGenerator
) – (Deprecated)score_fn_gen (
CostFunctionGenerator
) – (Deprecated)kwargs (
dict[str, Any]
) – Method specific options, passed directly to method constructor. For more info, see bqskit.ir.opt.instantiaters.
- Returns:
A reference to self is returned
- Return type:
- Raises:
ValueError – If method is invalid.
ValueError – If circuit is incompatible with any method.
ValueError – If target dimension doesn’t match with circuit.
ValueError – If multistarts is not a positive integer.
ValueError – If seed is not an integer or None