3 ms·
Matlab, Octave, Mathematica, and other mathematical programming environments use 1-based indexing, it's a well-established norm for the domain.
by jfager 15y ago
Matlab, Octave, Mathematica, and other mathematical programming environments use 1-based indexing, it's a well-established norm for the domain.
- Loic 15y agoFortran too and in HPC we all code in Fortran a lot. Look at the loop construct: for i = 1:t in Fortran: DO I=1,T The ability to load both C and Fortran dynamic libraries is also really really nice.
- ced 15y agoDoes 1-based indexing have any advantage, beyond familiarity to scientists?
- jfager 15y agoNot really, but it's not important either way.
- jballanc 15y agoWith 1-based indexing, length == last index. Does 0-based indexing have any advantage, beyond ability to do pointer arithmetic with indexes?
- scott_s 15y agoIn 0-based indexing, n % length is a value inside the range.
- cscheid 15y agoDijkstra to the rescue: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW...