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
Add extract_expression_from_wavefunction
to sympy.physics.quantum.state.Wavefunction
#26520
base: master
Are you sure you want to change the base?
Conversation
✅ Hi, I am the SymPy bot. 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.13. Click here to see the pull request description that was parsed.
|
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) Significantly changed benchmark results (master vs previous release) | Change | Before [2487dbb5] | After [95085aaa] | Ratio | Benchmark (Parameter) |
|----------|----------------------|---------------------|---------|----------------------------------------------------------------------|
| - | 67.7±0.7ms | 44.3±0.4ms | 0.65 | integrate.TimeIntegrationRisch02.time_doit(10) |
| - | 66.8±0.6ms | 43.3±0.3ms | 0.65 | integrate.TimeIntegrationRisch02.time_doit_risch(10) |
| + | 18.5±0.2μs | 30.9±0.2μs | 1.67 | integrate.TimeIntegrationRisch03.time_doit(1) |
| - | 5.41±0.02ms | 2.83±0.04ms | 0.52 | logic.LogicSuite.time_load_file |
| - | 72.2±0.2ms | 29.3±0.09ms | 0.41 | polys.TimeGCD_GaussInt.time_op(1, 'dense') |
| - | 25.5±0.06ms | 16.9±0.07ms | 0.67 | polys.TimeGCD_GaussInt.time_op(1, 'expr') |
| - | 72.5±0.4ms | 29.6±0.2ms | 0.41 | polys.TimeGCD_GaussInt.time_op(1, 'sparse') |
| - | 253±2ms | 127±0.3ms | 0.5 | polys.TimeGCD_GaussInt.time_op(2, 'dense') |
| - | 252±0.5ms | 127±0.6ms | 0.51 | polys.TimeGCD_GaussInt.time_op(2, 'sparse') |
| - | 652±1ms | 383±3ms | 0.59 | polys.TimeGCD_GaussInt.time_op(3, 'dense') |
| - | 648±2ms | 382±1ms | 0.59 | polys.TimeGCD_GaussInt.time_op(3, 'sparse') |
| - | 490±7μs | 286±1μs | 0.58 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(1, 'dense') |
| - | 1.76±0ms | 1.04±0ms | 0.59 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(2, 'dense') |
| - | 5.81±0.04ms | 3.10±0.02ms | 0.53 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 444±7μs | 230±2μs | 0.52 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(1, 'dense') |
| - | 1.48±0ms | 699±10μs | 0.47 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(2, 'dense') |
| - | 4.86±0.03ms | 1.66±0.02ms | 0.34 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 376±2μs | 204±2μs | 0.54 | polys.TimeGCD_SparseGCDHighDegree.time_op(1, 'dense') |
| - | 2.45±0.02ms | 1.23±0ms | 0.5 | polys.TimeGCD_SparseGCDHighDegree.time_op(3, 'dense') |
| - | 10.0±0.08ms | 4.37±0.02ms | 0.44 | polys.TimeGCD_SparseGCDHighDegree.time_op(5, 'dense') |
| - | 358±0.9μs | 171±1μs | 0.48 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(1, 'dense') |
| - | 2.50±0.02ms | 892±5μs | 0.36 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(3, 'dense') |
| - | 9.57±0.1ms | 2.62±0.01ms | 0.27 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(5, 'dense') |
| - | 1.02±0.01ms | 425±3μs | 0.41 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 1.71±0.01ms | 500±2μs | 0.29 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 5.76±0.06ms | 1.79±0.01ms | 0.31 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'dense') |
| - | 8.41±0.06ms | 1.49±0ms | 0.18 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse') |
| - | 282±0.9μs | 65.2±0.4μs | 0.23 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 3.40±0.03ms | 399±2μs | 0.12 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 3.98±0.03ms | 277±0.7μs | 0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 6.92±0.03ms | 1.27±0.01ms | 0.18 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'dense') |
| - | 8.51±0.06ms | 851±10μs | 0.1 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse') |
| - | 4.98±0.02ms | 2.96±0.01ms | 0.59 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| - | 12.2±0.1ms | 6.53±0.03ms | 0.54 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 22.2±0.08ms | 8.97±0.01ms | 0.4 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 5.23±0.03ms | 858±4μs | 0.16 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 12.4±0.07ms | 6.98±0.02ms | 0.56 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse') |
| - | 102±0.5ms | 25.5±0.1ms | 0.25 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 168±2ms | 53.7±0.3ms | 0.32 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 172±2μs | 112±0.5μs | 0.65 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'dense') |
| - | 363±2μs | 215±0.9μs | 0.59 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'sparse') |
| - | 4.19±0.04ms | 838±1μs | 0.2 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'dense') |
| - | 5.29±0.04ms | 382±1μs | 0.07 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse') |
| - | 19.8±0.1ms | 2.78±0.01ms | 0.14 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'dense') |
| - | 22.6±0.2ms | 622±2μs | 0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse') |
| - | 475±1μs | 135±0.9μs | 0.29 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| - | 4.58±0.02ms | 605±2μs | 0.13 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'dense') |
| - | 5.26±0.02ms | 141±0.7μs | 0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| - | 13.5±0.05ms | 1.30±0ms | 0.1 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'dense') |
| - | 13.9±0.2ms | 142±0.5μs | 0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| - | 131±0.4μs | 75.3±0.3μs | 0.57 | solve.TimeMatrixOperations.time_rref(3, 0) |
| - | 256±2μs | 88.3±0.2μs | 0.34 | solve.TimeMatrixOperations.time_rref(4, 0) |
| - | 23.9±0.2ms | 10.2±0.03ms | 0.43 | solve.TimeSolveLinSys189x49.time_solve_lin_sys |
| - | 28.6±0.3ms | 15.5±0.1ms | 0.54 | solve.TimeSparseSystem.time_linsolve_Aaug(20) |
| - | 54.3±0.3ms | 25.0±0.1ms | 0.46 | solve.TimeSparseSystem.time_linsolve_Aaug(30) |
| - | 28.0±0.1ms | 15.2±0.07ms | 0.54 | solve.TimeSparseSystem.time_linsolve_Ab(20) |
| - | 54.5±0.2ms | 24.6±0.1ms | 0.45 | solve.TimeSparseSystem.time_linsolve_Ab(30) |
Full benchmark results can be found as artifacts in GitHub Actions |
@@ -1266,4 +1266,4 @@ Augusto Borges <borges.augustoar@gmail.com> | |||
Han Wei Ang <ang.h.w@u.nus.edu> | |||
Pablo <48098178+PabloRuizCuevas@users.noreply.github.com> | |||
Congxu Yang <u7189828@anu.edu.au> | |||
Saicharan <62512681+saicharan2804@users.noreply.github.com> | |||
Saicharan <62512681+saicharan2804@users.noreply.github.com> |
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.
The AUTHORS file should not be edited.
sympy/physics/quantum/state.py
Outdated
@@ -665,7 +666,7 @@ def _eval_innerproduct(self, bra, **hints): | |||
return S.Zero # i.e. Integer(0) | |||
|
|||
if is_zero is None: | |||
return None | |||
return KroneckerDelta(arg, bra_arg) |
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'm not sure about this.
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.
The point of this is that
@@ -909,6 +910,50 @@ def expr(self): | |||
""" | |||
return self._args[0] | |||
|
|||
@staticmethod | |||
def extract_expression_from_wavefunction(input_expression): |
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.
This function does not seem to be used anywhere.
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 added this as a handicap to extract the expression from the wavefunction objects. In the current state, simply doing .expr
on a linear combination of wavefunction objects yields an error.
I don't quite understand the purpose of this PR but tests should be added for any new functionality. |
The purpose of this PR is to improve the usability of the affected classes and make the package less infuriating to work with. Will add a test for them soon. |
This does not explain at all what the purpose of this PR is. If you want these changes to be considered you will need to explain their purpose. Please understand that I do not know the quantum module myself (it is unmaintained). |
…nd Bra for clarity.
OthogonalKet -> OrhtonormalKetWhen you have an orthonormal basis of Kets WavefunctionI added that method so that it is easier to convert a Wavefunction object to an ordinary Function object. Let me know if you need further clarification |
…to OrthonormalKet and Bra for clarity.
No idea what this is about |
References to other Issues or PRs
N/A
Brief description of what is fixed or changed
Added a method on
sympy.physics.quantum.state.Wavefunction
to replace instances ofWavefunction
objects with their internal expressions.Refer to this stack overflow question for more context: link.
Other comments
N/A
Release Notes
Wavefunctions
objects.