Skip to content

Slicing with colon produces Vector instead of ComponentVector #56

@baggepinnen

Description

@baggepinnen

I'm trying to get ComponentVector to work with Optim.ParticleSwarm and am facing the following issue: when slicing into a matrix where there are components along the first axis, the result is a regular vector

julia> A
4×10 ComponentMatrix{Float64} with axes Axis(a = 1:2, b = 3:4) × FlatAxis()
 0.0           0.0           0.0             0.0           0.0           0.0
 0.0           0.0           0.0              0.0           0.0           0.0
 6.92009e-310  6.92009e-310  6.92009e-310     6.92009e-310  6.92009e-310  6.92017e-310
 6.92009e-310  6.92009e-310  6.92009e-310     6.92009e-310  1.0e-323      6.92017e-310

julia> A[:,1]
4-element Vector{Float64}:
 0.0
 0.0
 6.92009e-310
 6.92009e-310

In this case, I believe it should be possible to return a ComponentVector even if I index the component dimension with :?

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