Skip to content

Commit

Permalink
made checks more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
inafergra committed Apr 29, 2024
1 parent fc8e967 commit 763ca2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qadence_libs/qinfo_tools/qng.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def __init__(
Defaults to 10e-3.
"""

if not 0.0 <= lr:
if 0.0 > lr:
raise ValueError(f"Invalid learning rate: {lr}")
if not 0.0 <= beta:
if 0.0 >= beta:
raise ValueError(f"Invalid beta value: {beta}")
if not isinstance(circuit, QuantumCircuit):
raise ValueError(f"The circuit should be an instance of {type(QuantumCircuit)}")
Expand Down Expand Up @@ -119,13 +119,13 @@ def __init__(
Finite shift applied when computing the SPSA derivatives. Defaults to 10e-2.
"""

if not 0.0 <= lr:
if 0.0 > lr:
raise ValueError(f"Invalid learning rate: {lr}")
if not isinstance(circuit, QuantumCircuit):
raise ValueError("The circuit should be an instance of qadence.QuantumCircuit")
if not 0.0 <= beta:
if 0.0 >= beta:
raise ValueError(f"Invalid beta value: {beta}")
if not 0.0 <= epsilon:
if 0.0 > epsilon:
raise ValueError(f"Invalid epsilon value: {epsilon}")

self.current_iteration = iteration
Expand Down

0 comments on commit 763ca2d

Please sign in to comment.