You can also do

D[i+1-d>>1:j-3+q*5]

which is actually slightly faster. It looks a bit obscure at first, but now 
I think of it as the 'halve stuff n times' operator, which is often the 
correct idiom.


On Wednesday, November 18, 2015 at 10:08:08 AM UTC+1, Eric Forgy wrote:
>
> Hi Jon,
>
> Have a look at this comment above: 
> https://groups.google.com/d/msg/julia-users/sEUvnjvtryI/g_vbGQiDBgAJ
>
> You can try:
>
> D[i+1-div(d,2):j-3+q*5]
>
> or the unicode equivalent:
>
> D[i+1-d÷2:j-3+q*5]
>
>
>
> On Wednesday, November 18, 2015 at 4:53:10 PM UTC+8, Jon Norberg wrote:
>>
>> On a very practical note:
>>
>> I need to to do inline calculations of indexes such as
>>
>> D[i+1-d/2:j-3+q*5]
>>
>> where i,d,j and q are Int64 and d is a multiple of 2 i.e. d/2 should 
>> always be integer
>>
>> What is the most efficient way to use an expression as above but to avoid 
>> the Warning: indexing with non Integer....... ?
>>
>> Thanks, Jon
>>
>

Reply via email to