From 59c8cc1588d51f4f61a74f3629ba737039166a6b Mon Sep 17 00:00:00 2001 From: Michael Marshall Date: Wed, 13 Feb 2019 22:11:24 +0000 Subject: [PATCH] Minor bugfix --- Grid/serialisation/BaseIO.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Grid/serialisation/BaseIO.h b/Grid/serialisation/BaseIO.h index 90897188..60d13f01 100644 --- a/Grid/serialisation/BaseIO.h +++ b/Grid/serialisation/BaseIO.h @@ -102,16 +102,17 @@ namespace Grid { for( auto &idx : MyIndex ) idx = 0; std::vector SubIndex(ReducedDimsSize); for( auto &idx : SubIndex ) idx = 0; - for( typename ETensor::Index n = 0; n < TotalNumElements; ) { + typename ETensor::Index n = 0; + for( std::size_t j = 0; j < NumElements; j++ ) { for( Scalar &Source : ET( MyIndex ) ) { lambda(Source, n++, &SubIndex[0] ); - // Now increment MyIndex - for( auto i = ET.NumDimensions - 1; i >= 0 && ++MyIndex[i] == ET.dimension(i); i-- ) - MyIndex[i] = 0; // Now increment SubIndex - for( auto i = ReducedDimsSize - 1; i >= 0 && ++SubIndex[i] == ReducedDims[i]; i-- ) + for( long i = ReducedDimsSize - 1; i >= 0 && ++SubIndex[i] == ReducedDims[i]; i-- ) SubIndex[i] = 0; } + // Now increment MyIndex + for( long i = ET.NumDimensions - 1; i >= 0 && ++MyIndex[i] == ET.dimension(i); i-- ) + MyIndex[i] = 0; } } }