Skip to content
This repository was archived by the owner on Aug 26, 2026. It is now read-only.

custom dimensions for a multimode density matrix - #406

Open
svan5003 wants to merge 10 commits into
XanaduAI:masterfrom
svan5003:density_matrix_flexible_cutoff
Open

svan5003 wants to merge 10 commits into
XanaduAI:masterfrom
svan5003:density_matrix_flexible_cutoff

Conversation

@svan5003

@svan5003 svan5003 commented Oct 20, 2025 •

Copy link
Copy Markdown

Context:
'cutoff' argument for the 'density_matrix(mu, cov, post_select, normalize, cutoff, hbar)' function from 'fock_tensors.py' is the same for all modes

Description of the Change:
Added support of the 'list' type of 'cutoff' argument for the 'density_matrix(mu, cov, post_select, normalize, cutoff, hbar)' function from 'fock_tensors.py'. It enables to perform larger simulations.
Example: 4 bosonic modes
Hilbert space dimensions 20 for each mode => ~380 GB of RAM for a density matrix.
Hilbert space dimensions 20 for 2 main and 3 for auxiliary modes => 200 MB of RAM for a density matrix.

Benefits:
Enables users to choose different Hilbert space dimensions for different modes of a density matrix. It can be helpful for simulations with a large number of modes.

Possible Drawbacks:
None

Related GitHub Issues:
None

@svan5003 svan5003 changed the title custom dimensions for multimode density matrix custom dimensions for a multimode density matrix Oct 20, 2025
Comment thread thewalrus/quantum/fock_tensors.py Outdated
Comment thread thewalrus/quantum/fock_tensors.py
Comment thread .github/CHANGELOG.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should go in the 0.23 section

@svan5003 svan5003 Oct 20, 2025 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will fix CHANGELOG.md

I have a question. Although I didn't change function hermite_multidimensional in _hermite_multidimensional.py, it compatible with a list cutoff by design. Should I change the documentation of this function?

ziofil and others added 4 commits October 20, 2025 13:11
Co-authored-by: Filippo Miatto <ziofil@users.noreply.github.com>
Co-authored-by: Filippo Miatto <ziofil@users.noreply.github.com>
@svan5003

Copy link
Copy Markdown
Author

@ziofil, can I do something to help this change appear in the next release?

@ziofil

ziofil commented Jan 16, 2026

Copy link
Copy Markdown
Collaborator

@svan5003 yes, let's merge this PR :)
You should run black -l 100 thewalrus/. The rest looks ok to me. As soon as all the tests and checks are green we can merge it.

@codecov

codecov Bot commented Jan 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (12633ca) to head (9a6fdc9).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #406   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           28        28           
  Lines         1922      1941   +19     
=========================================
+ Hits          1922      1941   +19     
Files with missing lines Coverage Δ
thewalrus/quantum/fock_tensors.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54b1062...9a6fdc9. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@svan5003

Copy link
Copy Markdown
Author

@ziofil thanks for the feedback! I've just run the suggested command locally and committed changes. Now, it must be fine

@svan5003

Copy link
Copy Markdown
Author

@ziofil could you please run the checks again?

@svan5003

svan5003 commented Aug 9, 2026

Copy link
Copy Markdown
Author

Hi @ziofil, is this pull request still relevant? Please let me know if any further changes are needed

@svan5003
svan5003 requested a review from ziofil August 11, 2026 08:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants