diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-01-16 01:31:10 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-01-16 01:31:10 -0500 |
commit | 1e1fdfc2e3892667bccaf317a01defd8832041c7 (patch) | |
tree | cc5ef9adbfe4a8f11744f4b7afd23a37cfdd74d4 /src/factor_update.c | |
parent | 57857b9ebfb2c0a78c2eb1128d3fb4ed8d597ec4 (diff) | |
download | fuse_networks-1e1fdfc2e3892667bccaf317a01defd8832041c7.tar.gz fuse_networks-1e1fdfc2e3892667bccaf317a01defd8832041c7.tar.bz2 fuse_networks-1e1fdfc2e3892667bccaf317a01defd8832041c7.zip |
fixed voltage and torus conditions, current and free boundaries and broken right now
Diffstat (limited to 'src/factor_update.c')
-rw-r--r-- | src/factor_update.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/factor_update.c b/src/factor_update.c index f27971b..a51705a 100644 --- a/src/factor_update.c +++ b/src/factor_update.c @@ -36,3 +36,33 @@ void factor_update(cholmod_factor *factor, uint_t v1, uint_t v2, cholmod_common CHOL_F(free_sparse)(&perm_update_mat, c); CHOL_F(free_sparse)(&update_mat, c); } + +void factor_update2(cholmod_factor *factor, uint_t v, cholmod_common *c) { + uint_t n = factor->n; + + cholmod_sparse *update_mat = + CHOL_F(allocate_sparse)(n, n, 1, true, true, 0, CHOLMOD_REAL, c); + + int_t *pp = (int_t *)update_mat->p; + int_t *ii = (int_t *)update_mat->i; + double *xx = (double *)update_mat->x; + + for (uint_t i = 0; i <= v; i++) { + pp[i] = 0; + } + + for (uint_t i = v + 1; i <= n; i++) { + pp[i] = 1; + } + + ii[0] = v; + xx[0] = 1; + + cholmod_sparse *perm_update_mat = CHOL_F(submatrix)( + update_mat, factor->Perm, factor->n, NULL, -1, true, true, c); + + CHOL_F(updown)(false, perm_update_mat, factor, c); + + CHOL_F(free_sparse)(&perm_update_mat, c); + CHOL_F(free_sparse)(&update_mat, c); +} |