Le vendredi 10 janvier 2014 à 13:36 -0500, Stefan Karpinski a écrit :
> You really want those to be colindex::Int and rowindex::Int – Integer
> is an abstract type, whereas Int is the concrete type of the native
> size integer (32/64 depending on your system).
> 
Random suggestion of the day: how about renaming Integer to AbstractInt
(or anything else)? Else, be prepared to get many remarks like this over
the years, especially when less experienced people will start using
Julia. Integer is a very appealing name for somebody looking for the
name of the integer type... ;-)


Regards


> On Fri, Jan 10, 2014 at 5:42 AM, Sheehan Olver <[email protected]>
> wrote:
> 
>         Hi,
>         
>         
>         
>         I have the code below that wraps an array to allow
>         non-standard index ranges, as part of an implementation of a
>         linear algebra algorithm (Givens rotations).  Surprisingly the
>         setindex! routine is taking a significant portion of the
>         computational cost, 30%, so I think I must not be getting the
>         command to compile properly.  Any hints?
>         
>         
>         
>         
>         Cheers,
>         
>         
>         Sheehan
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         
>         type ShiftArray{T<:Number}
>           data::Array{T,2}
>           colindex::Integer
>           rowindex::Integer
>         end
>         
>         
>         
> Base.setindex!{T<:Number}(S::ShiftArray{T},x::T,k::Integer,j::Integer)=(S.data[k
>  + S.rowindex, j + S.colindex] = x)
> 
> 
> 

Reply via email to