-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
physics/quantum: wrapper class for python functions used in OracleGate #22887
physics/quantum: wrapper class for python functions used in OracleGate #22887
Conversation
Currently python functions are stored directly in `OracleGate`'s args. This is now updated to use a wrapper `Atom` class.
|
||
def return_one_on_one(qubits): | ||
return qubits == IntQubit(1, nqubits=qubits.nqubits) | ||
|
||
return_one_on_one=OracleGateFunction(return_one_on_one) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could use this as a decorator like:
@OracleGateFunction()
def return_one_on_one(qubits):
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I'll add such an example to the docstring too, since it is potentially a lot more convincing for a user to use it in that way.
Looks good |
✅ Hi, I am the SymPy bot (v163). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.11. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
@asmeurer I approached this from a computer science point of view, so I am not sure if this is also a convenient approach from quantum physics point of view |
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) before after ratio
[1c20bad3] [55bc0463]
+ 63.7±0.3μs 97.6±30μs 1.53 lambdify.TimeLambdifyEvaluate.time_lambdify_evaluate(['numpy'])
Significantly changed benchmark results (master vs previous release) before after ratio
[907895ac] [1c20bad3]
- 255±4ms 155±0.5ms 0.61 large_exprs.TimeLargeExpressionOperations.time_subs
- 17.1±0.04ms 11.1±0.01ms 0.65 matrices.TimeMatrixExpression.time_MatAdd_doit
- 274±10μs 122±2μs 0.45 matrices.TimeMatrixExpression.time_MatMul
- 16.6±0.06ms 8.56±0.07ms 0.51 matrices.TimeMatrixExpression.time_MatMul_doit
- 4.88±0.02s 358±2ms 0.07 polygon.PolygonArbitraryPoint.time_bench01
+ 3.92±0.1ms 6.56±0.07ms 1.68 solve.TimeMatrixOperations.time_det(4, 2)
+ 3.92±0.1ms 6.65±0.06ms 1.70 solve.TimeMatrixOperations.time_det_bareiss(4, 2)
+ 44.1±0.3ms 77.5±0.3ms 1.76 solve.TimeMatrixSolvePyDySlow.time_linsolve(1)
+ 44.7±0.1ms 78.0±0.2ms 1.74 solve.TimeMatrixSolvePyDySlow.time_solve(1)
Full benchmark results can be found as artifacts in GitHub Actions |
a449d26
to
6ebe5ca
Compare
With the conversion now being done by the |
Looks good to me |
References to other Issues or PRs
Brief description of what is fixed or changed
Currently python functions are stored directly in
OracleGate
'sargs. This is now updated to use a wrapper
Atom
class.Other comments
Release Notes
OracleGateFunction
is now provided for python functions used inOracleGate
.