ArrayViews doesn't support indexing with ranges, vectors, etc. on Julia 
0.3, although this should work on Julia 0.4. (Also on 0.4, SubArrays 
created with sub/slice should be equally fast as ArrayViews, and both 
should be faster than on 0.3.) On 0.3 you need to write an explicit loop to 
set multiple indices with ArrayViews.

Simon

On Thursday, August 13, 2015 at 6:52:03 PM UTC-4, Yee Whye Teh wrote:
>
> Apologies, newbie to Julia here.  
>
> I'm trying to use ArrayViews and ran into simple problem, where only the 
> simplest setindex! usage (1 entry) works with a view, and anything 
> involving more than one entry does not:
>
> *julia> **x = ones(4)*
>
> *4-element Array{Float64,1}:*
>
> * 1.0*
>
> * 1.0*
>
> * 1.0*
>
> * 1.0*
>
>
> *julia> **y=view(x,:)*
>
> *4-element ContiguousView{Float64,1,Array{Float64,1}}:*
>
> * 1.0*
>
> * 1.0*
>
> * 1.0*
>
> * 1.0*
>
>
> *julia> **x[1:2]=5 # ok*
>
> *5*
>
>
> *julia> **y[1]=5 # ok*
>
> *5*
>
>
> *julia> **y[1:2]=6 # not ok*
>
> *ERROR: `setindex!` has no method matching 
> setindex!(::ContiguousView{Float64,1,Array{Float64,1}}, ::Int64, 
> ::UnitRange{Int64})*
>
>
>
> (I realize that there was a previous post related, but for complex 
> setindex! use.  This one is very simple and I'd think should work?)
>
> cheers,
> -yw
>

Reply via email to