diff --git a/src/libnptm/TransitionMatrix.cpp b/src/libnptm/TransitionMatrix.cpp index f66daa5d6ab81038f346aeeebba8b2343b726b87..70a8393d3245408040c8bdbcdcd0f9fb860983d2 100644 --- a/src/libnptm/TransitionMatrix.cpp +++ b/src/libnptm/TransitionMatrix.cpp @@ -235,8 +235,8 @@ void TransitionMatrix::write_hdf5(string file_name) { double *ptr_elements = new double[shape[0] * 2 * shape[1]](); for (int ei = 0; ei < shape[0]; ei++) { for (int ej = 0; ej < shape[1]; ej++) { - ptr_elements[ei * (2 * ej)] = elements[shape[1] * ei + ej].real(); - ptr_elements[ei * (2 * ej) + 1] = elements[shape[1] * ei + ej].imag(); + ptr_elements[shape[1] * ei + 2 * ej] = elements[shape[1] * ei + ej].real(); + ptr_elements[shape[1] * ei + 2 * ej + 1] = elements[shape[1] * ei + ej].imag(); } } rec_ptr_list.append(ptr_elements);