Skip to content

Commit

Permalink
[TAT.hpp] Use numeric_limits to create no cut for svd.
Browse files Browse the repository at this point in the history
The previous code use -1 to initialize remain cut to achieve no cut
behavior, which reply on the underflow for unsigned integer, which
cause some compiler raising warning. Now, we use std::nemueric_limits
to specifiy the max value of type Size.
  • Loading branch information
hzhangxyz committed Dec 11, 2023
1 parent 6056ac6 commit 4d197cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/TAT/structure/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <algorithm>
#include <array>
#include <limits>
#include <map>
#include <memory>
#include <set>
Expand Down Expand Up @@ -55,9 +56,9 @@ namespace TAT {

Cut(Size i, double f) : remain_cut(i), relative_cut(f) { }
Cut(double f, Size i) : remain_cut(i), relative_cut(f) { }
Cut() : remain_cut(-1), relative_cut(0) { }
Cut() : remain_cut(std::numeric_limits<Size>::max()), relative_cut(0) { }
Cut(Size i) : remain_cut(i), relative_cut(0) { }
Cut(double f) : remain_cut(-1), relative_cut(f) { }
Cut(double f) : remain_cut(std::numeric_limits<Size>::max()), relative_cut(f) { }

[[deprecated("NoCut is deprecated, use Cut directly")]] Cut(NoCut) : Cut() { }
[[deprecated("RelativeCut is deprecated, use Cut directly")]] Cut(RelativeCut c) : Cut(c.value) { }
Expand Down

0 comments on commit 4d197cb

Please sign in to comment.