summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/solver/nld_ms_gmres.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/solver/nld_ms_gmres.h')
-rw-r--r--src/lib/netlist/solver/nld_ms_gmres.h86
1 files changed, 40 insertions, 46 deletions
diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h
index f99368549a9..7a12737297c 100644
--- a/src/lib/netlist/solver/nld_ms_gmres.h
+++ b/src/lib/netlist/solver/nld_ms_gmres.h
@@ -35,15 +35,51 @@ namespace devices
* maximize the efficiency of the incomplete LUT.
* This is already preconditioning.
*/
- matrix_solver_GMRES_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params, const std::size_t size)
- // matrix_solver_direct_t<FT, SIZE>(anetlist, name, matrix_solver_t::PREFER_BAND_MATRIX, params, size)
- : matrix_solver_direct_t<FT, SIZE>(anetlist, name, params, size)
+ matrix_solver_GMRES_t(netlist_state_t &anetlist, const pstring &name,
+ analog_net_t::list_t &nets,
+ const solver_parameters_t *params,
+ const std::size_t size)
+ : matrix_solver_direct_t<FT, SIZE>(anetlist, name, nets, params, size)
, m_ops(size, 0)
, m_gmres(size)
{
+ const std::size_t iN = this->size();
+
+ std::vector<std::vector<unsigned>> fill(iN);
+
+ for (std::size_t k=0; k<iN; k++)
+ {
+ fill[k].resize(iN, decltype(m_ops.m_mat)::FILL_INFINITY);
+ terms_for_net_t & row = this->m_terms[k];
+ for (const auto &nz_j : row.m_nz)
+ {
+ fill[k][static_cast<mattype>(nz_j)] = 0;
+ }
+ }
+
+ m_ops.build(fill);
+ this->log_fill(fill, m_ops.m_mat);
+
+ /* build pointers into the compressed row format matrix for each terminal */
+
+ for (std::size_t k=0; k<iN; k++)
+ {
+ std::size_t cnt = 0;
+ for (std::size_t j=0; j< this->m_terms[k].railstart();j++)
+ {
+ for (std::size_t i = m_ops.m_mat.row_idx[k]; i<m_ops.m_mat.row_idx[k+1]; i++)
+ if (this->m_terms[k].m_connected_net_idx[j] == static_cast<int>(m_ops.m_mat.col_idx[i]))
+ {
+ this->m_mat_ptr[k][j] = &m_ops.m_mat.A[i];
+ cnt++;
+ break;
+ }
+ }
+ nl_assert(cnt == this->m_terms[k].railstart());
+ this->m_mat_ptr[k][this->m_terms[k].railstart()] = &m_ops.m_mat.A[m_ops.m_mat.diag[k]];
}
+ }
- void vsetup(analog_net_t::list_t &nets) override;
unsigned vsolve_non_dynamic(const bool newton_raphson) override;
private:
@@ -61,48 +97,6 @@ namespace devices
// ----------------------------------------------------------------------------------------
template <typename FT, int SIZE>
- void matrix_solver_GMRES_t<FT, SIZE>::vsetup(analog_net_t::list_t &nets)
- {
- matrix_solver_direct_t<FT, SIZE>::vsetup(nets);
-
- const std::size_t iN = this->size();
-
- std::vector<std::vector<unsigned>> fill(iN);
-
- for (std::size_t k=0; k<iN; k++)
- {
- fill[k].resize(iN, decltype(m_ops.m_mat)::FILL_INFINITY);
- terms_for_net_t & row = this->m_terms[k];
- for (const auto &nz_j : row.m_nz)
- {
- fill[k][static_cast<mattype>(nz_j)] = 0;
- }
- }
-
- m_ops.build(fill);
- this->log_fill(fill, m_ops.m_mat);
-
- /* build pointers into the compressed row format matrix for each terminal */
-
- for (std::size_t k=0; k<iN; k++)
- {
- std::size_t cnt = 0;
- for (std::size_t j=0; j< this->m_terms[k].railstart();j++)
- {
- for (std::size_t i = m_ops.m_mat.row_idx[k]; i<m_ops.m_mat.row_idx[k+1]; i++)
- if (this->m_terms[k].m_connected_net_idx[j] == static_cast<int>(m_ops.m_mat.col_idx[i]))
- {
- this->m_mat_ptr[k][j] = &m_ops.m_mat.A[i];
- cnt++;
- break;
- }
- }
- nl_assert(cnt == this->m_terms[k].railstart());
- this->m_mat_ptr[k][this->m_terms[k].railstart()] = &m_ops.m_mat.A[m_ops.m_mat.diag[k]];
- }
- }
-
- template <typename FT, int SIZE>
unsigned matrix_solver_GMRES_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_raphson)
{
const std::size_t iN = this->size();