Re: [julia-users] Re: Memcpy with multidimensional arrays?

2015-02-10 Thread Patrick O'Leary
I wouldn't either, but copy!() is probably clearer, and at extremely low 
risk of ever meaning anything else.

On Monday, February 9, 2015 at 8:14:09 PM UTC-6, Jameson wrote:
>
> I wouldn't be surprised if `x[:] = y` dispatched to the `copy!` function 
> and was actually exactly equivalent.
>
> On Mon Feb 09 2015 at 7:38:32 PM Kirill Ignatiev <
> kirill.ignat...@gmail.com> wrote:
>
>> On Monday, 9 February 2015 19:07:37 UTC-5, Patrick O'Leary wrote:
>>>
>>> I think you can go with 
>>>
>>> copy!(x, y)
>>>
>>
>> That's it, thank you.
>>  
>>
>

Re: [julia-users] Re: Memcpy with multidimensional arrays?

2015-02-09 Thread Jameson Nash
I wouldn't be surprised if `x[:] = y` dispatched to the `copy!` function
and was actually exactly equivalent.

On Mon Feb 09 2015 at 7:38:32 PM Kirill Ignatiev 
wrote:

> On Monday, 9 February 2015 19:07:37 UTC-5, Patrick O'Leary wrote:
>>
>> I think you can go with
>>
>> copy!(x, y)
>>
>
> That's it, thank you.
>
>


[julia-users] Re: Memcpy with multidimensional arrays?

2015-02-09 Thread Kirill Ignatiev
On Monday, 9 February 2015 19:07:37 UTC-5, Patrick O'Leary wrote:
>
> I think you can go with 
>
> copy!(x, y)
>

That's it, thank you.
 


[julia-users] Re: Memcpy with multidimensional arrays?

2015-02-09 Thread Patrick O'Leary
I think you can go with 

copy!(x, y)

Quoting the built-in help for reference:

help?> copy!
INFO: Loading help data...
Base.copy!(dest, src)

   Copy all elements from collection "src" to array "dest".
   Returns "dest".

Base.copy!(dest, do, src, so, N)

   Copy "N" elements from collection "src" starting at offset
   "so", to array "dest" starting at offset "do". Returns
   "dest".

On Monday, February 9, 2015 at 5:54:26 PM UTC-6, Kirill Ignatiev wrote:
>
> Given two Float64 arrays x and y of the same shape, is x[:]=y the correct 
> way to *efficiently* copy all values from one array into the other?
>
> Basically, I would like the equivalent of memcpy, just copying memory, and 
> doing no extra work.
>