diff options
author | 2020-06-28 13:13:57 +0200 | |
---|---|---|
committer | 2020-06-28 13:14:42 +0200 | |
commit | 3fcdfa0a9b1783f556abe36c9fb927c25c2170ee (patch) | |
tree | 321f4d3c3e080448f020ee3d037abe6b453a511e /src/lib/netlist/plib/mat_cr.h | |
parent | 3832644d4ad36d5b5807b3d2d9ff6d284bd86236 (diff) |
netlist: code maintenance
* decrease use of reinterpret_cast.
* change some defaults for better ttl game optimization.
* various code cleanup.
Diffstat (limited to 'src/lib/netlist/plib/mat_cr.h')
-rw-r--r-- | src/lib/netlist/plib/mat_cr.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/lib/netlist/plib/mat_cr.h b/src/lib/netlist/plib/mat_cr.h index 2da661d39d7..0f21aff2326 100644 --- a/src/lib/netlist/plib/mat_cr.h +++ b/src/lib/netlist/plib/mat_cr.h @@ -18,6 +18,7 @@ #include "pstate.h" #include "ptypes.h" #include "putil.h" +#include "pmatrix2d.h" #include <algorithm> #include <array> @@ -62,7 +63,7 @@ namespace plib , A(n*n) , nz_num(0) //, nzbd(n * (n+1) / 2) - , nzbd(n) + , m_nzbd(n, n) , m_size(n) { for (std::size_t i=0; i<n+1; i++) @@ -148,10 +149,17 @@ namespace plib for (std::size_t k=0; k < size(); k++) { +#if 0 for (std::size_t j=k + 1; j < size(); j++) if (f[j][k] < FILL_INFINITY) - nzbd[k].push_back(narrow_cast<C>(j)); - nzbd[k].push_back(0); // end of sequence + m_nzbd[k].push_back(narrow_cast<C>(j)); + m_nzbd[k].push_back(0); // end of sequence +#else + for (std::size_t j=k + 1; j < size(); j++) + if (f[j][k] < FILL_INFINITY) + m_nzbd.set(k, m_nzbd.colcount(k), narrow_cast<C>(j)); + m_nzbd.set(k, m_nzbd.colcount(k), 0); // end of sequence +#endif } } @@ -241,10 +249,13 @@ namespace plib A[k] = src.A[k]; } + index_type * nzbd(index_type row) { return m_nzbd[row]; } + index_type nzbd_count(index_type row) { return m_nzbd.colcount(row) - 1; } protected: // FIXME: this should be private // NOLINTNEXTLINE - parray<std::vector<index_type>, N > nzbd; // Support for gaussian elimination + //parray<std::vector<index_type>, N > m_nzbd; // Support for gaussian elimination + pmatrix2d_vrl<index_type> m_nzbd; // Support for gaussian elimination private: //parray<C, N < 0 ? -N * (N-1) / 2 : N * (N+1) / 2 > nzbd; // Support for gaussian elimination std::size_t m_size; @@ -309,9 +320,14 @@ namespace plib std::size_t pi = base::diag[i]; auto f = reciprocal(base::A[pi++]); const std::size_t piie = base::row_idx[i+1]; - const auto &nz = base::nzbd[i]; +#if 0 + const auto &nz = base::m_nzbd[i]; while (auto j = nz[nzbdp++]) // NOLINT(bugprone-infinite-loop) +#else + const auto *nz = base::m_nzbd[i]; + while (auto j = nz[nzbdp++]) // NOLINT(bugprone-infinite-loop) +#endif { // proceed to column i |