Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix klu_refactor issue #8

Merged
merged 1 commit into from
Apr 14, 2020
Merged

Fix klu_refactor issue #8

merged 1 commit into from
Apr 14, 2020

Conversation

geofjamg
Copy link
Member

Signed-off-by: Geoffroy Jamgotchian [email protected]

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest
No

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix

What is the current behavior? (You can also link to an open issue here)
In some cases, klu_refactor may lead to very inaccurate factorization and serious numerical issues.

What is the new behavior (if this is a feature change)?
A klu_rgrowth function is used to determine if a whole factorization has to be done again (klu_factor) or if klu_refactor result is fine.

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

(if any of the questions/checkboxes don't apply, please delete them entirely)

Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@geofjamg geofjamg requested review from annetill and mathbagu April 10, 2020 20:01
throw std::runtime_error("klu_rgrowth error " + context.error());
}
// if rgrowth is too small we have to do a whole factorization
if (context.common.rgrowth < 1e-10) { // no idea what could be the right threshold but 1e-10 seems to work...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation says:

Computes the reciprocal pivot growth, rgrowth = min j ((max i |c ij |)/(max i |u ij |)), where c ij is a
scaled entry in a diagonal block of the block triangular form. In MATLAB notation:
rgrowth = min (max (abs (R\A(p,q) - F)) ./ max (abs (U)))
where the factorization is L*U + F = R \ A(p,q).

@mathbagu
Copy link

@geofjamg I won't be able to release this new version, as we cannot generate the Mac version. Maybe we can try to a Github actions script that:

  • build on the three OS (Linux, Mac and Windows)
  • upload everything as package
  • create the jar with the three versions
    and upload the jar manually on maven central?

@zamarrenolm
Copy link
Member

@geofjamg I won't be able to release this new version, as we cannot generate the Mac version. Maybe we can try to a Github actions script that:

  • build on the three OS (Linux, Mac and Windows)
  • upload everything as package
  • create the jar with the three versions
    and upload the jar manually on maven central?

I have been able to build the updated math library on Mac OS anc check it against the small-grid-hvdc test case using the OpenLoadFlow implementation.

With the updated math version I obtained the same values with dense and sparse matrix implementations (diffs in resulting voltages < 6e-9). With the previous version the differences were greater (up to 10 kV).

@geofjamg geofjamg merged commit 75d4419 into master Apr 14, 2020
@geofjamg geofjamg deleted the fix_klu_refactor_issue branch April 14, 2020 11:03
@zamarrenolm zamarrenolm mentioned this pull request Apr 14, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants