Skip to content

AxisArrays: maximum not working on Julia 1.10Β #226

@tknopp

Description

@tknopp

We observed that AxisArrays has issues with Julia 1.10, that were not present in Julia 1.9. The code:

using AxisArrays, Unitful
B = AxisArray(randn(3,3), (:x,:y),(0.1u"mm",0.2u"mm"),(-0.1u"mm",-0.2u"mm"));
maximum(B, dims = 2)

results in an error

ERROR: DimensionError: 1.0 and 1.0 mm are not dimensionally compatible.
Stacktrace:
  [1] -(x::Quantity{Float64, NoDims, Unitful.FreeUnits{(), NoDims, nothing}}, y::Quantity{Float64, 𝐋, Unitful.FreeUnits{(mm,), 𝐋, nothing}})
    @ Unitful ~/.julia/packages/Unitful/R4J37/src/quantities.jl:137
  [2] -(x::Int64, y::Quantity{Float64, 𝐋, Unitful.FreeUnits{(mm,), 𝐋, nothing}})
    @ Base ./promotion.jl:424
  [3] Base.TwicePrecision{Quantity{Float64, 𝐋, Unitful.FreeUnits{(mm,), 𝐋, nothing}}}(x::Int64)
    @ Base ./twiceprecision.jl:207
  [4] StepRangeLen{Quantity{…}, Base.TwicePrecision{…}, Base.TwicePrecision{…}, Int64}(r::Base.OneTo{Int64})
    @ Base ./range.jl:1342
  [5] convert(::Type{StepRangeLen{Quantity{…}, Base.TwicePrecision{…}, Base.TwicePrecision{…}, Int64}}, r::Base.OneTo{Int64})
    @ Base ./range.jl:265
  [6] oftype(x::StepRangeLen{Quantity{…}, Base.TwicePrecision{…}, Base.TwicePrecision{…}, Int64}, y::Base.OneTo{Int64})
    @ Base ./essentials.jl:517
  [7] reduced_axis(ax::Axis{:y, StepRangeLen{Quantity{…}, Base.TwicePrecision{…}, Base.TwicePrecision{…}, Int64}})
    @ AxisArrays ~/.julia/packages/AxisArrays/CtyI0/src/core.jl:404
  [8] #19
    @ ~/.julia/packages/AxisArrays/CtyI0/src/core.jl:365 [inlined]
  [9] map
    @ ./tuple.jl:319 [inlined]
 [10] reduced_indices
    @ ~/.julia/packages/AxisArrays/CtyI0/src/core.jl:364 [inlined]
 [11] reduced_indices
    @ ~/.julia/packages/AxisArrays/CtyI0/src/core.jl:359 [inlined]
 [12] reduced_indices
    @ ~/.julia/packages/AxisArrays/CtyI0/src/core.jl:354 [inlined]
 [13] reducedim_init(f::Function, op::typeof(max), A::AxisMatrix{Float64, Matrix{Float64}, Tuple{Axis{…}, Axis{…}}}, region::Int64)
    @ Base ./reducedim.jl:131
 [14] _mapreduce_dim
    @ Base ./reducedim.jl:371 [inlined]
 [15] mapreduce
    @ Base ./reducedim.jl:357 [inlined]
 [16] _maximum
    @ Base ./reducedim.jl:1039 [inlined]
 [17] _maximum
    @ Base ./reducedim.jl:1038 [inlined]
 [18] #maximum#836
    @ Base ./reducedim.jl:1010 [inlined]
 [19] top-level scope
    @ REPL[6]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions