Skip to content

Commit

Permalink
fixing Florian's bug with overflow of norm for ints in test code
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjharrison committed Sep 22, 2023
1 parent 704aaf9 commit 9050cb0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/madness/tensor/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ namespace madness {
}

namespace detail {
template <typename T> T mynorm(T t) {
return t*t;
template <typename T> double mynorm(T t) {
return double(t)*t;
}

template <typename T> T mynorm(std::complex<T> t) {
template <typename T> double mynorm(std::complex<T> t) {
return std::norm(t);
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/madness/tensor/test_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ namespace {
return ((double) x)*x;
}

// template <> double mynorm<float_complex>(float_complex x) {
// return (double) std::norm(x);
// }
//
// template <> double mynorm<double_complex>(double_complex x) {
// return (double) std::norm(x);
// }
template <> double mynorm<float_complex>(float_complex x) {
return (double) std::norm(x);
}
template <> double mynorm<double_complex>(double_complex x) {
return (double) std::norm(x);
}

template <typename T, typename Q>
inline
Expand Down

0 comments on commit 9050cb0

Please sign in to comment.