Skip to content

deprecate repmat() ? #402

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

Closed
bjarthur opened this issue Feb 7, 2017 · 8 comments
Closed

deprecate repmat() ? #402

bjarthur opened this issue Feb 7, 2017 · 8 comments
Labels
deprecation This change introduces or involves a deprecation

Comments

@bjarthur
Copy link
Contributor

bjarthur commented Feb 7, 2017

given repeat, should repmat be deprecated? the latter cannot handle more than 2 dimensions, and does not have the flexibility provided by the former's inner argument. happy to draft a PR if there is consensus.

@fredrikekre
Copy link
Member

fredrikekre commented Feb 7, 2017

repeat is (in the current form) ~1000 times slower than repmat and uses ~40 times more memory:

julia> using BenchmarkTools

julia> for N in (10, 50, 100)
           A = rand(N, N)
           outer = (N, N)
           @btime repmat($A, $N, $N)
           @btime repeat($A, outer = $outer)
       end
  11.313 μs (202 allocations: 84.45 KiB)
  10.518 ms (119017 allocations: 3.11 MiB)
  5.407 ms (5002 allocations: 47.84 MiB)
  7.397 s (79971519 allocations: 1.98 GiB)
  106.325 ms (20002 allocations: 763.55 MiB)
  112.596 s (1294889019 allocations: 31.96 GiB)

@ararslan ararslan added deprecation This change introduces or involves a deprecation linear algebra labels Feb 7, 2017
@JeffBezanson
Copy link
Member

ref JuliaLang/julia#15553

@oscardssmith
Copy link
Member

As a temporary solution, could repmat be deprecated, and a fast path added that uses the current repmat code when applicable?

@nalimilan
Copy link
Member

repmat is faster, but its return type is also inferrable, which isn't currently the case for repeat. So I'm afraid we'll have to keep it until the compiler improves. Cf. JuliaLang/julia#14082

@johnmyleswhite
Copy link
Member

Would the return type be inferrable if we only allowed tuples as arguments for inner and outer and didn't use keyword arguments?

@timholy
Copy link
Member

timholy commented Feb 12, 2017

Yes, with those constraints one could make it inferrable.

@nalimilan
Copy link
Member

This discussion already happened at JuliaLang/julia#12953 and JuliaLang/julia#14082, and it was decided to keep keyword arguments.

@JeffBezanson
Copy link
Member

Closed by JuliaLang/julia#26039

@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation
Projects
None yet
Development

No branches or pull requests

8 participants