Skip to content

Commit

Permalink
all green
Browse files Browse the repository at this point in the history
  • Loading branch information
cbouilla committed Oct 2, 2023
1 parent af9e44e commit 8549eca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/spasm_certificate.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ bool spasm_factorization_verify(const struct spasm_csr *A, const struct spasm_lu
assert(fact->L != NULL);
const struct spasm_csr *U = fact->U;
const struct spasm_csr *L = fact->L;
const int *Uqinv = fact->qinv;
// const int *Uqinv = fact->qinv;
const int *Lp = fact->p;

int n = A->n;
Expand Down Expand Up @@ -181,12 +181,14 @@ bool spasm_factorization_verify(const struct spasm_csr *A, const struct spasm_lu
spasm_ZZp foo = spasm_ZZp_init(A->field, spasm_prng_next());
if (complete || pivotal_row[i])
x[i] = foo;
else
x[i] = 0;
}
spasm_xApy(x, A, t);
spasm_xApy(x, L, y);
spasm_xApy(y, U, z);
for (int j = 0; j < m; j++)
if ((complete || Uqinv[j] >= 0) && (z[j] != t[j]))
if (z[j] != t[j])
correct = 0;

free(pivotal_row);
Expand Down
4 changes: 2 additions & 2 deletions src/spasm_echelonize.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ static void echelonize_dense(const struct spasm_csr *A, const int *p, int n, con
int *q = spasm_malloc(Sm * sizeof(*q));
size_t *Sqinv = spasm_malloc(Sm * sizeof(*Sqinv)); /* for FFPACK */
size_t *Sp = spasm_malloc(opts->dense_block_size * sizeof(*Sp)); /* for FFPACK / LU only */
bool *pivotal = spasm_malloc(n * sizeof(*pivotal));
for (int i = 0; i < n; i++)
bool *pivotal = spasm_malloc(A->n * sizeof(*pivotal));
for (int i = 0; i < A->n; i++)
pivotal[i] = 0;

int processed = 0;
Expand Down
6 changes: 3 additions & 3 deletions tests/lu.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int main(int argc, char **argv)

struct echelonize_opts opts;
spasm_echelonize_init_opts(&opts);

opts.complete = 1;
struct spasm_lu *fact = spasm_echelonize(A, &opts);
int r = fact->r;
Expand All @@ -47,9 +48,8 @@ int main(int argc, char **argv)
assert(r == fact->U->n);
assert(fact->U->m == m);
assert(fact->L->n == n);

// assert(spasm_factorization_verify(A, fact, 1337));
// assert(spasm_factorization_verify(A, fact, 21011984));
assert(spasm_factorization_verify(A, fact, 1337));
assert(spasm_factorization_verify(A, fact, 21011984));

bool *pivotal_row = spasm_malloc(n * sizeof(*pivotal_row));
bool *pivotal_col = spasm_malloc(m * sizeof(*pivotal_row));
Expand Down

0 comments on commit 8549eca

Please sign in to comment.