JuliaArrays / JuliaArrays/BlockArrays.jl

`+(::BlockVector, ::Vector)` promotes axis from `BlockedOneTo` to `BlockedUnitRange`

Open
#406 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
254
Forks
39
PR merge metrics
No merged PRs in 30d

Description

As the title says:

using BlockArrays: mortar

julia> a = rand(4)
4-element Vector{Float64}:
 0.8245882057036666
 0.6496327699506389
 0.2058423091408491
 0.22035347885553225

julia> b = mortar([rand(2), rand(2)])
2-blocked 4-element BlockVector{Float64}:
 0.21798163954085292
 0.5995732233841912 
 ───────────────────
 0.7830701187033979 
 0.662908943211767  

julia> a + b
2-blocked 4-element BlockVector{Float64, Vector{Vector{Float64}}, Tuple{BlockedUnitRange{Int64, Vector{Int64}}}}:
 1.0425698452445196
 1.24920599333483  
 ──────────────────
 0.988912427844247 
 0.8832624220672992

The result of a + b should have the same axis type as b. I noticed this because I had a vector c = [b] and couldn't push a + b into c because the types don't match.

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the mixed addition shown in the issue and start at the +(::BlockVector, ::Vector) entry point named in the title. Trace how the result axis type is selected; done means a + b preserves b's BlockedUnitRange axis type and remains usable where a BlockVector with that axis type is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.