Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions qiskit/circuit/library/n_local/n_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from qiskit.circuit import Instruction, Parameter, ParameterVector, ParameterExpression
from qiskit.circuit.parametertable import ParameterTable
from qiskit.exceptions import QiskitError
from qiskit.utils.deprecation import deprecate_arguments

from ..blueprintcircuit import BlueprintCircuit

Expand Down Expand Up @@ -793,10 +794,12 @@ def add_layer(

return self

@deprecate_arguments({"param_dict": "parameters"})
def assign_parameters(
self,
parameters: Union[dict, List[float], List[Parameter], ParameterVector],
inplace: bool = False,
param_dict: Optional[dict] = None,
) -> Optional[QuantumCircuit]:
"""Assign parameters to the n-local circuit.

Expand Down
15 changes: 11 additions & 4 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from qiskit.qasm.qasm import Qasm
from qiskit.qasm.exceptions import QasmError
from qiskit.circuit.exceptions import CircuitError
from qiskit.utils.deprecation import deprecate_function
from qiskit.utils.deprecation import deprecate_function, deprecate_arguments
from .parameterexpression import ParameterExpression
from .quantumregister import QuantumRegister, Qubit, AncillaRegister, AncillaQubit
from .classicalregister import ClassicalRegister, Clbit
Expand Down Expand Up @@ -2078,7 +2078,10 @@ def _unsorted_parameters(self):

return parameters

def assign_parameters(self, parameters, inplace=False):
@deprecate_arguments({"param_dict": "parameters"})
def assign_parameters(
self, parameters, inplace=False, param_dict=None
): # pylint: disable=unused-argument
"""Assign parameters to new parameters or values.

The keys of the parameter dictionary must be Parameter instances in the current circuit. The
Expand All @@ -2090,9 +2093,11 @@ def assign_parameters(self, parameters, inplace=False):
parameter values. If a dict, it specifies the mapping from ``current_parameter`` to
``new_parameter``, where ``new_parameter`` can be a new parameter object or a
numeric value. If an iterable, the elements are assigned to the existing parameters
in the order of ``QuantumCircuit.parameters``.
in the order they were inserted. You can call ``QuantumCircuit.parameters`` to check
this order.
inplace (bool): If False, a copy of the circuit with the bound parameters is
returned. If True the circuit instance itself is modified.
param_dict (dict): Deprecated, use ``parameters`` instead.

Raises:
CircuitError: If parameters is a dict and contains parameters not present in the
Expand Down Expand Up @@ -2183,14 +2188,16 @@ def assign_parameters(self, parameters, inplace=False):
bound_circuit._assign_parameter(self.parameters[i], value)
return None if inplace else bound_circuit

def bind_parameters(self, values):
@deprecate_arguments({"value_dict": "values"})
def bind_parameters(self, values, value_dict=None): # pylint: disable=unused-argument
"""Assign numeric parameters to values yielding a new circuit.

To assign new Parameter objects or bind the values in-place, without yielding a new
circuit, use the :meth:`assign_parameters` method.

Args:
values (dict or iterable): {parameter: value, ...} or [value1, value2, ...]
value_dict (dict): Deprecated, use ``values`` instead.

Raises:
CircuitError: If values is a dict and contains parameters not present in the circuit.
Expand Down

This file was deleted.