> OK, thanks for this info. I wonder whether e.g. view(A, :, 
> 2:size(A,2))[end-10:end] will create a copy of the data or only a 
> reference. 

That depends on the implementation of getindex for ArrayView which could
do either.  Easy to check though:
typeof(view(A, :, 2:size(A,2))[end-10:end])

BTW, I think it's planned to make [] return a view by default sometime
in the future.

M

> In Julia v0.3 bracket expressions like A[:,2:end] will actually 
> create a copy what imposes quite an overhead if A is large.
>
> Jan
>
> Dňa streda, 24. septembra 2014 12:21:26 UTC+2 Mauro napísal(-a):
>>
>> Yes, I think this is a limitation of Julia.  `end` is really just 
>> syntactic sugar: expressions like `A[1,end]` will be replaced by 
>> `A[1,size(A,2)]` before being further parsed.  (at least that is my 
>> understanding.)  If there is no `[]` indexing syntax then `end` cannot 
>> work`.  Thus to construct the view you cannot use `end` but once you 
>> have it it works, e.g. `view(A, :, 2:end)[1,end]` 
>>
>> On Wed, 2014-09-24 at 05:42, Ján Dolinský <jan.do...@2bridgz.com 
>> <javascript:>> wrote: 
>> > Hello, 
>> > 
>> > I am using ArrayViews but it seems that statements with "end" keyword 
>> are 
>> > not supported e.g. view(A, :, 2:end) throws an error and I have to use 
>> > view(A, :, 2:size(A,2)). Is this the way it is meant to be ? No "end" 
>> > keyword with ArrayViews ? 
>> > 
>> > Thanks, 
>> > Jan 
>>
>>

-- 

Reply via email to