Here is a quick example I threw together (with some clues from Tim here):

https://github.com/EricForgy/RoundingIndexArrays.jl

Indexing only works for 1-d at the moment, but hopefully it helps get the 
point.

On Tuesday, November 17, 2015 at 8:51:34 AM UTC+8, Eric Forgy wrote:
>
> Hi Peter,
>
> I've learned that Julia is flexible enough to make it do just about 
> whatever you want it to do. If you want Julia to handle non-integer 
> indices, you can very easily create a type MatlabArray (or something) and 
> have its indices be non-integer and the matrix performance would be on par 
> in terms of performance as native arrays.
>
> The fact that base Julia doesn't allow non-integer indices does not really 
> limit you or anyone in any way because you can simply create your own type 
> that does what you want it to do.
>
> On Tuesday, November 17, 2015 at 1:22:18 AM UTC+8, Steven G. Johnson wrote:
>>
>>
>>
>> On Monday, November 16, 2015 at 11:54:39 AM UTC-5, Peter Kovesi wrote:
>>>
>>> Following the principle of 'minimum surprise': If I have an integer just 
>>> that happens to be represented via a floating point type I would still like 
>>> to be able to use it as an integer.
>>>
>>
>> Can you give an example of where you would like to use a floating-point 
>> index that does not involve doing integer division with / (where you should 
>> probably use รท instead)? 
>>
>

Reply via email to