Skip to content
Closed
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
4 changes: 2 additions & 2 deletions qiskit/opflow/gradients/circuit_gradients/lin_comb.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class LinComb(CircuitGradient):
}

# pylint: disable=signature-differs, arguments-differ
def __init__(self, aux_meas_op: OperatorBase = Z):
def __init__(self, aux_meas_op: OperatorBase = Z): # type: ignore[override]
"""
Args:
aux_meas_op: The operator that the auxiliary qubit is measured with respect to.
Expand Down Expand Up @@ -751,7 +751,7 @@ def _gradient_states(

# compute the correct coefficient and append to list of circuits
coeff = np.sqrt(np.abs(grad_coeff)) * state_op.coeff
state = CircuitStateFn(grad_circuit, coeff=coeff)
state: OperatorBase = CircuitStateFn(grad_circuit, coeff=coeff)

# apply the chain rule if the parameter expression if required
param_expression = gate.params[idx]
Expand Down
2 changes: 1 addition & 1 deletion qiskit/opflow/gradients/circuit_gradients/param_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def convert(
Tuple[ParameterExpression, ParameterExpression],
List[Tuple[ParameterExpression, ParameterExpression]],
],
) -> OperatorBase:
) -> OperatorBase: # type: ignore[override]
"""
Args:
operator: The operator corresponding to our quantum state we are taking the
Expand Down
2 changes: 1 addition & 1 deletion qiskit/opflow/gradients/circuit_qfis/lin_comb_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
self,
aux_meas_op: OperatorBase = Z,
phase_fix: bool = True,
):
): # type: ignore[override]
"""
Args:
aux_meas_op: The operator that the auxiliary qubit is measured with respect to.
Expand Down
6 changes: 3 additions & 3 deletions qiskit/opflow/operator_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class OperatorBase(StarAlgebraMixin, TensorMixin, ABC):
def __init__(self) -> None:
self._instance_id = next(self._count)

@property
@property # type: ignore
@abstractmethod
def settings(self) -> Dict:
"""Return settings of this object in a dictionary.
Expand All @@ -66,7 +66,7 @@ def instance_id(self) -> int:
"""Return the unique instance id."""
return self._instance_id

@property
@property # type: ignore
@abstractmethod
def num_qubits(self) -> int:
r"""The number of qubits over which the Operator is defined. If
Expand Down Expand Up @@ -309,7 +309,7 @@ def tensorpower(self, other: int) -> Union["OperatorBase", int]:
"""
raise NotImplementedError

@property
@property # type: ignore
@abstractmethod
def parameters(self):
r"""Return a set of Parameter objects contained in the Operator."""
Expand Down
2 changes: 1 addition & 1 deletion qiskit/opflow/primitive_ops/pauli_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def exp_i(self) -> OperatorBase:
return PauliOp(self.primitive)
if np.sum(sig_qubits) == 1:
sig_qubit_index = sig_qubits.tolist().index(True)
coeff = (
coeff: Union[float, ParameterExpression] = (
np.real(self.coeff)
if not isinstance(self.coeff, ParameterExpression)
else self.coeff
Expand Down
5 changes: 2 additions & 3 deletions qiskit/opflow/state_fns/circuit_state_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
# that they have been altered from the originals.

""" CircuitStateFn Class """


import typing
from typing import Dict, List, Optional, Set, Union, cast

import numpy as np
Expand Down Expand Up @@ -47,7 +46,7 @@ class CircuitStateFn(StateFn):
def __init__(
self,
primitive: Union[QuantumCircuit, Instruction] = None,
coeff: Union[complex, ParameterExpression] = 1.0,
coeff: Union[typing.SupportsComplex, ParameterExpression] = 1.0,
is_measurement: bool = False,
from_operator: bool = False,
) -> None:
Expand Down