Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lassepe opened this issue Jun 16, 2024 · 0 comments

Comments

@lassepe
Copy link

lassepe commented Jun 16, 2024

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.

@lassepe lassepe changed the title Adding BlockVector with regular vector causes axes to be promoted from BlockedOneTo to BlockedUnitRange +(::BlockVector, ::Vector) promotes axis from BlockedOneTo to BlockedUnitRange Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant