ahwillia / Einsum.jl

Einstein summation notation in Julia
MIT License
151 stars 17 forks source link

Return value of assigned result #22

Closed phipsgabler closed 6 years ago

phipsgabler commented 6 years ago

This is a different behaviour from TensorOperations.jl:

julia> @tensor r[k] := x[i] * M[k, i, j] * x[j]
5-element Array{Float64,1}:
 2.11926
 2.22626
 2.99243
 2.30047
 1.65922

julia> @einsum r[k] := x[i] * M[k, i, j] * x[j]

julia> r
5-element Array{Float64,1}:
 2.11926
 2.22626
 2.99243
 2.30047
 1.65922

I find it more natural if the result of an assignment is also immediately returned, that's basically what happens normally in Julia. Or was that a deliberate choice?

ahwillia commented 6 years ago

It wasn't deliberate. This could be changed.

On Tue, Mar 27, 2018, 1:54 AM Philipp Gabler notifications@github.com wrote:

This is a different behaviour from TensorOperations.jl:

julia> @tensor r[k] := x[i] M[k, i, j] x[j] 5-element Array{Float64,1}: 2.11926 2.22626 2.99243 2.30047 1.65922

julia> @einsum r[k] := x[i] M[k, i, j] x[j]

julia> r 5-element Array{Float64,1}: 2.11926 2.22626 2.99243 2.30047 1.65922

I find it more natural if the result of an assignment is also immediately returned, that's basically what happens normally in Julia. Or was that a deliberate choice?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ahwillia/Einsum.jl/issues/22, or mute the thread https://github.com/notifications/unsubscribe-auth/AAm20a9iRmH03lxmCbI0BZafaTIs0xIpks5tif5dgaJpZM4S8iM4 .

phipsgabler commented 6 years ago

Ok. I think I could make a pull request for this, then, when I find the time.