Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Fix scaling of Jacobian of new LinearSolver
Browse files Browse the repository at this point in the history
The previous version was comparing with 1.0 instead of assigning it.
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Feb 24, 2017
1 parent 5570fe3 commit d30bd1e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions SimulationRuntime/cpp/Solver/LinearSolver/LinearSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,14 @@ void LinearSolver::solve()

memcpy(_A, Atemp, _dimSys*_dimSys*sizeof(double));

// scale Jacobian
std::fill(_fNominal, _fNominal + _dimSys, 1e-6);
for (int j = 0, idx = 0; j < _dimSys; j++) {
for (int i = 0; i < _dimSys; i++, idx++) {
_fNominal[i] = std::max(std::abs(Atemp[idx]), _fNominal[i]);
}
}

for (int i=0; i<_dimSys; i++) {
if (_fNominal[i] == 0.0) {
_fNominal[i]==1.0;// if the row contains only zeros, there is no need to scale that row.
}
}

LOGGER_WRITE_VECTOR("fNominal", _fNominal, _dimSys, LC_LS, LL_DEBUG);

for (int j = 0, idx = 0; j < _dimSys; j++)
Expand All @@ -227,8 +223,6 @@ void LinearSolver::solve()
for (int i = 0; i < _dimSys; i++)
_b[i] /= _fNominal[i];



if (_generateoutput) {
std::cout << std::endl;
std::cout << "We solve a linear system with coefficient matrix" << std::endl;
Expand Down

0 comments on commit d30bd1e

Please sign in to comment.