JuliaArrays / JuliaArrays/StaticArrays.jl

implementing 0-based indexing

Open
#371 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design feature
Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

Hello all. I want to implement some StaticArray objects (LorentzTensor) with 0-based indexing and some custom methods. (I'm on 0.7.) I made the appropriate definition of axes and getindex(t::LorentzTensor, i::Int). This works fine for vectors, but (as you probably know) fails for all higher rank tensors. I've traced the problem down to here which indeed seems to be specialized to 1-based indexing.

My question is, what is the minimum I should implement to get this working? Will there be some other nasty surprises?

I would be happy to make a PR using axes to get this working for the general case, but I'm assuming that it would be far easier said than done (I have no idea what else it would break) and considering that this is a performance-critical package I don't know what other side effects this would have.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/indexing.jl at line 22 and compare its indexing assumptions with the issue's axes and getindex definitions for LorentzTensor. Investigate how higher-rank tensors are handled and identify the tests needed to establish correct 0-based indexing without affecting existing StaticArray behavior. Done means the supported implementation scope and regression coverage are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.