#ifndef _matdiv_n_ #define _matdiv_n_ #include "./utils/matrix.h" #include "./core/omp_config.h" namespace numerics{ // ---------------- Serial baseline ---------------- template utils::Matrix matdiv(const utils::Matrix& A, const utils::Vector& b, std::string method){ utils::Matrix 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_