summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.cpp114
-rw-r--r--src/lib/netlist/solver/nld_matrix_solver.h73
-rw-r--r--src/lib/netlist/solver/nld_ms_direct.h12
-rw-r--r--src/lib/netlist/solver/nld_ms_gcr.h12
-rw-r--r--src/lib/netlist/solver/nld_ms_gmres.h14
-rw-r--r--src/lib/netlist/solver/nld_ms_sm.h10
-rw-r--r--src/lib/netlist/solver/nld_ms_sor.h10
-rw-r--r--src/lib/netlist/solver/nld_ms_sor_mat.h6
-rw-r--r--src/lib/netlist/solver/nld_ms_w.h10
9 files changed, 132 insertions, 129 deletions
diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp
index d081ad06464..56f19fc7f4d 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.cpp
+++ b/src/lib/netlist/solver/nld_matrix_solver.cpp
@@ -16,11 +16,11 @@ namespace devices
{
terms_for_net_t::terms_for_net_t(analog_net_t * net)
- : m_railstart(0)
- , m_last_V(0.0)
+ : m_last_V(0.0)
, m_DD_n_m_1(0.0)
, m_h_n_m_1(1e-12)
, m_net(net)
+ , m_railstart(0)
{
}
@@ -70,8 +70,8 @@ namespace devices
for (auto & net : nets)
{
- m_terms.push_back(plib::make_unique<terms_for_net_t>(net));
- m_rails_temp.push_back(plib::make_unique<terms_for_net_t>());
+ m_terms.emplace_back(net);
+ m_rails_temp.emplace_back();
}
for (std::size_t k = 0; k < nets.size(); k++)
@@ -121,7 +121,7 @@ namespace devices
net_proxy_output->net().add_terminal(*p);
// FIXME: repeated calling - kind of brute force
net_proxy_output->net().rebuild_list();
- log().debug("Added input\n");
+ log().debug("Added input {1}", net_proxy_output->name());
}
break;
case detail::terminal_type::OUTPUT:
@@ -204,7 +204,7 @@ namespace devices
for (std::size_t k = 0; k < iN - 1; k++)
for (std::size_t i = k+1; i < iN; i++)
{
- if ((static_cast<int>(m_terms[k]->m_railstart) - static_cast<int>(m_terms[i]->m_railstart)) * sort_order < 0)
+ if ((static_cast<int>(m_terms[k].railstart()) - static_cast<int>(m_terms[i].railstart())) * sort_order < 0)
{
std::swap(m_terms[i], m_terms[k]);
}
@@ -217,11 +217,11 @@ namespace devices
/* rebuild */
for (auto &term : m_terms)
{
- int *other = term->m_connected_net_idx.data();
- for (std::size_t i = 0; i < term->count(); i++)
+ int *other = term.m_connected_net_idx.data();
+ for (std::size_t i = 0; i < term.count(); i++)
//FIXME: this is weird
if (other[i] != -1)
- other[i] = get_net_idx(&term->terms()[i]->connected_terminal()->net());
+ other[i] = get_net_idx(&term.terms()[i]->connected_terminal()->net());
}
}
@@ -231,9 +231,9 @@ namespace devices
for (std::size_t k = 0; k < iN; k++)
{
- m_terms[k]->m_railstart = m_terms[k]->count();
- for (std::size_t i = 0; i < m_rails_temp[k]->count(); i++)
- this->m_terms[k]->add_terminal(m_rails_temp[k]->terms()[i], m_rails_temp[k]->m_connected_net_idx.data()[i], false);
+ m_terms[k].set_railstart(m_terms[k].count());
+ for (std::size_t i = 0; i < m_rails_temp[k].count(); i++)
+ this->m_terms[k].add_terminal(m_rails_temp[k].terms()[i], m_rails_temp[k].m_connected_net_idx.data()[i], false);
}
// free all - no longer needed
@@ -246,20 +246,20 @@ namespace devices
/* create a list of non zero elements. */
for (unsigned k = 0; k < iN; k++)
{
- terms_for_net_t * t = m_terms[k].get();
+ terms_for_net_t & t = m_terms[k];
/* pretty brutal */
- int *other = t->m_connected_net_idx.data();
+ int *other = t.m_connected_net_idx.data();
- t->m_nz.clear();
+ t.m_nz.clear();
- for (std::size_t i = 0; i < t->m_railstart; i++)
- if (!plib::container::contains(t->m_nz, static_cast<unsigned>(other[i])))
- t->m_nz.push_back(static_cast<unsigned>(other[i]));
+ for (std::size_t i = 0; i < t.railstart(); i++)
+ if (!plib::container::contains(t.m_nz, static_cast<unsigned>(other[i])))
+ t.m_nz.push_back(static_cast<unsigned>(other[i]));
- t->m_nz.push_back(k); // add diagonal
+ t.m_nz.push_back(k); // add diagonal
/* and sort */
- std::sort(t->m_nz.begin(), t->m_nz.end());
+ std::sort(t.m_nz.begin(), t.m_nz.end());
}
/* create a list of non zero elements right of the diagonal
@@ -268,30 +268,30 @@ namespace devices
*/
for (std::size_t k = 0; k < iN; k++)
{
- terms_for_net_t * t = m_terms[k].get();
+ terms_for_net_t & t = m_terms[k];
/* pretty brutal */
- int *other = t->m_connected_net_idx.data();
+ int *other = t.m_connected_net_idx.data();
if (k==0)
- t->m_nzrd.clear();
+ t.m_nzrd.clear();
else
{
- t->m_nzrd = m_terms[k-1]->m_nzrd;
- for (auto j = t->m_nzrd.begin(); j != t->m_nzrd.end(); )
+ t.m_nzrd = m_terms[k-1].m_nzrd;
+ for (auto j = t.m_nzrd.begin(); j != t.m_nzrd.end(); )
{
if (*j < k + 1)
- j = t->m_nzrd.erase(j);
+ j = t.m_nzrd.erase(j);
else
++j;
}
}
- for (std::size_t i = 0; i < t->m_railstart; i++)
- if (!plib::container::contains(t->m_nzrd, static_cast<unsigned>(other[i])) && other[i] >= static_cast<int>(k + 1))
- t->m_nzrd.push_back(static_cast<unsigned>(other[i]));
+ for (std::size_t i = 0; i < t.railstart(); i++)
+ if (!plib::container::contains(t.m_nzrd, static_cast<unsigned>(other[i])) && other[i] >= static_cast<int>(k + 1))
+ t.m_nzrd.push_back(static_cast<unsigned>(other[i]));
/* and sort */
- std::sort(t->m_nzrd.begin(), t->m_nzrd.end());
+ std::sort(t.m_nzrd.begin(), t.m_nzrd.end());
}
/* create a list of non zero elements below diagonal k
@@ -304,8 +304,8 @@ namespace devices
{
for (std::size_t j = 0; j < iN; j++)
touched[k][j] = false;
- for (std::size_t j = 0; j < m_terms[k]->m_nz.size(); j++)
- touched[k][m_terms[k]->m_nz[j]] = true;
+ for (std::size_t j = 0; j < m_terms[k].m_nz.size(); j++)
+ touched[k][m_terms[k].m_nz[j]] = true;
}
m_ops = 0;
@@ -317,8 +317,8 @@ namespace devices
if (touched[row][k])
{
m_ops++;
- if (!plib::container::contains(m_terms[k]->m_nzbd, row))
- m_terms[k]->m_nzbd.push_back(row);
+ if (!plib::container::contains(m_terms[k].m_nzbd, row))
+ m_terms[k].m_nzbd.push_back(row);
for (std::size_t col = k + 1; col < iN; col++)
if (touched[k][col])
{
@@ -334,7 +334,7 @@ namespace devices
for (std::size_t k = 0; k < iN; k++)
{
pstring line = plib::pfmt("{1:3}")(k);
- for (const auto & nzrd : m_terms[k]->m_nzrd)
+ for (const auto & nzrd : m_terms[k].m_nzrd)
line += plib::pfmt(" {1:3}")(nzrd);
log().verbose("{1}", line);
}
@@ -346,14 +346,14 @@ namespace devices
{
pstring num = plib::pfmt("{1}")(k);
- state().save(*this, m_terms[k]->m_last_V, this->name(), "lastV." + num);
- state().save(*this, m_terms[k]->m_DD_n_m_1, this->name(), "m_DD_n_m_1." + num);
- state().save(*this, m_terms[k]->m_h_n_m_1, this->name(), "m_h_n_m_1." + num);
+ state().save(*this, m_terms[k].m_last_V, this->name(), "lastV." + num);
+ state().save(*this, m_terms[k].m_DD_n_m_1, this->name(), "m_DD_n_m_1." + num);
+ state().save(*this, m_terms[k].m_h_n_m_1, this->name(), "m_h_n_m_1." + num);
// FIXME: This shouldn't be necessary, recalculate on each entry ...
- state().save(*this, m_gonn[k],"GO" + num, this->name(), m_terms[k]->count());
- state().save(*this, m_gtn[k],"GT" + num, this->name(), m_terms[k]->count());
- state().save(*this, m_Idrn[k],"IDR" + num, this->name(), m_terms[k]->count());
+ state().save(*this, m_gonn[k],"GO" + num, this->name(), m_terms[k].count());
+ state().save(*this, m_gtn[k],"GT" + num, this->name(), m_terms[k].count());
+ state().save(*this, m_Idrn[k],"IDR" + num, this->name(), m_terms[k].count());
}
}
@@ -460,10 +460,10 @@ namespace devices
return next_time_step;
}
- int matrix_solver_t::get_net_idx(const analog_net_t *net) const
+ int matrix_solver_t::get_net_idx(const analog_net_t *net) const noexcept
{
for (std::size_t k = 0; k < m_terms.size(); k++)
- if (m_terms[k]->isNet(net))
+ if (m_terms[k].isNet(net))
return static_cast<int>(k);
return -1;
}
@@ -483,9 +483,9 @@ namespace devices
auto &term = m_terms[irow];
- for (std::size_t i = 0; i < term->count(); i++)
+ for (std::size_t i = 0; i < term.count(); i++)
{
- auto col = get_net_idx(&term->terms()[i]->connected_terminal()->net());
+ auto col = get_net_idx(&term.terms()[i]->connected_terminal()->net());
if (col != -1)
{
if (col==row) col = diag;
@@ -511,9 +511,9 @@ namespace devices
double weight = 0.0;
auto &term = m_terms[row];
- for (std::size_t i = 0; i < term->count(); i++)
+ for (std::size_t i = 0; i < term.count(); i++)
{
- auto col = get_net_idx(&term->terms()[i]->connected_terminal()->net());
+ auto col = get_net_idx(&term.terms()[i]->connected_terminal()->net());
if (col >= 0)
{
auto colu = static_cast<std::size_t>(col);
@@ -527,7 +527,7 @@ namespace devices
}
}
}
- return weight; // / static_cast<double>(term->m_railstart);
+ return weight; // / static_cast<double>(term.railstart());
}
}
@@ -535,19 +535,19 @@ namespace devices
{
if (term->connected_terminal()->net().isRailNet())
{
- m_rails_temp[k]->add_terminal(term, -1, false);
+ m_rails_temp[k].add_terminal(term, -1, false);
}
else
{
int ot = get_net_idx(&term->connected_terminal()->net());
if (ot>=0)
{
- m_terms[k]->add_terminal(term, ot, true);
+ m_terms[k].add_terminal(term, ot, true);
}
/* Should this be allowed ? */
else // if (ot<0)
{
- m_rails_temp[k]->add_terminal(term, ot, true);
+ m_rails_temp[k].add_terminal(term, ot, true);
log().fatal(MF_FOUND_TERM_WITH_MISSING_OTHERNET(term->name()));
}
}
@@ -563,15 +563,15 @@ namespace devices
{
//const nl_double DD_n = (n->Q_Analog() - t->m_last_V);
// avoid floating point exceptions
- const nl_double DD_n = std::max(-1e100, std::min(1e100,(t->getV() - t->m_last_V)));
+ const nl_double DD_n = std::max(-1e100, std::min(1e100,(t.getV() - t.m_last_V)));
const nl_double hn = cur_ts;
- //printf("%g %g %g %g\n", DD_n, hn, t->m_DD_n_m_1, t->m_h_n_m_1);
- nl_double DD2 = (DD_n / hn - t->m_DD_n_m_1 / t->m_h_n_m_1) / (hn + t->m_h_n_m_1);
+ //printf("%g %g %g %g\n", DD_n, hn, t.m_DD_n_m_1, t.m_h_n_m_1);
+ nl_double DD2 = (DD_n / hn - t.m_DD_n_m_1 / t.m_h_n_m_1) / (hn + t.m_h_n_m_1);
nl_double new_net_timestep(0);
- t->m_h_n_m_1 = hn;
- t->m_DD_n_m_1 = DD_n;
+ t.m_h_n_m_1 = hn;
+ t.m_DD_n_m_1 = DD_n;
if (std::fabs(DD2) > plib::constants<nl_double>::cast(1e-60)) // avoid div-by-zero
new_net_timestep = std::sqrt(m_params.m_dynamic_lte / std::fabs(plib::constants<nl_double>::cast(0.5)*DD2));
else
@@ -580,7 +580,7 @@ namespace devices
if (new_net_timestep < new_solver_timestep)
new_solver_timestep = new_net_timestep;
- t->m_last_V = t->getV();
+ t.m_last_V = t.getV();
}
if (new_solver_timestep < m_params.m_min_timestep)
{
diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h
index 1a452917f0f..a7d74c45004 100644
--- a/src/lib/netlist/solver/nld_matrix_solver.h
+++ b/src/lib/netlist/solver/nld_matrix_solver.h
@@ -107,7 +107,7 @@ namespace devices
};
- class terms_for_net_t : plib::nocopyassignmove
+ class terms_for_net_t
{
public:
terms_for_net_t(analog_net_t * net = nullptr);
@@ -116,32 +116,36 @@ namespace devices
void add_terminal(terminal_t *term, int net_other, bool sorted);
- std::size_t count() const { return m_terms.size(); }
+ std::size_t count() const noexcept { return m_terms.size(); }
- terminal_t **terms() { return m_terms.data(); }
+ std::size_t railstart() const noexcept { return m_railstart; }
- nl_double getV() const { return m_net->Q_Analog(); }
+ terminal_t **terms() noexcept { return m_terms.data(); }
- void setV(nl_double v) { m_net->set_Q_Analog(v); }
+ nl_double getV() const noexcept { return m_net->Q_Analog(); }
- bool isNet(const analog_net_t * net) const { return net == m_net; }
+ void setV(nl_double v) noexcept { m_net->set_Q_Analog(v); }
- std::size_t m_railstart;
+ bool isNet(const analog_net_t * net) const noexcept { return net == m_net; }
+
+ void set_railstart(std::size_t val) noexcept { m_railstart = val; }
+
+ PALIGNAS_VECTOROPT()
- std::vector<unsigned> m_nz; /* all non zero for multiplication */
- std::vector<unsigned> m_nzrd; /* non zero right of the diagonal for elimination, may include RHS element */
- std::vector<unsigned> m_nzbd; /* non zero below of the diagonal for elimination */
+ plib::aligned_vector<unsigned> m_nz; /* all non zero for multiplication */
+ plib::aligned_vector<unsigned> m_nzrd; /* non zero right of the diagonal for elimination, may include RHS element */
+ plib::aligned_vector<unsigned> m_nzbd; /* non zero below of the diagonal for elimination */
/* state */
nl_double m_last_V;
nl_double m_DD_n_m_1;
nl_double m_h_n_m_1;
- std::vector<int> m_connected_net_idx;
+ plib::aligned_vector<int> m_connected_net_idx;
private:
analog_net_t * m_net;
- std::vector<terminal_t *> m_terms;
-
+ plib::aligned_vector<terminal_t *> m_terms;
+ std::size_t m_railstart;
};
class proxied_analog_output_t : public analog_output_t
@@ -176,8 +180,8 @@ namespace devices
const netlist_time solve(netlist_time now);
void update_inputs();
- bool has_dynamic_devices() const { return m_dynamic_devices.size() > 0; }
- bool has_timestep_devices() const { return m_step_devices.size() > 0; }
+ bool has_dynamic_devices() const noexcept { return m_dynamic_devices.size() > 0; }
+ bool has_timestep_devices() const noexcept { return m_step_devices.size() > 0; }
void update_forced();
void update_after(const netlist_time after)
@@ -190,7 +194,7 @@ namespace devices
NETLIB_RESETI();
public:
- int get_net_idx(const analog_net_t *net) const;
+ int get_net_idx(const analog_net_t *net) const noexcept;
std::pair<int, int> get_left_right_of_diag(std::size_t row, std::size_t diag);
double get_weight_around_diag(std::size_t row, std::size_t diag);
@@ -239,8 +243,8 @@ namespace devices
std::size_t max_rail = 0;
for (std::size_t k = 0; k < iN; k++)
{
- max_count = std::max(max_count, m_terms[k]->count());
- max_rail = std::max(max_rail, m_terms[k]->m_railstart);
+ max_count = std::max(max_count, m_terms[k].count());
+ max_rail = std::max(max_rail, m_terms[k].railstart());
}
m_mat_ptr.resize(iN, max_rail+1);
@@ -251,12 +255,12 @@ namespace devices
for (std::size_t k = 0; k < iN; k++)
{
- auto count = m_terms[k]->count();
+ auto count = m_terms[k].count();
for (std::size_t i = 0; i < count; i++)
{
- m_terms[k]->terms()[i]->set_ptrs(&m_gtn[k][i], &m_gonn[k][i], &m_Idrn[k][i]);
- m_connected_net_Vn[k][i] = m_terms[k]->terms()[i]->connected_terminal()->net().Q_Analog_state_ptr();
+ m_terms[k].terms()[i]->set_ptrs(&m_gtn[k][i], &m_gonn[k][i], &m_Idrn[k][i]);
+ m_connected_net_Vn[k][i] = m_terms[k].terms()[i]->connected_terminal()->net().Q_Analog_state_ptr();
}
}
}
@@ -266,11 +270,11 @@ namespace devices
{
for (std::size_t k = 0; k < N; k++)
{
- auto *net = m_terms[k].get();
+ auto &net = m_terms[k];
auto **tcr_r = &(tcr[k][0]);
- const std::size_t term_count = net->count();
- const std::size_t railstart = net->m_railstart;
+ const std::size_t term_count = net.count();
+ const std::size_t railstart = net.railstart();
const auto &go = m_gonn[k];
const auto &gt = m_gtn[k];
const auto &Idr = m_Idrn[k];
@@ -368,12 +372,11 @@ namespace devices
plib::pmatrix2d<nl_double *, aligned_alloc<nl_double *>> m_mat_ptr;
plib::pmatrix2d<nl_double *, aligned_alloc<nl_double *>> m_connected_net_Vn;
- std::vector<plib::unique_ptr<terms_for_net_t>> m_terms;
+ plib::aligned_vector<terms_for_net_t> m_terms;
+ plib::aligned_vector<terms_for_net_t> m_rails_temp;
std::vector<unique_pool_ptr<proxied_analog_output_t>> m_inps;
- std::vector<plib::unique_ptr<terms_for_net_t>> m_rails_temp;
-
const solver_parameters_t &m_params;
state_var<int> m_stat_calculations;
@@ -410,7 +413,7 @@ namespace devices
const std::size_t iN = this->m_terms.size();
typename std::decay<decltype(V[0])>::type cerr = 0;
for (std::size_t i = 0; i < iN; i++)
- cerr = std::max(cerr, std::abs(V[i] - this->m_terms[i]->getV()));
+ cerr = std::max(cerr, std::abs(V[i] - this->m_terms[i].getV()));
return cerr;
}
@@ -419,7 +422,7 @@ namespace devices
{
const std::size_t iN = this->m_terms.size();
for (std::size_t i = 0; i < iN; i++)
- this->m_terms[i]->setV(V[i]);
+ this->m_terms[i].setV(V[i]);
}
template <typename T>
@@ -431,14 +434,14 @@ namespace devices
const std::size_t iN = child.size();
for (std::size_t k = 0; k < iN; k++)
{
- terms_for_net_t *terms = m_terms[k].get();
+ terms_for_net_t &terms = m_terms[k];
float_type * Ak = &child.A(k, 0ul);
for (std::size_t i=0; i < iN; i++)
Ak[i] = 0.0;
- const std::size_t terms_count = terms->count();
- const std::size_t railstart = terms->m_railstart;
+ const std::size_t terms_count = terms.count();
+ const std::size_t railstart = terms.railstart();
const float_type * const gt = m_gtn[k];
{
@@ -450,7 +453,7 @@ namespace devices
}
const float_type * const go = m_gonn[k];
- int * net_other = terms->m_connected_net_idx.data();
+ int * net_other = terms.m_connected_net_idx.data();
for (std::size_t i = 0; i < railstart; i++)
Ak[net_other[i]] += go[i];
@@ -469,7 +472,7 @@ namespace devices
float_type rhsk_a = 0.0;
float_type rhsk_b = 0.0;
- const std::size_t terms_count = m_terms[k]->count();
+ const std::size_t terms_count = m_terms[k].count();
const float_type * const go = m_gonn[k];
const float_type * const Idr = m_Idrn[k];
const float_type * const * other_cur_analog = m_connected_net_Vn[k];
@@ -477,7 +480,7 @@ namespace devices
for (std::size_t i = 0; i < terms_count; i++)
rhsk_a = rhsk_a + Idr[i];
- for (std::size_t i = m_terms[k]->m_railstart; i < terms_count; i++)
+ for (std::size_t i = m_terms[k].railstart(); i < terms_count; i++)
//rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
rhsk_b = rhsk_b - go[i] * *other_cur_analog[i];
diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h
index 761d9db78d2..ba38a68235c 100644
--- a/src/lib/netlist/solver/nld_ms_direct.h
+++ b/src/lib/netlist/solver/nld_ms_direct.h
@@ -73,10 +73,10 @@ namespace devices
/* add RHS element */
for (std::size_t k = 0; k < size(); k++)
{
- terms_for_net_t * t = m_terms[k].get();
+ terms_for_net_t & t = m_terms[k];
- if (!plib::container::contains(t->m_nzrd, static_cast<unsigned>(size())))
- t->m_nzrd.push_back(static_cast<unsigned>(size()));
+ if (!plib::container::contains(t.m_nzrd, static_cast<unsigned>(size())))
+ t.m_nzrd.push_back(static_cast<unsigned>(size()));
}
// FIXME: This shouldn't be necessary ...
@@ -94,8 +94,8 @@ namespace devices
{
/* FIXME: Singular matrix? */
const FT f = 1.0 / A(i,i);
- const auto &nzrd = m_terms[i]->m_nzrd;
- const auto &nzbd = m_terms[i]->m_nzbd;
+ const auto &nzrd = m_terms[i].m_nzrd;
+ const auto &nzbd = m_terms[i].m_nzbd;
for (auto j : nzbd)
{
@@ -178,7 +178,7 @@ namespace devices
for (std::size_t j = kN; j-- > 0; )
{
FT tmp = 0;
- const auto &nzrd = m_terms[j]->m_nzrd;
+ const auto &nzrd = m_terms[j].m_nzrd;
const auto e = nzrd.size() - 1; /* exclude RHS element */
for ( std::size_t k = 0; k < e; k++)
tmp += A(j, nzrd[k]) * x[nzrd[k]];
diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h
index cda9336c1c9..7e51f5d7ef5 100644
--- a/src/lib/netlist/solver/nld_ms_gcr.h
+++ b/src/lib/netlist/solver/nld_ms_gcr.h
@@ -90,7 +90,7 @@ namespace devices
for (std::size_t k = 0; k < iN; k++)
{
fill[k].resize(iN, decltype(mat)::FILL_INFINITY);
- for (auto &j : this->m_terms[k]->m_nz)
+ for (auto &j : this->m_terms[k].m_nz)
{
fill[k][j] = 0;
raw_elements++;
@@ -108,9 +108,9 @@ namespace devices
{
std::size_t cnt(0);
/* build pointers into the compressed row format matrix for each terminal */
- for (std::size_t j=0; j< this->m_terms[k]->m_railstart;j++)
+ for (std::size_t j=0; j< this->m_terms[k].railstart();j++)
{
- int other = this->m_terms[k]->m_connected_net_idx[j];
+ int other = this->m_terms[k].m_connected_net_idx[j];
for (auto i = mat.row_idx[k]; i < mat.row_idx[k+1]; i++)
if (other == static_cast<int>(mat.col_idx[i]))
{
@@ -119,8 +119,8 @@ namespace devices
break;
}
}
- nl_assert(cnt == this->m_terms[k]->m_railstart);
- m_mat_ptr[k][this->m_terms[k]->m_railstart] = &mat.A[mat.diag[k]];
+ nl_assert(cnt == this->m_terms[k].railstart());
+ m_mat_ptr[k][this->m_terms[k].railstart()] = &mat.A[mat.diag[k]];
}
this->log().verbose("maximum fill: {1}", gr.first);
@@ -156,7 +156,7 @@ namespace devices
for (std::size_t i = 0; i < iN - 1; i++)
{
- const auto &nzbd = this->m_terms[i]->m_nzbd;
+ const auto &nzbd = this->m_terms[i].m_nzbd;
if (nzbd.size() > 0)
{
diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h
index 771a704093a..f99368549a9 100644
--- a/src/lib/netlist/solver/nld_ms_gmres.h
+++ b/src/lib/netlist/solver/nld_ms_gmres.h
@@ -72,8 +72,8 @@ namespace devices
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].get();
- for (const auto &nz_j : row->m_nz)
+ 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;
}
@@ -87,18 +87,18 @@ namespace devices
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]->m_railstart;j++)
+ 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]))
+ 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]->m_railstart);
- this->m_mat_ptr[k][this->m_terms[k]->m_railstart] = &m_ops.m_mat.A[m_ops.m_mat.diag[k]];
+ 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]];
}
}
@@ -116,7 +116,7 @@ namespace devices
for (std::size_t k = 0; k < iN; k++)
{
- this->m_new_V[k] = this->m_terms[k]->getV();
+ this->m_new_V[k] = this->m_terms[k].getV();
}
const float_type accuracy = this->m_params.m_accuracy;
diff --git a/src/lib/netlist/solver/nld_ms_sm.h b/src/lib/netlist/solver/nld_ms_sm.h
index 386a38fbe6f..bec4e426208 100644
--- a/src/lib/netlist/solver/nld_ms_sm.h
+++ b/src/lib/netlist/solver/nld_ms_sm.h
@@ -141,13 +141,13 @@ namespace devices
{
/* FIXME: Singular matrix? */
const float_type f = 1.0 / W(i,i);
- const auto * const p = m_terms[i]->m_nzrd.data();
- const std::size_t e = m_terms[i]->m_nzrd.size();
+ const auto * const p = m_terms[i].m_nzrd.data();
+ const std::size_t e = m_terms[i].m_nzrd.size();
/* Eliminate column i from row j */
- const auto * const pb = m_terms[i]->m_nzbd.data();
- const std::size_t eb = m_terms[i]->m_nzbd.size();
+ const auto * const pb = m_terms[i].m_nzbd.data();
+ const std::size_t eb = m_terms[i].m_nzbd.size();
for (std::size_t jb = 0; jb < eb; jb++)
{
const unsigned j = pb[jb];
@@ -236,7 +236,7 @@ namespace devices
{
std::size_t colcount = 0;
- auto &nz = m_terms[row]->m_nz;
+ auto &nz = m_terms[row].m_nz;
for (unsigned & col : nz)
{
v[col] = A(row,col) - lA(row,col);
diff --git a/src/lib/netlist/solver/nld_ms_sor.h b/src/lib/netlist/solver/nld_ms_sor.h
index d886a28c0be..dbd8fa229ac 100644
--- a/src/lib/netlist/solver/nld_ms_sor.h
+++ b/src/lib/netlist/solver/nld_ms_sor.h
@@ -84,13 +84,13 @@ unsigned matrix_solver_SOR_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_rap
float_type gabs_t = 0.0;
float_type RHS_t = 0.0;
- const std::size_t term_count = this->m_terms[k]->count();
+ const std::size_t term_count = this->m_terms[k].count();
const float_type * const gt = this->m_gtn[k];
const float_type * const go = this->m_gonn[k];
const float_type * const Idr = this->m_Idrn[k];
auto other_cur_analog = this->m_connected_net_Vn[k];
- this->m_new_V[k] = this->m_terms[k]->getV();
+ this->m_new_V[k] = this->m_terms[k].getV();
for (std::size_t i = 0; i < term_count; i++)
{
@@ -98,7 +98,7 @@ unsigned matrix_solver_SOR_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_rap
RHS_t = RHS_t + Idr[i];
}
- for (std::size_t i = this->m_terms[k]->m_railstart; i < term_count; i++)
+ for (std::size_t i = this->m_terms[k].railstart(); i < term_count; i++)
RHS_t = RHS_t - go[i] * *other_cur_analog[i];
RHS[k] = RHS_t;
@@ -134,8 +134,8 @@ unsigned matrix_solver_SOR_t<FT, SIZE>::vsolve_non_dynamic(const bool newton_rap
float_type err = 0;
for (std::size_t k = 0; k < iN; k++)
{
- const int * net_other = this->m_terms[k]->m_connected_net_idx.data();
- const std::size_t railstart = this->m_terms[k]->m_railstart;
+ const int * net_other = this->m_terms[k].m_connected_net_idx.data();
+ const std::size_t railstart = this->m_terms[k].railstart();
const float_type * go = this->m_gonn[k];
float_type Idrive = 0.0;
diff --git a/src/lib/netlist/solver/nld_ms_sor_mat.h b/src/lib/netlist/solver/nld_ms_sor_mat.h
index d0866a2ad08..47f6a8e4766 100644
--- a/src/lib/netlist/solver/nld_ms_sor_mat.h
+++ b/src/lib/netlist/solver/nld_ms_sor_mat.h
@@ -166,7 +166,7 @@ namespace devices
#endif
for (std::size_t k = 0; k < iN; k++)
- this->m_new_V[k] = this->m_terms[k]->getV();
+ this->m_new_V[k] = this->m_terms[k].getV();
do {
resched = false;
@@ -176,8 +176,8 @@ namespace devices
{
float_type Idrive = 0;
- const auto *p = this->m_terms[k]->m_nz.data();
- const std::size_t e = this->m_terms[k]->m_nz.size();
+ const auto *p = this->m_terms[k].m_nz.data();
+ const std::size_t e = this->m_terms[k].m_nz.size();
for (std::size_t i = 0; i < e; i++)
Idrive = Idrive + this->A(k,p[i]) * this->m_new_V[p[i]];
diff --git a/src/lib/netlist/solver/nld_ms_w.h b/src/lib/netlist/solver/nld_ms_w.h
index 34e2f42b35e..d6969d4fd8c 100644
--- a/src/lib/netlist/solver/nld_ms_w.h
+++ b/src/lib/netlist/solver/nld_ms_w.h
@@ -156,13 +156,13 @@ void matrix_solver_w_t<FT, SIZE>::LE_invert()
{
/* FIXME: Singular matrix? */
const float_type f = 1.0 / W(i,i);
- const auto * const p = m_terms[i]->m_nzrd.data();
- const size_t e = m_terms[i]->m_nzrd.size();
+ const auto * const p = m_terms[i].m_nzrd.data();
+ const size_t e = m_terms[i].m_nzrd.size();
/* Eliminate column i from row j */
- const auto * const pb = m_terms[i]->m_nzbd.data();
- const size_t eb = m_terms[i]->m_nzbd.size();
+ const auto * const pb = m_terms[i].m_nzbd.data();
+ const size_t eb = m_terms[i].m_nzbd.size();
for (std::size_t jb = 0; jb < eb; jb++)
{
const auto j = pb[jb];
@@ -250,7 +250,7 @@ unsigned matrix_solver_w_t<FT, SIZE>::solve_non_dynamic(const bool newton_raphso
for (unsigned row = 0; row < iN; row ++)
{
unsigned cc=0;
- auto &nz = m_terms[row]->m_nz;
+ auto &nz = m_terms[row].m_nz;
for (auto & col : nz)
{
if (A(row,col) != lA(row,col))