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
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.
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).
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,
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
oops, add
@assert eltype(a) == eltype(b)
in the checks too, otherwise there might be an "inexact error" when mixing
integers and floats.
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];
>
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