Skip to content

Commit

Permalink
Vector indexing a PseudoBlockArray of a FillArray (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub authored Apr 2, 2024
1 parent d2a05fe commit 7f94ae9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BlockArrays"
uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
version = "0.16.43"
version = "0.16.44-dev"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
6 changes: 6 additions & 0 deletions src/pseudo_blockarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,9 @@ Base.replace_in_print_matrix(f::PseudoBlockVecOrMat, i::Integer, j::Integer, s::


LinearAlgebra.norm(A::PseudoBlockArray, p::Real=2) = norm(A.blocks, p)

###########################
# FillArrays interface #
###########################

FillArrays.getindex_value(P::PseudoBlockArray) = FillArrays.getindex_value(P.blocks)
7 changes: 7 additions & 0 deletions test/test_blockarrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,13 @@ end
@test BLAS.gemv!('N', 2.0, A, x, 0.0, y) 2A*x
end

@testset "FillArrays interface" begin
P = PseudoBlockArray(Fill(3,4,4), [1,3], [1,3])
@test P[1:3, 2:3] === Fill(3,3,2)
@test P[1:3, 1] == Fill(3,3)
@test P[2, 1:3] == Fill(3,3)
end

@testset "lmul!/rmul!" begin
A = PseudoBlockArray{Float64}(undef, 1:3)
@test fill!(A, NaN) === A
Expand Down

0 comments on commit 7f94ae9

Please sign in to comment.