From 3eabce4693861fc602318f1d4c51fa65b1cff15b Mon Sep 17 00:00:00 2001 From: Giovanni La Mura <giovanni.lamura@inaf.it> Date: Fri, 26 Jan 2024 15:49:35 +0100 Subject: [PATCH] Fix indexes in Transition Matrix HDF5 output --- src/libnptm/TransitionMatrix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libnptm/TransitionMatrix.cpp b/src/libnptm/TransitionMatrix.cpp index f66daa5d..70a8393d 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); -- GitLab