Skip to content

Allow vector-like init for ArrayPartitions/VectorOfArrays #544

Closed

Description

@rokke-git

Is your feature request related to a problem? Please describe.

the function names ArrayPartition() and VectorOfArray() are quite long, and take up the majority of the space of small functions. For example,

f(y,p,t) = ArrayParition(f1(y),
                         f2(y),
                         f3(y))
ODEProblem(f, ArrayPartition(A, B, C), (0, 1)) |> solve

Describe the solution you’d like

It would be nice if we could use the vector-like initialization like with StaticArrays:

f(y,p,t) = AP[f1(y),
              f2(y),
              f3(y)]
ODEProblem(f, AP[A, B, C], (0, 1)) |> solve

Additional context

This is pretty easily implemented in a few lines:

struct AP end
struct VA end
Base.getindex(::Type{AP}, xs...) = ArrayPartition(xs...)
Base.getindex(::Type{VA}, xs...) = VectorOfArray(collect(xs))
export AP, VA

Activity

  1. changed the title [-]Allow vector-like creation of `ArrayPartition`s/`VectorOfArray`s[/-] [+]Allow vector-like init for `ArrayPartition`s/`VectorOfArray`s[/+] on Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions