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

eltype and ndims of an OffsetArray matches that of the parent #163

Merged
merged 1 commit into from
Oct 7, 2020

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Oct 7, 2020

Fixes #162

Now

julia> OffsetMatrix{Float64, Matrix{ComplexF64}}
ERROR: TypeError: in Type, in AA, expected AA<:AbstractArray{Float64,2}, got Type{Array{Complex{Float64},2}}

also,

julia> OffsetMatrix{Float64, Vector{Float64}}
ERROR: TypeError: in Type, in AA, expected AA<:AbstractArray{Float64,2}, got Type{Array{Float64,1}}

@codecov
Copy link

codecov bot commented Oct 7, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@87666ee). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #163   +/-   ##
=========================================
  Coverage          ?   99.21%           
=========================================
  Files             ?        4           
  Lines             ?      256           
  Branches          ?        0           
=========================================
  Hits              ?      254           
  Misses            ?        2           
  Partials          ?        0           
Impacted Files Coverage Δ
src/OffsetArrays.jl 99.44% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87666ee...f02d12a. Read the comment docs.

@jishnub
Copy link
Member Author

jishnub commented Oct 7, 2020

Leaving open as I'm not entirely sure if there are cases where the ndims might not be identical

Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

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

I don't think we need that much flexibility here.

There are many ways to insert the missing dimension without memory allocation, e.g.,

Base.ReshapedArray(A, (1, 4, 4), ())

@timholy
Copy link
Member

timholy commented Oct 7, 2020

Better to call reshape, though, rather than the constructor itself. Normal users don't want to have to deal with Base.MultiplicativeInverses.

@jishnub jishnub merged commit 08f969b into JuliaArrays:master Oct 7, 2020
@jishnub jishnub deleted the constructortype branch October 7, 2020 13:26
@timholy
Copy link
Member

timholy commented Oct 12, 2020

Hmm, this turned out to be pretty breaking for a patch release (at least for ImageCore). In retrospect we should have bumped to 1.4. I would still call this a bug fix, but it's a pretty big (& important) one.

@jishnub
Copy link
Member Author

jishnub commented Oct 12, 2020

I'm not familiar with ImageCore, could you point me towards an example that breaks as a consequence of this change?

@johnnychen94
Copy link
Member

johnnychen94 commented Oct 12, 2020

JuliaImages/ImageCore.jl#149, no worries, that breakage is "expected" and is fixable. Just that this patch release breaks something...

@timholy
Copy link
Member

timholy commented Oct 12, 2020

Yep, @johnnychen94 is right. Really, it was misguided of OffsetArrays to implement those methods in the first place.

I've released my share of patch releases that broke something. Just thought I'd mention it since these questions of what to call releases come up all the time (typically, without a crystal-clear answer).

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.

Element type of an OffsetArray must match that of the parent array
3 participants