Skip to content

Commit

Permalink
Merge pull request #156 from ValeevGroup/kmp5/debug/fix_cp_test
Browse files Browse the repository at this point in the history
Make all CP tests more reliable
  • Loading branch information
evaleev authored Aug 1, 2023
2 parents 8bcf668 + 8f78057 commit 33d2218
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 131 deletions.
7 changes: 6 additions & 1 deletion btas/generic/converge_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace btas {
double fitChange = abs(fitOld_ - fit);
fitOld_ = fit;
if (verbose_) {
std::cout << MtKRP_.extent(1) << "\t" << iter_ << "\t" << fit << "\t" << fitChange << std::endl;
std::cout << MtKRP_.extent(1) << "\t" << iter_ << "\t" << std::setprecision(16) << fit << "\t" << fitChange << std::endl;
}
if (fitChange < tol_) {
converged_num++;
Expand Down Expand Up @@ -320,6 +320,9 @@ namespace btas {

double fitChange = abs(fitOld_ - fit);
fitOld_ = fit;
if (verbose_) {
std::cout << MtKRPL_.extent(1) << "\t" << iter_ << "\t" << std::setprecision(16) << fit << "\t" << fitChange << std::endl;
}
if(fitChange < tol_) {
iter_ = 0;
final_fit_ = fitOld_;
Expand Down Expand Up @@ -378,6 +381,7 @@ namespace btas {
return norm(btas_array);
}

void verbose(bool verb) { verbose_ = verb; }
private:
double tol_;
double fitOld_ = 1.0;
Expand All @@ -386,6 +390,7 @@ namespace btas {
size_t iter_ = 0;
Tensor MtKRPL_, MtKRPR_;
size_t ndimL_;
bool verbose_ = false;

/// Function to compute the L2 norm of a tensors computed from the \c btas_factors
/// \param[in] btas_factors Current set of factor matrices
Expand Down
2 changes: 1 addition & 1 deletion unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(btas_test_src_files
contract_test.cc
mohndle_test.cc
range_test.cc
#tensor_cp_test.cc
tensor_cp_test.cc
tensor_blas_test.cc
tensor_func_test.cc
tensor_lapack_test.cc
Expand Down
Loading

0 comments on commit 33d2218

Please sign in to comment.