-
Notifications
You must be signed in to change notification settings - Fork 621
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
Better operator dimension parameterisation #2075
Conversation
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.
Please add a towncrier entry in qutip/doc/change/2075.misc
.
Also, do not close this pull request and open a new one. You can just push new commits to your branch and this PR will be updated.
dimensions : int (default: 2) / list of ints | ||
Number of Fock states in Hilbert space. If a list, then the resultant | ||
object will be a tensor product over spaces with those dimensions. |
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 is now wrong when an integer is passed: that number will not be the total number of Fock states, but the size of each spaces, one for each element in seq
. Let's leave the doc string as is for now. ket
and bra
are don't follow normal convention anyway.
@@ -1279,7 +1281,7 @@ def w_state(N=3, *, dtype=_data.Dense): | |||
Parameters | |||
---------- | |||
N : int (default=3) | |||
Number of qubits in state | |||
Number of Fock states in Hilbert space. |
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.
Here N
is a number of qubit, not the size of a space...
The variable name could be changed to avoid confusion.
A list of the dimensions of each subsystem of a composite quantum | ||
system. | ||
dims : list or array | ||
The quantum state dimensions array, as it would appear in a Qobj. |
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.
All enr_...
functions take the same dims
input. It's doc-string should match between the enr_operators and enr_states.
Thank you again @PriyanshuPansari, but this is no longer relevant. |
Removed the inconsistency in the dimension argument of Qutip operators in the naming, type, and description.
Proposed generalization - use N to denote the dimension of Hilbert space if it's int or denote a list with the number of states in each sub-system if it's a list.
fixes #1722
Used the following conventions-
in States.py-
dimensions : int or list of ints
Number of Fock states in Hilbert space. If a list, then the resultant
object will be a tensor product over spaces with those dimensions.
N: int
Number of Fock states in Hilbert space.
dims : list or array
The quantum state dimensions array, as it would appear in a Qobj.
dim: list
A list with the number of states in each sub-system.
in Opearator.py-
dimensions : (int) or (list of int) or (list of list of int)
Dimension of Hilbert space. If provided as a list of ints, then the
dimension is the product over this list, but the
dims
property ofthe new Qobj are set to this list. This can produce either
oper
orsuper
depending on the passeddimensions
.N: int
Number of Fock states in Hilbert space.