forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commiting suggested changes with updated email to clear CLA issues
- Loading branch information
Showing
2 changed files
with
11 additions
and
7 deletions.
There are no files selected for viewing
16 changes: 9 additions & 7 deletions
16
releasenotes/notes/added-sign-feature-parameterexpression-57693dd69103dc8c.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
--- | ||
features: | ||
- | | ||
Introduced a new feature that adds support for calculating the sign of the Parameter of the value of an expression of a Parameter class. | ||
Instead of using numpy or other libraries, the user can use the instance of the ParameterExpression class to calculate the sign. | ||
Added support for expressing the sign of a :class: 'ParameterExpression' | ||
Instead of assigning a concrete value and using ''numpy.sign'' or other library functions, the user can use the instance of the ParameterExpression | ||
class to calculate the sign and can work with the sign before the expression is fully assigned. | ||
It can be used as follows:: | ||
from qiskit.circuit import Parameter | ||
from qiskit.circuit import Parameter | ||
b = Parameter("phi") | ||
sign_value = b.sign() | ||
print("sign of Parameter is: ", sign_value) | ||
b = Parameter("phi") | ||
sign_value = b.sign() | ||
print("sign of an unassigned Parameter is: ", sign_value) | ||
print("Sign of a Parameter assigned to -3 is: ", sign_value.assign(b,-3)) | ||
Refer to ` #10360 <https://github.com/Qiskit/qiskit-terra/issues/10360>`__ for more details. | ||
Refer to ' #10360<https://github.com/Qiskit/qiskit-terra/issues/10360>'__ for more details. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters