diff options
Diffstat (limited to 'src/lib/netlist/solver/nld_ms_gcr.h')
-rw-r--r-- | src/lib/netlist/solver/nld_ms_gcr.h | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h index 6c942f3b1d6..66b56397a3d 100644 --- a/src/lib/netlist/solver/nld_ms_gcr.h +++ b/src/lib/netlist/solver/nld_ms_gcr.h @@ -26,25 +26,22 @@ namespace solver { template <typename FT, int SIZE> - class matrix_solver_GCR_t: public matrix_solver_t + class matrix_solver_GCR_t: public matrix_solver_ext_t<FT, SIZE> { public: using mat_type = plib::pGEmatrix_cr_t<plib::pmatrix_cr_t<FT, SIZE>>; - // FIXME: dirty hack to make this compile - static constexpr const std::size_t storage_N = 100; matrix_solver_GCR_t(netlist_state_t &anetlist, const pstring &name, const analog_net_t::list_t &nets, const solver_parameters_t *params, const std::size_t size) - : matrix_solver_t(anetlist, name, nets, params) - , m_dim(size) + : matrix_solver_ext_t<FT, SIZE>(anetlist, name, nets, params, size) , RHS(size) , new_V(size) , mat(static_cast<typename mat_type::index_type>(size)) , m_proc() { - const std::size_t iN = this->N(); + const std::size_t iN = this->size(); /* build the final matrix */ @@ -65,7 +62,7 @@ namespace solver auto gr = mat.gaussian_extend_fill_mat(fill); - log_fill(fill, mat); + this->log_fill(fill, mat); mat.build_from_fill_mat(fill); @@ -79,13 +76,13 @@ namespace solver for (auto i = mat.row_idx[k]; i < mat.row_idx[k+1]; i++) if (other == static_cast<int>(mat.col_idx[i])) { - m_mat_ptr[k][j] = &mat.A[i]; + this->m_mat_ptr[k][j] = &mat.A[i]; cnt++; break; } } nl_assert(cnt == this->m_terms[k].railstart()); - m_mat_ptr[k][this->m_terms[k].railstart()] = &mat.A[mat.diag[k]]; + this->m_mat_ptr[k][this->m_terms[k].railstart()] = &mat.A[mat.diag[k]]; } this->log().verbose("maximum fill: {1}", gr.first); @@ -96,7 +93,7 @@ namespace solver // FIXME: Move me - if (state().lib().isLoaded()) + if (this->state().lib().isLoaded()) { pstring symname = static_compile_name(); m_proc.load(this->state().lib(), symname); @@ -111,8 +108,6 @@ namespace solver } } - constexpr std::size_t N() const { return m_dim; } - unsigned vsolve_non_dynamic(const bool newton_raphson) override; std::pair<pstring, pstring> create_solver_code() override; @@ -125,7 +120,6 @@ namespace solver pstring static_compile_name(); - const std::size_t m_dim; plib::parray<FT, SIZE> RHS; plib::parray<FT, SIZE> new_V; @@ -142,7 +136,7 @@ namespace solver template <typename FT, int SIZE> void matrix_solver_GCR_t<FT, SIZE>::generate_code(plib::putf8_fmt_writer &strm) { - const std::size_t iN = N(); + const std::size_t iN = this->size(); for (std::size_t i = 0; i < mat.nz_num; i++) strm("double m_A{1} = m_A[{2}];\n", i, i); @@ -232,13 +226,9 @@ namespace solver template <typename FT, int SIZE> unsigned matrix_solver_GCR_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_raphson) { - const std::size_t iN = this->N(); - - mat.set_scalar(0.0); - /* populate matrix */ - - this->fill_matrix(iN, RHS); + mat.set_scalar(0.0); + this->fill_matrix(RHS); /* now solve it */ @@ -257,8 +247,8 @@ namespace solver this->m_stat_calculations++; - const FT err = (newton_raphson ? delta(new_V) : 0.0); - store(new_V); + const FT err = (newton_raphson ? this->delta(new_V) : 0.0); + this->store(new_V); return (err > this->m_params.m_accuracy) ? 2 : 1; } |