Skip to content

Commit

Permalink
CXSparse: revise beta2 computation (separate real/complex cases)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Oct 29, 2023
1 parent e935e13 commit 48fe2f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CXSparse/Source/cs_updown.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ CS_INT cs_updown (cs *L, CS_INT sigma, const cs *C, const CS_INT *parent)
{
p = Lp [j] ;
alpha = w [j] / Lx [p] ; /* alpha = w(j) / L(j,j) */
beta2 = beta*beta + sigma*((double) (alpha*CS_CONJ(alpha))) ;
#ifdef CS_COMPLEX
beta2 = beta*beta + sigma*creal(alpha*CS_CONJ(alpha)) ;
#else
beta2 = beta*beta + sigma*(alpha*alpha) ;
#endif
if (beta2 <= 0) break ; /* not positive definite */
beta2 = sqrt (beta2) ;
delta = (sigma > 0) ? (beta / beta2) : (beta2 / beta) ;
Expand Down

0 comments on commit 48fe2f7

Please sign in to comment.