Dear ALPS users,
I've been using the DMRG algorithm provided by ALPS to calculate energies and spin gaps for simple quantum systems. I've noticed that the value calculated for the truncation error comes out to be negative for some of the iterations. These specific instances have very small values, typically 10^-16, 10^-17 and 10^-18. My understanding of the truncation error is that it is the sum of the probabilities of the truncated states, thus always producing a positive value. So I'm not sure how a negative truncation error is occurring. It seems to occur on any DMRG program I run, even the simple ones provided in the DMRG tutorials. Perhaps it is a quirk of the algorithm or how the computer is handling some rounding. I found message on the mailing list archives about this exact question but it was never answered.
I've attached some output data. I used the program 'spin_one_half.py' straight from the first DMRG tutorial herehttp://alps.comp-phys.org/mediawiki/index.php/ALPS_2_Tutorials:DMRG-01_DMRG, unmodified, to produce the provided output. Any insight and advice is much appreciated. Thanks.
Regards, Tyler
Yes, it is due to rounding. Computer arithmetic is often represented as double-precision floating point, which means that after every operation the result is rounded to 52 bits of precision (slightly less than 16 decimal places). This means that if you have, for example, if you have density matrix eigenvalues 0.99999999999999999 and 0.00000000000000001 (that sum exactly to 1) then the first number will be rounded to the closest representable value, namely 1.0E0, and the second number is exactly representable as 1.0E-17 (ignoring subleties between base 2 and base 10). This isn't a problem in practice, since the sum of 1.0E0 + 1.0E-17 is 1.0E0 (rounded to 16 places) so the density matrix eigenvalues appear to be correctly normalized anyway.
Because of rounding, floating point arithmetic isn't associative. So the result depends on exactly how the truncation error is calculated.
1.0E0 - (1.0E0 + 1.0E-17) = 0
but
(1.0E0 - 1.0E0) - 1.0E-17 = -1.0E-17
Since the truncation error is calculated as a sum of numbers with largest magnitude of O(1), anything beyond ~16 decimal places is numerical noise and indistinguishable from zero.
Regards, Ian
On Tue, 26 Jan 2016, T.J.Hewitt wrote:
Dear ALPS users,
I've been using the DMRG algorithm provided by ALPS to calculate energies and spin gaps for simple quantum systems. I've noticed that the value calculated for the truncation error comes out to be negative for some of the iterations. These specific instances have very small values, typically 10^-16, 10^-17 and 10^-18. My understanding of the truncation error is that it is the sum of the probabilities of the truncated states, thus always producing a positive value. So I'm not sure how a negative truncation error is occurring. It seems to occur on any DMRG program I run, even the simple ones provided in the DMRG tutorials. Perhaps it is a quirk of the algorithm or how the computer is handling some rounding. I found message on the mailing list archives about this exact question but it was never answered.
I've attached some output data. I used the program 'spin_one_half.py' straight from the first DMRG tutorial here, unmodified, to produce the provided output. Any insight and advice is much appreciated. Thanks.
Regards, Tyler
comp-phys-alps-users@lists.phys.ethz.ch