| 82 | } |
| 83 | |
| 84 | bool normalize_vector(std::vector<Complex>* v) { |
| 85 | if (!v) { |
| 86 | throw std::invalid_argument("normalize_vector: null vector pointer"); |
| 87 | } |
| 88 | const double nrm = l2_norm(*v); |
| 89 | if (!(nrm > kOrthoEps)) { |
| 90 | return false; |
| 91 | } |
| 92 | const double inv = 1.0 / nrm; |
| 93 | for (Complex& vi : *v) { |
| 94 | vi *= inv; |
| 95 | } |
| 96 | return true; |
| 97 | } |
| 98 | |
| 99 | std::vector<Complex> dense_matvec( |
| 100 | const std::vector<Complex>& h_col_major, |
no test coverage detected