Skip to content

findmax does not squeeze out singleton index #18884

@floswald

Description

@floswald

i'm not sure whether this is intended but I think findmax does not conform to the new rule on singleton indices:

julia> x = rand(2,2,2)
2×2×2 Array{Float64,3}:
[:, :, 1] =
 0.319551  0.616412
 0.740493  0.112079

[:, :, 2] =
 0.0639773  0.376866
 0.475386   0.46051 

julia> z = findmax(x,2);

julia> z[1]
2×1×2 Array{Float64,3}:
[:, :, 1] =
 0.616412
 0.740493

[:, :, 2] =
 0.376866
 0.475386

I would expect a (2,2), i.e. the scalar dim should be squeezed out.

julia> versioninfo()
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

(sorry for posting on a merged PR before - deleted comment)

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