fixed struct_matvec for case x=y
This commit is contained in:
parent
c28f3c9145
commit
5e19d62b87
@ -125,6 +125,8 @@ hypre_StructMatvecCompute( void *matvec_vdata,
|
||||
HYPRE_Complex temp;
|
||||
HYPRE_Int compute_i, i;
|
||||
|
||||
hypre_StructVector *x_tmp = NULL;
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Initialize some things
|
||||
*-----------------------------------------------------------------------*/
|
||||
@ -168,6 +170,11 @@ hypre_StructMatvecCompute( void *matvec_vdata,
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
if (x == y)
|
||||
{
|
||||
x_tmp = hypre_StructVectorClone(y);
|
||||
x = x_tmp;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
* Do (alpha != 0.0) computation
|
||||
*-----------------------------------------------------------------------*/
|
||||
@ -275,6 +282,12 @@ hypre_StructMatvecCompute( void *matvec_vdata,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (x_tmp)
|
||||
{
|
||||
hypre_StructVectorDestroy(x_tmp);
|
||||
x = y;
|
||||
}
|
||||
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user