Skip to content

Try to use vector multiplication for truncation error computation - #443

Merged
kshyatt merged 1 commit into
mainfrom
ksh/cutruncerr
Jul 28, 2026
Merged

Try to use vector multiplication for truncation error computation#443
kshyatt merged 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%) ⬆️
🚀 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
@kshyatt
kshyatt requested a review from lkdvos July 28, 2026 10:05

@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.

Looks good to me! Do you know if this is covered in the tests? If it is, good to go for me!

@kshyatt

kshyatt commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

It seems to be based on codecov

@kshyatt
kshyatt enabled auto-merge (squash) July 28, 2026 12:26
@kshyatt
kshyatt merged commit 8f9c313 into main Jul 28, 2026
151 of 153 checks passed
@kshyatt
kshyatt deleted the ksh/cutruncerr branch July 28, 2026 12: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