Skip to content

Commit

Permalink
Fix array constructor (#416)
Browse files Browse the repository at this point in the history
* eltype -> T

* add tests

* undo auto-format

* add compat for Images

* only use `RGB` from images

* try colors

* back to images

* fix Fill ambiguity

* original formatting

* Replace testset

* oops, begin

* bump patch version

---------

Co-authored-by: Kevin Bonham <[email protected]>
  • Loading branch information
kescobo and Kevin Bonham authored Sep 4, 2024
1 parent 836da5c commit 24564ec
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 14 additions & 2 deletions 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 = "1.1.0"
version = "1.1.1"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand All @@ -20,6 +20,7 @@ ArrayLayouts = "1.0.8"
BandedMatrices = "1.0"
Documenter = "1.0"
FillArrays = "1.11"
Images = "0.26"
LinearAlgebra = "1.6"
OffsetArrays = "1.0"
Random = "1.6"
Expand All @@ -32,11 +33,22 @@ julia = "1.6"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "BandedMatrices", "Documenter", "OffsetArrays", "SparseArrays", "StaticArrays", "Test", "Random"]
test = [
"Aqua",
"BandedMatrices",
"Documenter",
"Images",
"OffsetArrays",
"SparseArrays",
"StaticArrays",
"Test",
"Random",
]
2 changes: 1 addition & 1 deletion src/blockarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ function Base.Array(zerodim::BlockArray{T, 0}) where {T}
end

function Base.Array(block_array::BlockArray{T, N, R}) where {T,N,R}
arr = Array{eltype(T)}(undef, size(block_array))
arr = Array{T}(undef, size(block_array))
for block_index in Iterators.product(blockaxes(block_array)...)
indices = getindex.(axes(block_array), block_index)
arr[indices...] = @view block_array[block_index...]
Expand Down
4 changes: 3 additions & 1 deletion test/test_blockarrays.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module TestBlockArrays

using SparseArrays, BlockArrays, FillArrays, LinearAlgebra, Test, OffsetArrays
using SparseArrays, BlockArrays, FillArrays, LinearAlgebra, Test, OffsetArrays, Images
import BlockArrays: _BlockArray

const Fill = FillArrays.Fill

function test_error_message(f, needle, expected = Exception)
err = nothing
try
Expand Down

2 comments on commit 24564ec

@fredrikekre
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115007

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.1 -m "<description of version>" 24564ec6db45eecfd4e1699d987e9db948ccb50f
git push origin v1.1.1

Please sign in to comment.