{"id":19093685,"url":"https://github.com/juliaarrays/identityranges.jl","last_synced_at":"2026-05-25T19:30:20.002Z","repository":{"id":61798216,"uuid":"85123994","full_name":"JuliaArrays/IdentityRanges.jl","owner":"JuliaArrays","description":"Ranges that preserve indices of views","archived":false,"fork":false,"pushed_at":"2023-03-16T08:50:15.000Z","size":19,"stargazers_count":2,"open_issues_count":4,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-02T23:30:08.986Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaArrays.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-15T21:46:56.000Z","updated_at":"2024-08-14T03:58:12.000Z","dependencies_parsed_at":"2024-11-09T03:27:28.253Z","dependency_job_id":"6c59fe4d-eb93-44fc-9082-c52e4f0aba9f","html_url":"https://github.com/JuliaArrays/IdentityRanges.jl","commit_stats":{"total_commits":19,"total_committers":7,"mean_commits":"2.7142857142857144","dds":0.3157894736842105,"last_synced_commit":"0d640a9d3c348e01c6422f25d265c015ff903fd0"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FIdentityRanges.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FIdentityRanges.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FIdentityRanges.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FIdentityRanges.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaArrays","download_url":"https://codeload.github.com/JuliaArrays/IdentityRanges.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240142863,"owners_count":19754640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T03:25:42.885Z","updated_at":"2026-05-25T19:30:19.940Z","avatar_url":"https://github.com/JuliaArrays.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IdentityRanges\n\n[![Build Status](https://travis-ci.org/JuliaArrays/IdentityRanges.jl.svg?branch=master)](https://travis-ci.org/JuliaArrays/IdentityRanges.jl)\n\n[![codecov.io](http://codecov.io/github/JuliaArrays/IdentityRanges.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaArrays/IdentityRanges.jl?branch=master)\n\nIdentityRanges are Julia-language a helper type for creating \"views\"\nof arrays. They are a custom type of `AbstractUnitRange` that makes it\neasy to preserve the indices of array views. The key property of an\n`IdentityRange` `r` is that `r[i] == i` (hence the name of the\ntype/package), and that they support arbitrary start/stop indices\n(i.e., not just starting at 1).\n\n```julia\njulia\u003e A = reshape(1:24, 4, 6)\n4×6 reshape(::UnitRange{Int64}, 4, 6) with eltype Int64:\n 1  5   9  13  17  21\n 2  6  10  14  18  22\n 3  7  11  15  19  23\n 4  8  12  16  20  24\n\njulia\u003e V = view(A, 2:3, 3:5)\n2×3 view(reshape(::UnitRange{Int64}, 4, 6), 2:3, 3:5) with eltype Int64:\n 10  14  18\n 11  15  19\n\njulia\u003e axes(V)\n(Base.OneTo(2),Base.OneTo(3))\n\njulia\u003e V[1,1]\n10\n\njulia\u003e using IdentityRanges\n\njulia\u003e Vp = view(A, IdentityRange(2:3), IdentityRange(3:5))\nview(reshape(::UnitRange{Int64}, 4, 6), IdentityRange(2:3), IdentityRange(3:5)) with eltype Int64 with indices 2:3×3:5:\n 10  14  18\n 11  15  19\n\njulia\u003e axes(Vp)\n(2:3,3:5)\n\njulia\u003e Vp[1,1]\nERROR: BoundsError: attempt to access view(reshape(::UnitRange{Int64}, 4, 6), IdentityRange(2:3), IdentityRange(3:5)) with eltype Int64 with indices 2:3×3:5 at index [1, 1]\nStacktrace:\n [1] throw_boundserror(::SubArray{Int64,2,Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}},Tuple{IdentityRange{Int64},IdentityRange{Int64}},false}, ::Tuple{Int64,Int64}) at ./abstractarray.jl:484\n [2] checkbounds at ./abstractarray.jl:449 [inlined]\n [3] getindex(::SubArray{Int64,2,Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}},Tuple{IdentityRange{Int64},IdentityRange{Int64}},false}, ::Int64, ::Int64) at ./subarray.jl:206\n [4] top-level scope at none:0\n\njulia\u003e Vp[2,3]\n10\n\njulia\u003e A[2,3]\n10\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaarrays%2Fidentityranges.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliaarrays%2Fidentityranges.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaarrays%2Fidentityranges.jl/lists"}