Julia: diff(Vector,dims=1)

Created on 6 Jul 2018  Â·  5Comments  Â·  Source: JuliaLang/julia

in 0.7.0-beta.108,
diff(ones(6),dims=1) gives

ERROR: MethodError: no method matching diff(::Array{Float64,1}; dims=1)

In contrast, sum(ones(6),dims=1) works.

arrays help wanted

Most helpful comment

Yes, I don't see why we shouldn't have a general diff(A::AbstractArray; dims) method which would also cover the Vector case.

All 5 comments

Yes, I don't see why we shouldn't have a general diff(A::AbstractArray; dims) method which would also cover the Vector case.

@PaulSoderlind Hey A newbie here. Can you please point me at the right direction?

I am certainly no expert either, but I believe the method is defined in

Julia-1.0.0\share\julia\base\multidimensional.jl

It looks like it would be straightforward to add a method.

/Paul S

On Fri, 17 Aug 2018 at 08:53, des2 notifications@github.com wrote:

@PaulSoderlind https://github.com/PaulSoderlind Hey A newbie here. Can
you please point me at the right direction?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/JuliaLang/julia/issues/27957#issuecomment-413774985,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI8Z1SyXvK6NWCxdReuhdCsd3GBTk7ngks5uRmhogaJpZM4VFbRn
.

What should its be behavior be?

Is it expected to be the same as

julia> reduce((x,y) -> x-y, ones(6))
-4.0

What should its be behavior be?

The same as cumsum seems to be a good starting point. /Paul S

On Sat, 25 Aug 2018 at 14:15, Rajesh Vaidheeswarran <
[email protected]> wrote:

What should its be behavior be?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/JuliaLang/julia/issues/27957#issuecomment-415965387,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI8Z1ZXHp80bRfhjd4Y00Gx0gr8EjpPoks5uUT_ngaJpZM4VFbRn
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manor picture manor  Â·  3Comments

omus picture omus  Â·  3Comments

tkoolen picture tkoolen  Â·  3Comments

yurivish picture yurivish  Â·  3Comments

Keno picture Keno  Â·  3Comments