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

downsample?_loop doesn't support tuple #49

Closed
johnnychen94 opened this issue Jul 12, 2020 · 1 comment
Closed

downsample?_loop doesn't support tuple #49

johnnychen94 opened this issue Jul 12, 2020 · 1 comment

Comments

@johnnychen94
Copy link
Contributor

johnnychen94 commented Jul 12, 2020

It's a better practice in Julia to represent sizes or parameters as tuple instead of vector/array because 1) Tuple is static and immutable 2) Julia has a lot of optimization on Tuple to reduce its overhead.

For this reason, it's better to change the type annotation of down to Tuple or NTuple{3, Integer}, and give a deprecation for AbstractVector:

function downsample2(x::AbstractMatrix{<:Number},
down::AbstractVector{Int},
; warn::Bool = isinteractive(),
T::DataType = eltype(x[1] / down[1])
)

If you still plan to support AbstractVector, then it could be Union{Tuple, AbstractVector{<:Integer}} in this case. BTW, it's not generic to write AbstractVector{Int}, it should be AbstractVector{<:Integer}

I just accidentally run into this case when setting up benchmark CI, there might be many others in MIRT.

@JeffFessler JeffFessler mentioned this issue Jul 13, 2020
@JeffFessler
Copy link
Owner

Thanks - I've fixed it and in related places.
There are probably more and I'll look out for them going forward.

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

2 participants