FANDOM


Converting Between Array Index Representations

Conversion of n-indices to 1 indexEdit

2DEdit

FortranEdit

ind1D = i + nx*j


3DEdit

FortranEdit

ind1D = i + nx*(j + ny*k) = i + nx*j + nx*ny*k


Generic CaseEdit

FortranEdit

integer :: dims(n), inds(n)

ind1D = 0

do i=n,1,-1
     ind1D = ind1D*dim(i) + inds(i)
enddo


Conversion of 1 index to n-indicesEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.