This is one possible solution which will require a minor o2 update.
'N DIMENSIONAL
def UseMultidim
===============
  class Multidim%1
  ================
    '
    'order minor to major
    indexbase 0
    '
    int dms[63] 'up to 64 dimensions
    int dn 'number of dimensions
    int sz 'number of bytes
    sys bu 'dynamic buffer
    '
    function constructor(int*dm, n)
    ===============================
    int i
    dms[0]=dm[0]+1
    for i=1 to n-1
      dms[i]=dm[i]+1
      dms[i]*=dms[i-1]
    next
    dn=n
    sz=dms[n-1]*sizeof %1
    bu=getmemory sz
    end function
    '
    function destructor()
    =====================
    'del all members
    #if typecodeof(%1)>0xa0 'string types and above
      %1 *v
      int i
      for i=0 to sz-1 step sizeof(%1)
        @v=bu+i
        del v 
      next
    #endif
    freememory bu
    dn=0 : sz=0 : bu=0
    end function
    '
    function locator(int*d) as sys
    ==============================
    int i
    int j=d[0]
    for i=1 to dn-1
      j+=dms[i-1]*d[i]
    next
    return j*sizeof(%1)+bu
    end function
    '
    function vf(int*d) as %1
    ========================
    %1 v at locator(d)
    function=v
    end function
    '
    function vf(int*d, %1 *a)
    =========================
    %1 v at locator(d)
    v=a
    end function
    '
  end class
end def
'TESTS:
=======
UseMultiDim float
'new Multidim m(int{7,3,1},countof)
'print m.sz '256
'print m.locate(int{0,0,0})
'print m.locate(int{0,0,1})
'print m.locate(int{0,1,0})
'print m.locate(int{1,0,0})
'print m.locate(int{2,1,1})
'm.vf(int{2,2,1})=12.5
'print m.vf(int{2,2,1})
'def mvf m.vf(int{%1}) 'syntax compaction
'mvf(2,2,1)=42
'float f=200+mvf(2,2,1)+100 '+mvf(2,2,1)
'del m
'
def NewMultidim
===============
  new Multidim%1 %2(int{%3},countof)
  def %2vf
    %2.vf(int{%%1})
  end def
end def
'
def Multidim
===============
  Multidim%1 %2
  %2.constructor(int{%3},countof)
  def %2vf
    %2.vf(int{%%1})
  end def
end def
'
NewMultidim float m(7,3,1)
Multidim float m(7,3,1)
mvf(2,2,1)=10
mvf(1,2,1)=1
float f=1000+mvf(2,2,1)+mvf(1,2,1)+100
f '1111
del m
UseMultidim float
Multidim float m(7,3,1)
mvf(2,2,1)=10
mvf(1,2,1)=1
float f=1000+mvf(2,2,1)+mvf(1,2,1)+100
'print f '1111