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

[ENHANCEMENT] Support indexing of the form a["i" => 1, ..] #23

Open
mtfishman opened this issue Jan 17, 2025 · 0 comments
Open

[ENHANCEMENT] Support indexing of the form a["i" => 1, ..] #23

mtfishman opened this issue Jan 17, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@mtfishman
Copy link
Member

Support EllipsisNotation.jl indexing with ..:

using NamedDimsArrays
a = nameddims(randn(4, 4, 4), ("i", "j", "k"))
a["i" => 1, ..] # Equivalent to `a["i" => 1, "j" => :, "k" => :]`
a[.., "i" => 1] # Same thing, order doesn't matter

That would be very convenient notation for truncated tensor SVD, which would become:

u, s, v = svd(a, ("i",))
α = only(intersect(dimnames(u), dimnames(s)))
r = 1:3
u[α => r, ..], s[α => r, α => r], v[α => r, ..]
@mtfishman mtfishman added the enhancement New feature or request label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant