summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/solver/nld_ms_direct1.h
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
committer Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
commit97b67170277437131adf6ed4d60139c172529e4f (patch)
tree7a5cbf608f191075f1612b1af15832c206a3fe2d /src/lib/netlist/solver/nld_ms_direct1.h
parentb380514764cf857469bae61c11143a19f79a74c5 (diff)
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
Diffstat (limited to 'src/lib/netlist/solver/nld_ms_direct1.h')
-rw-r--r--src/lib/netlist/solver/nld_ms_direct1.h50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/lib/netlist/solver/nld_ms_direct1.h b/src/lib/netlist/solver/nld_ms_direct1.h
index 6e1f99bad7d..fbbb8ecb098 100644
--- a/src/lib/netlist/solver/nld_ms_direct1.h
+++ b/src/lib/netlist/solver/nld_ms_direct1.h
@@ -13,37 +13,41 @@
namespace netlist
{
- namespace devices
- {
-class matrix_solver_direct1_t: public matrix_solver_direct_t<1,1>
+namespace devices
{
-public:
+ template <typename FT>
+ class matrix_solver_direct1_t: public matrix_solver_direct_t<FT, 1>
+ {
+ public:
- matrix_solver_direct1_t(netlist_t &anetlist, const pstring &name, const solver_parameters_t *params)
- : matrix_solver_direct_t<1, 1>(anetlist, name, params, 1)
- {}
- virtual unsigned vsolve_non_dynamic(const bool newton_raphson) override;
+ using float_type = FT;
+ using base_type = matrix_solver_direct_t<FT, 1>;
-};
+ matrix_solver_direct1_t(netlist_state_t &anetlist, const pstring &name, const solver_parameters_t *params)
+ : matrix_solver_direct_t<FT, 1>(anetlist, name, params, 1)
+ {}
-// ----------------------------------------------------------------------------------------
-// matrix_solver - Direct1
-// ----------------------------------------------------------------------------------------
+ // ----------------------------------------------------------------------------------------
+ // matrix_solver - Direct1
+ // ----------------------------------------------------------------------------------------
+ unsigned vsolve_non_dynamic(const bool newton_raphson) override
+ {
+ this->build_LE_A(*this);
+ this->build_LE_RHS(*this);
+ //NL_VERBOSE_OUT(("{1} {2}\n", new_val, m_RHS[0] / m_A[0][0]);
-inline unsigned matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson)
-{
- build_LE_A<matrix_solver_direct1_t>();
- build_LE_RHS<matrix_solver_direct1_t>();
- //NL_VERBOSE_OUT(("{1} {2}\n", new_val, m_RHS[0] / m_A[0][0]);
+ std::array<FT, 1> new_V = { this->RHS(0) / this->A(0,0) };
+
+ const FT err = (newton_raphson ? this->delta(new_V) : 0.0);
+ this->store(new_V);
+ return (err > this->m_params.m_accuracy) ? 2 : 1;
+ }
+
+ };
- nl_double new_V[1] = { RHS(0) / A(0,0) };
- const nl_double err = (newton_raphson ? delta(new_V) : 0.0);
- store(new_V);
- return (err > this->m_params.m_accuracy) ? 2 : 1;
-}
- } //namespace devices
+} //namespace devices
} // namespace netlist