Skip to content

Commit

Permalink
-some comments about truncated Svd
Browse files Browse the repository at this point in the history
  • Loading branch information
manuschneider committed Nov 4, 2024
1 parent 7c62492 commit cd87b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/linalg/Gesvd_truncate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ namespace cytnx {
Tensor Sall; // S vals excluding the already kept ones

Check warning on line 408 in src/linalg/Gesvd_truncate.cpp

View check run for this annotation

Codecov / codecov/patch

src/linalg/Gesvd_truncate.cpp#L408

Added line #L408 was not covered by tests
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
Expand All @@ -422,7 +422,8 @@ namespace cytnx {
min_dim -= blockdim;
continue;

Check warning on line 423 in src/linalg/Gesvd_truncate.cpp

View check run for this annotation

Codecov / codecov/patch

src/linalg/Gesvd_truncate.cpp#L421-L423

Added lines #L421 - L423 were not covered by tests
}
// 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];
Expand Down
5 changes: 3 additions & 2 deletions src/linalg/Svd_truncate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ namespace cytnx {
Tensor Sall; // S vals excluding the already kept ones

Check warning on line 376 in src/linalg/Svd_truncate.cpp

View check run for this annotation

Codecov / codecov/patch

src/linalg/Svd_truncate.cpp#L376

Added line #L376 was not covered by tests
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
Expand All @@ -390,7 +390,8 @@ namespace cytnx {
min_dim -= blockdim;
continue;

Check warning on line 391 in src/linalg/Svd_truncate.cpp

View check run for this annotation

Codecov / codecov/patch

src/linalg/Svd_truncate.cpp#L389-L391

Added lines #L389 - L391 were not covered by tests
}
// 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];
Expand Down

0 comments on commit cd87b56

Please sign in to comment.