Skip to content

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

@lassepe

Description

@lassepe

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.

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