MCPcopy Create free account
hub / github.com/SZAILAB/MaterialDFT-Demo / solve_right_upper_conj

Function solve_right_upper_conj

cpp_core/src/eigensolver.cpp:291–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291std::vector<Complex> solve_right_upper_conj(
292 const std::vector<Complex>& l_col_major,
293 int n,
294 const std::vector<Complex>& b_col_major
295) {
296 if (static_cast<int>(l_col_major.size()) != n * n
297 || static_cast<int>(b_col_major.size()) != n * n) {
298 throw std::invalid_argument("solve_right_upper_conj: matrix size mismatch");
299 }
300 std::vector<Complex> x = b_col_major;
301 for (int row = 0; row < n; ++row) {
302 for (int col = 0; col < n; ++col) {
303 Complex value = mat_ref(x, n, row, col);
304 for (int k = 0; k < col; ++k) {
305 const Complex u_k_col = std::conj(mat_ref(l_col_major, n, col, k));
306 value -= mat_ref(x, n, row, k) * u_k_col;
307 }
308 value /= std::conj(mat_ref(l_col_major, n, col, col));
309 mat_ref(x, n, row, col) = value;
310 }
311 }
312 return x;
313}
314
315std::vector<Complex> solve_left_upper_conj(
316 const std::vector<Complex>& l_col_major,

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected