Skip to content

Commit c5a601a

Browse files
committed
format
1 parent 854b2ca commit c5a601a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

  • src/TiledArray/math/solvers/cp

src/TiledArray/math/solvers/cp/cp.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ static inline char intToAlphabet(int i) { return static_cast<char>('a' + i); }
4444
/// with inverse of the normalization factor stored in this->lambda
4545
/// \param[in,out] factor in: unnormalized factor matrix, out:
4646
/// normalized factor matrix
47-
template<typename Array>
48-
void normalize_factor(Array& factor, Array & lambda) {
47+
template <typename Array>
48+
void normalize_factor(Array& factor, Array& lambda) {
4949
using Tile = typename Array::value_type;
5050
auto& world = factor.world();
5151
// this is what the code should look like, but expressions::einsum seems to
@@ -194,7 +194,7 @@ class CP {
194194
TA_ASSERT(!cp_factors.empty(),
195195
"CP factor matrices have not been computed)");
196196
auto result = cp_factors;
197-
if(with_lambda){
197+
if (with_lambda) {
198198
result.emplace_back(lambda);
199199
return result;
200200
}
@@ -314,7 +314,7 @@ class CP {
314314
// MtKRP);
315315
try {
316316
MtKRP = math::linalg::cholesky_solve(W, MtKRP);
317-
} catch (std::exception& ex){
317+
} catch (std::exception& ex) {
318318
// if W is near-singular try LU instead of Cholesky
319319
if (std::string(ex.what()).find("lapack::posv failed") !=
320320
std::string::npos) {
@@ -433,9 +433,8 @@ class CP {
433433
};
434434
// compute the error in the loss function and find the fit
435435
const auto norm_cp = factor_norm(); // ||T_CP||_2
436-
const auto squared_norm_error = norm_ref_sq +
437-
norm_cp -
438-
2.0 * ref_dot_cp; // ||T - T_CP||_2^2
436+
const auto squared_norm_error =
437+
norm_ref_sq + norm_cp - 2.0 * ref_dot_cp; // ||T - T_CP||_2^2
439438
// N.B. squared_norm_error is very noisy
440439
// TA_ASSERT(squared_norm_error >= - 1e-8);
441440
const auto norm_error = sqrt(abs(squared_norm_error));

0 commit comments

Comments
 (0)