Skip to content

Try to use vector multiplication for truncation error computation#443

Draft
kshyatt wants to merge 2 commits into
mainfrom
ksh/cutruncerr
Draft

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

Conversation

@kshyatt
Copy link
Copy Markdown
Member

@kshyatt kshyatt commented Jun 1, 2026

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.

Copy link
Copy Markdown
Member

@lkdvos lkdvos left a comment

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
Copy link
Copy Markdown
Member Author

kshyatt commented Jun 2, 2026

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
Copy link
Copy Markdown
Member Author

kshyatt commented Jun 2, 2026

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

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