Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

PriyanshuPansari
Copy link

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 of
the new Qobj are set to this list. This can produce either oper or
super depending on the passed dimensions.
N: int
Number of Fock states in Hilbert space.

@PriyanshuPansari
Copy link
Author

@Ericgig

@coveralls
Copy link

Coverage Status

Coverage: 72.04% (-0.003%) from 72.042% when pulling a16b284 on PriyanshuPansari:dim into 1253740 on qutip:master.

Copy link
Member

@Ericgig Ericgig left a 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.

Comment on lines +632 to +634
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.
Copy link
Member

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.
Copy link
Member

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.
Copy link
Member

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.

@Ericgig
Copy link
Member

Ericgig commented Mar 5, 2024

Thank you again @PriyanshuPansari, but this is no longer relevant.

@Ericgig Ericgig closed this Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better operator dimension parameterisation
3 participants