Skip to content

Commit

Permalink
For sparse signs...
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Feb 15, 2024
1 parent 322dacb commit 11bf129
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/sparse/hs_sparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#define XCONST const
#include "hs.h"
//pthread_mutex_t mutex_dfpool = PTHREAD_MUTEX_INITIALIZER;
#ifdef DEBUG
#include <cassert>
#endif

#define USE_ADJOINT_CODE
void report_derivatives(const dvar_vector& x);
Expand Down Expand Up @@ -1720,7 +1723,10 @@ ivector cs_amd (XCONST hs_smatrix &A) /* Implements only order == 1: Chol*/
{
d += dext ; /* sum up the set differences */
Ci [pn++] = e ; /* keep e in Ei */
h += e ; /* compute the hash of node i */
#ifdef DEBUG
assert(e >= 0);
#endif
h += static_cast<unsigned int>(e); /* compute the hash of node i */
}
else
{
Expand All @@ -1738,7 +1744,10 @@ ivector cs_amd (XCONST hs_smatrix &A) /* Implements only order == 1: Chol*/
if ((nvj = nv [j]) <= 0) continue ; /* node j dead or in Lk */
d += nvj ; /* degree(i) += |j| */
Ci [pn++] = j ; /* place j in node list of i */
h += j ; /* compute hash for node i */
#ifdef DEBUG
assert(j >= 0);
#endif
h += static_cast<unsigned int>(j); /* compute hash for node i */
}
if (d == 0) /* check for mass elimination */
{
Expand All @@ -1757,7 +1766,10 @@ ivector cs_amd (XCONST hs_smatrix &A) /* Implements only order == 1: Chol*/
Ci [p3] = Ci [p1] ; /* move 1st el. to end of Ei */
Ci [p1] = k ; /* add k as 1st element in of Ei */
len [i] = pn - p1 + 1 ; /* new len of adj. list of node i */
h %= n ; /* finalize hash of i */
#ifdef DEBUG
assert(n >= 0);
#endif
h %= static_cast<unsigned int>(n); /* finalize hash of i */
next [i] = hhead [h] ; /* place i in hash bucket */
hhead [h] = i ;
last [i] = h ; /* save hash of i in last[i] */
Expand Down

0 comments on commit 11bf129

Please sign in to comment.