SciML / SciML/ComponentArrays.jl

Extend KeepIndex to Vector indices

Open
#243 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
375
Forks
42
Avg merge
7h 25m
Merged PRs (30d)
17

Description

Using an example from the documentation:

julia> ca = ComponentArray(a=5, b=[4, 1], c=(a=2, b=[6, 30]))
ComponentVector{Int64}(a = 5, b = [4, 1], c = (a = 2, b = [6, 30]))

julia> ca[KeepIndex(:b)]
ComponentVector{Int64}(b = [4, 1])

julia> ca[KeepIndex(1)]
ComponentVector{Int64}(a = 5)

julia> ca[KeepIndex(2:3)]
ComponentVector{Int64}(b = [4, 1])

julia> ca[KeepIndex([2,3])]
ERROR: TypeError: in Type, in parameter, expected Type, got a value of type Vector{Int64}

How hard would it be to extend the KeepIndex functionality to more general types of indices?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the KeepIndex implementation and the documentation example shown in this issue. Reproduce the KeepIndex([2, 3]) failure, then determine which general index types should be supported and how success should be verified without the current TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.