Re: [julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-21 Thread David P. Sanders
El martes, 21 de octubre de 2014 14:25:33 UTC-5, Roy Wang escribió: > > This is great, thanks! > > I verified pointer(X) is the same as what pointer(x_next) used to be > before running your line of code, and pointer(x_next) after running your > line of code is the same as pointer(x). > > I did

Re: [julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-21 Thread Roy Wang
This is great, thanks! I verified pointer(X) is the same as what pointer(x_next) used to be before running your line of code, and pointer(x_next) after running your line of code is the same as pointer(x). I did not know of this about Julia! On Saturday, 4 October 2014 11:05:33 UTC-4, David P.

Re: [julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-04 Thread David P. Sanders
Hi, Are you sure that you need a copy operation? If I understand correctly what you are doing, you just need access to the x from the previous iteration. Could you not just swap x and x_next and avoid the copy : X, x_next = x_next, x (so you create them once only).

Re: [julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-02 Thread Roy Wang
Is there a version of copy!() that uses @parallel? My x and x_next are usually huge. On Thursday, 2 October 2014 18:32:32 UTC-4, Roy Wang wrote: > > Hey John, > > Ah geez, copy!() was only 2 lines lower than copy() in abstractarray.jl. > Thanks! > > > On Thursday, 2 October 2014 18:25:22 UTC-4,

Re: [julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-02 Thread Roy Wang
Hey John, Ah geez, copy!() was only 2 lines lower than copy() in abstractarray.jl. Thanks! On Thursday, 2 October 2014 18:25:22 UTC-4, John Myles White wrote: > > Why not use copy! > > -- John > > On Oct 2, 2014, at 3:24 PM, Roy Wang > > wrote: > > > This kind of routine is what I'm talking

[julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-02 Thread Roy Wang
oops, add @assert eltype(a) == eltype(b) in the checks too, otherwise there might be an "inexact error" when mixing integers and floats.

Re: [julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-02 Thread John Myles White
Why not use copy! -- John On Oct 2, 2014, at 3:24 PM, Roy Wang wrote: > > This kind of routine is what I'm talking about... > > # copy assignment for vectors > function copyassignment!(a::Vector,b::Vector) > @assert length(a) == length(b) > for n=1:length(a) > a[n]=b[n]; >

[julia-users] Re: copy assignment opeartion on existing and valid destination arrays

2014-10-02 Thread Roy Wang
This kind of routine is what I'm talking about... # copy assignment for vectors function copyassignment!(a::Vector,b::Vector) @assert length(a) == length(b) for n=1:length(a) a[n]=b[n]; end end My questions: 1) Is there a standard function that does this? 2) Is there a better