Reading NDTensor.BlockSparse

Hi,
I’m trying to import an MPS in HDF5 format in python.
Of all the data contained in the file, I’ve extracted only the components that I needed to read the values inside the MPS.
Each mps tensor, contains a vector of float which are the value different from 0, and an offsets object that give information about in which block the data is not 0.

{'data': array([ 9.99233978e-01, -3.91338417e-02, -6.12386558e-10, -8.88178420e-15,
         3.22253884e-06,  3.89747029e-09, -2.49062916e-01,  2.16631132e-06,
         6.16173779e-15,  8.57122151e-11, -5.47718360e-03, -1.16275436e-01,
        -3.23899185e-10, -2.51718972e-01, -3.93968386e-09,  1.58006064e-09,
        -5.67219778e-01,  9.68487168e-01,  4.50166647e-04, -2.57321454e-04,
         2.94209102e-15,  1.79324504e-05,  1.76508249e-15, -1.01415632e-03,
        -9.66351958e-01, -1.99233940e-01,  8.31695823e-14,  1.13660573e-01,
        -8.82614208e-16, -1.64590563e-13, -5.45195779e-13, -3.21726803e-13,
        -7.84155140e-01, -4.65105732e-12, -4.49876820e-11,  3.89411336e-01,
        -8.78305991e-01,  2.16576571e-01, -2.67414464e-14, -6.32869735e-02,
        -1.44138174e-14,  3.74064820e-01,  3.07336758e-01,  8.17120438e-01,
        -2.44312687e-13,  1.12015076e-01,  1.64625258e-14, -1.65344821e-14,
        -1.47631126e-14,  3.58094190e-15, -2.77674267e-11, -5.57448322e-15,
         4.84002892e-01,  3.76647383e-10, -1.60041481e-01, -2.03339403e-02,
        -3.64485763e-10, -6.81958705e-10,  2.89771192e-01, -3.76709004e-02,
        -6.75240161e-10,  8.75065464e-01,  2.05941465e-09,  2.29161135e-11,
        -1.27834978e-03,  2.10775034e-02,  4.96030312e-11, -4.27827354e-09,
         2.38678051e-01,  9.70869984e-01]),
 'offset': [([2, 1, 1], 0),
  ([1, 2, 1], 1),
  ([2, 2, 2], 5),
  ([1, 3, 2], 17),
  ([2, 3, 3], 35),
  ([1, 4, 3], 53),
  ([2, 4, 4], 65),
  ([1, 5, 4], 69)],
 'n_site': 4,
 'tag': ['n=4', 'l=4', 'l=3'],
 'dims': [2, 16, 8]}

If i want to reconstruct whole tensor in python, starting from a np.zeros(dims) , where I can find the information about which index or indices I have to iterate over to insert the values?

Otherwise, I can directly convert each mps tensor into array(ITensor(mps[i])), save it into a JSON file, and read it from python changing the construction order of a np.array from row major to column major.

You will also need the block structure of the indices to know how big the blocks are.

For block structure, you refer to the second row, right?
image

In which subsection I can find the block structure?

The space directory should have the block structure of each index/dimension of the tensor.