Sync public subset from Flux (private)

This commit is contained in:
Gitea CI
2025-10-06 20:14:13 +00:00
parent 272e77c536
commit b2d00af0e1
390 changed files with 152131 additions and 0 deletions

38
include/numerics/matdiv.h Normal file
View File

@@ -0,0 +1,38 @@
#ifndef _matdiv_n_
#define _matdiv_n_
#include "./utils/matrix.h"
#include "./core/omp_config.h"
namespace numerics{
// ---------------- Serial baseline ----------------
template <typename T>
utils::Matrix<T> matdiv(const utils::Matrix<T>& A, const utils::Vector<T>& b, std::string method){
utils::Matrix<T> C = A;
if (method == "row"){
for (uint64_t i = 0; i < A.rows(); ++i){
for (uint64_t j = 0; j < A.cols(); ++j){
C(i,j) /= b[j];
}
}
}else if (method == "col"){
for (uint64_t i = 0; i < A.rows(); ++i){
for (uint64_t j = 0; j < A.cols(); ++j){
C(i,j) /= b[i];
}
}
}else{
throw std::runtime_error("matdiv: choose div by: 'row' or 'col'");
}
return C;
}
} // namespace numerics
#endif // _matdiv_n_