Skip to content

Conversation

@ogauthe
Copy link
Contributor

@ogauthe ogauthe commented Jul 19, 2024

Fixes #409 and add tests.

BlockArrays are now fine, however BlockedArray are still broken. This is due to the type piracy on view mentioned in #409. I do not see how to fix it at the moment.

@ogauthe
Copy link
Contributor Author

ogauthe commented Jul 26, 2024

I implemented @dlfivefifty suggestions to fix unsafe_views type piracy. I also fixed several other issues, I hope I did not forget any standard use. unsafe_views aside, all other changes only affect zero-dimensional arrays and the main cases are unaffected.

@ogauthe ogauthe marked this pull request as draft July 26, 2024 19:12
@ogauthe
Copy link
Contributor Author

ogauthe commented Jul 26, 2024

For a zero-dimensional Array, .* and .^ return a scalar. This is a bit surprising, but it matches the behavior of Array so I think it is acceptable.

@ogauthe ogauthe marked this pull request as ready for review July 26, 2024 19:27
@codecov
Copy link

codecov bot commented Jul 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.66%. Comparing base (68cffad) to head (a5d3cc4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #410      +/-   ##
==========================================
+ Coverage   96.25%   96.66%   +0.41%     
==========================================
  Files          18       18              
  Lines        1628     1649      +21     
==========================================
+ Hits         1567     1594      +27     
+ Misses         61       55       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dlfivefifty
Copy link
Member

Can you get the codecov up?

downstream failure looks spurious

@ogauthe
Copy link
Contributor Author

ogauthe commented Jul 31, 2024

Should be fine now. Also realized reshape was broken.

@jishnub
Copy link
Member

jishnub commented Aug 1, 2024

This PR seems to add many methods. Do we really need them all? E.g. the Array constructor fails because of the ambiguity in view, so would resolving this get the constructor working without the need to add a specialized method?

@ogauthe
Copy link
Contributor Author

ogauthe commented Aug 1, 2024

I double checked, there were 3 changes that were not necessary. Reverting any other change breaks the tests.

@jishnub jishnub merged commit 836da5c into JuliaArrays:master Aug 5, 2024
@ogauthe ogauthe deleted the zerodim branch April 9, 2025 15:59
@ogauthe ogauthe mentioned this pull request Apr 10, 2025
jishnub pushed a commit that referenced this pull request Apr 12, 2025
`similar(::BlockArray` behaves in a surprising way for 0-dimensional
block arrays. This PR is a follow-up to #410 and aims for
`Base.similar(::T{<:AbstractBlockArray}` to still return a
`BlockArray/BlockedArray` in the zero-dimensional limit.
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

Successfully merging this pull request may close these issues.

zero dimensional BlockArray and BlockedArray are broken

3 participants