From cd87b569afa5b26442b437b9c672cb3e28998f91 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Mon, 4 Nov 2024 18:58:27 +0800 Subject: [PATCH] -some comments about truncated Svd --- src/linalg/Gesvd_truncate.cpp | 5 +++-- src/linalg/Svd_truncate.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/linalg/Gesvd_truncate.cpp b/src/linalg/Gesvd_truncate.cpp index dd0c1819..2e240c09 100644 --- a/src/linalg/Gesvd_truncate.cpp +++ b/src/linalg/Gesvd_truncate.cpp @@ -408,7 +408,7 @@ namespace cytnx { Tensor Sall; // S vals excluding the already kept ones Tensor Block; // current block cytnx_uint64 blockdim; - bool anySall = false; // are there already any values in Sall vals? + bool anySall = false; // are there already any values in Sall? bool any_min_blockdim = false; // is any min_blockdim > 0? for (int b = 0; b < outCyT[0].Nblocks(); b++) { if (min_blockdim[b] < 1) // save whole block to Sall @@ -422,7 +422,8 @@ namespace cytnx { min_dim -= blockdim; continue; } - // remove first min_blockdim[b] values + // remove first min_blockdim[b] values since they are saved anyways and do not need to be + // included in Sall blockdim = outCyT[0].get_block_(b).shape()[0]; Block = outCyT[0].get_block_(b).get({ac::range(min_blockdim[b], blockdim)}); keep_dim -= min_blockdim[b]; diff --git a/src/linalg/Svd_truncate.cpp b/src/linalg/Svd_truncate.cpp index c95a1774..f5be754c 100644 --- a/src/linalg/Svd_truncate.cpp +++ b/src/linalg/Svd_truncate.cpp @@ -376,7 +376,7 @@ namespace cytnx { Tensor Sall; // S vals excluding the already kept ones Tensor Block; // current block cytnx_uint64 blockdim; - bool anySall = false; // are there already any values in Sall vals? + bool anySall = false; // are there already any values in Sall? bool any_min_blockdim = false; // is any min_blockdim > 0? for (int b = 0; b < outCyT[0].Nblocks(); b++) { if (min_blockdim[b] < 1) // save whole block to Sall @@ -390,7 +390,8 @@ namespace cytnx { min_dim -= blockdim; continue; } - // remove first min_blockdim[b] values + // remove first min_blockdim[b] values since they are saved anyways and do not need to be + // included in Sall blockdim = outCyT[0].get_block_(b).shape()[0]; Block = outCyT[0].get_block_(b).get({ac::range(min_blockdim[b], blockdim)}); keep_dim -= min_blockdim[b];