i have an array/map or 13 dimension, where i want to convert the 13 dimension index value into its raw major/offset value and than simply save the 13 dimension array as 1 dimension array or map with one value. I saw that implementing the 2 or 3 dimension array in raw major order is simple but i i checked the same for large dimension with size d, than i found a linear algebra formula here, which is complcated for me to implement this in c++ code. Can u show me how i can implement an algebric equations in c++. And also how to convert offset value into its corresponding index value in n dimension array. My program right now looks similar to this, but since the dimension of array is too big its not practical for me to use the array. Glad that i found this method.

Code:
#include <map>
#include <fstream>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>

#include <boost/serialization/map.hpp>

int main(int argc,char** argv) {
  std::ofstream s("filename"); 
  std::map<int,int> m;
  int i1=23; i2=23; i3=11; ... i13=34;
  int offset = ... // function of i1 to i13
  m[offset] = 100; // value at given particular offset <=> array[i1][i2]...[i13] = 100. 
  {
     boost::archive::text_oarchive oa(s);
     oa << m; 
  }
}
I tried to use eigen in my c++ code from here, but i didn't find any way to implement same for d dimensional array or matrix. Here i1,i2..i13 are the index value of the array.