Skip to content

Try to use vector multiplication for truncation error computation#443

Open
kshyatt wants to merge 1 commit into
mainfrom
ksh/cutruncerr
Open

Try to use vector multiplication for truncation error computation#443
kshyatt wants to merge 1 commit into
mainfrom
ksh/cutruncerr

Conversation

@kshyatt

@kshyatt kshyatt commented Jun 1, 2026

Copy link
Copy Markdown
Member

I'll add benchmarks to this after I have dinner. I think this should work ok (at least for trivial SectorVectors?) because the boolean inds are just 0 or 1 and we can multiply by their ! to set stuff to zero. That kernel seems to be a bit faster.

@lkdvos lkdvos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess this only works for logical indices though, so probably have to specialize on that? Additionally, if we write custom code for that, you might be able to combine the norm and truncation pass with broadcasting (you can take a norm of a broadcast expression), since the norm also needs to spawn multiple kernels to include the quantum dimensions?

@kshyatt

kshyatt commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

you can take a norm of a broadcast expression

For GPU arrays? I'm not sure about this tbh, it wasn't working with norm(x, Inf) but perhaps for 2-norm it's ok, I'll try

@kshyatt

kshyatt commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

Also I don't think we can bcast over values itself because it's a subtype of AbstractDict

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
ext/TensorKitGPUArraysExt.jl 89.09% <100.00%> (+1.33%) ⬆️

... and 17 files with indirect coverage changes

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

@kshyatt
kshyatt marked this pull request as ready for review July 17, 2026 11:40
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.

2 participants