Skip to content
Snippets Groups Projects
Commit 3672ad5b authored by Markus Blatt's avatar Markus Blatt
Browse files

[Bugfix][SuperLU] Use a pointer and not a reference for pointing in apply(T*,T*).

A reference is an lvalue. Assigning to it later changes the state
of the rhe referencee (and not the reference). Therefore the code
actually stored references to the right hand and left hand side.
In the case where we did not want to reuse vectors we created two
dense SuperMatrices to used in this apply call and then assigned
them to the references. In fact we actually overwrote the right
and left hand side by doing this.

This patch uses pointers to accompish the intended behaviour, i.e.
point to the correct dense matrices, the ones stored in SuperLU
or the ones stored in SuperLU::apply.
parent aa274599
No related branches found
No related tags found
No related merge requests found
......@@ -643,8 +643,8 @@ namespace Dune
if(mat.N()+mat.M()==0)
DUNE_THROW(ISTLError, "Matrix of SuperLU is null!");
SuperMatrix& mB = B;
SuperMatrix& mX = X;
SuperMatrix* mB = B;
SuperMatrix* mX = X;
SuperMatrix rB, rX;
if (reusevector) {
if(first) {
......@@ -658,8 +658,8 @@ namespace Dune
} else {
SuperLUDenseMatChooser<T>::create(&rB, mat.N(), 1, b, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
SuperLUDenseMatChooser<T>::create(&rX, mat.N(), 1, x, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
mB = rB;
mX = rX;
mB = &rB;
mX = &rX;
}
typename GetSuperLUType<T>::float_type rpg, rcond, ferr, berr;
......@@ -676,7 +676,7 @@ namespace Dune
#endif
SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
&L, &U, work, lwork, &mB, &mX, &rpg, &rcond, &ferr, &berr,
&L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr,
&memusage, &stat, &info);
if(verbose) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment