Skip to content

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

@mtfishman

Description

@mtfishman

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, ..]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions