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

Function solve_left_upper_conj

cpp_core/src/eigensolver.cpp:315–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315std::vector<Complex> solve_left_upper_conj(
316 const std::vector<Complex>& l_col_major,
317 int n,
318 const std::vector<Complex>& b_col_major
319) {
320 if (static_cast<int>(l_col_major.size()) != n * n
321 || static_cast<int>(b_col_major.size()) != n * n) {
322 throw std::invalid_argument("solve_left_upper_conj: matrix size mismatch");
323 }
324 std::vector<Complex> x = b_col_major;
325 for (int col = 0; col < n; ++col) {
326 for (int row = n - 1; row >= 0; --row) {
327 Complex value = mat_ref(x, n, row, col);
328 for (int k = row + 1; k < n; ++k) {
329 value -= std::conj(mat_ref(l_col_major, n, k, row)) * mat_ref(x, n, k, col);
330 }
331 value /= std::conj(mat_ref(l_col_major, n, row, row));
332 mat_ref(x, n, row, col) = value;
333 }
334 }
335 return x;
336}
337
338std::vector<Complex> dense_matmul(
339 const std::vector<Complex>& a_col_major,

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected