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

Function solve_left_lower

cpp_core/src/eigensolver.cpp:268–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268std::vector<Complex> solve_left_lower(
269 const std::vector<Complex>& l_col_major,
270 int n,
271 const std::vector<Complex>& b_col_major
272) {
273 if (static_cast<int>(l_col_major.size()) != n * n
274 || static_cast<int>(b_col_major.size()) != n * n) {
275 throw std::invalid_argument("solve_left_lower: matrix size mismatch");
276 }
277 std::vector<Complex> x = b_col_major;
278 for (int col = 0; col < n; ++col) {
279 for (int row = 0; row < n; ++row) {
280 Complex value = mat_ref(x, n, row, col);
281 for (int k = 0; k < row; ++k) {
282 value -= mat_ref(l_col_major, n, row, k) * mat_ref(x, n, k, col);
283 }
284 value /= mat_ref(l_col_major, n, row, row);
285 mat_ref(x, n, row, col) = value;
286 }
287 }
288 return x;
289}
290
291std::vector<Complex> solve_right_upper_conj(
292 const std::vector<Complex>& l_col_major,

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected