JuliaArrays / EndpointRanges.jl

Julia package for doing arithmetic on endpoints in array indexing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EndpointRanges

Build Status

codecov.io

This Julia package makes it easier to index "unconventional" arrays (ones for which indexing does not necessarily start at 1), by defining constants ibegin and iend that stand for the beginning and end, respectively, of the indices range along any given dimension.

Usage

using EndpointRanges

a = 1:20
a[ibegin:iend] == a
a[ibegin+3:iend-2] == a[4:18]
a[1:(ibegin+iend)÷2] == a[1:10]

Note that, unlike 3:end you can also pass such indices as arguments to a function:

view(a, ibegin+2:iend-3) == view(a, 3:17)

About

Julia package for doing arithmetic on endpoints in array indexing

License:Other


Languages

Language:Julia 100.0%