summaryrefslogtreecommitdiff
path: root/src/gen_laplacian.c
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2017-01-14 11:59:39 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2017-01-14 11:59:39 -0500
commita66e8e2d7a1e9d5eb51f4954435513f6ecb8383c (patch)
treefd9fcbee58f5e3b22f718e856ebc2b1670a6a650 /src/gen_laplacian.c
parent3d6f2bbb756c7fed4e627da196e99047ec7406cc (diff)
downloadfuse_networks-a66e8e2d7a1e9d5eb51f4954435513f6ecb8383c.tar.gz
fuse_networks-a66e8e2d7a1e9d5eb51f4954435513f6ecb8383c.tar.bz2
fuse_networks-a66e8e2d7a1e9d5eb51f4954435513f6ecb8383c.zip
tried to fix voltage boundary conditions
Diffstat (limited to 'src/gen_laplacian.c')
-rw-r--r--src/gen_laplacian.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gen_laplacian.c b/src/gen_laplacian.c
index 42134f0..04f1f9b 100644
--- a/src/gen_laplacian.c
+++ b/src/gen_laplacian.c
@@ -102,11 +102,11 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c,
uint_t num_gedges;
if (voltage_bound) {
- num_gedges = 0;
+ num_gedges = network->bound_inds[num_bounds];
} else {
num_gedges = network->bound_inds[num_bounds] + (num_bounds - 2) * 2;
}
- if (network->boundary == TORUS_BOUND) num_gedges = bound_inds[1];
+ if (network->boundary == TORUS_BOUND) num_gedges = 3 * bound_inds[1];
uint_t num_gverts = network->break_dim;
uint_t nnz = num_gverts + 2 * num_gedges;
@@ -147,6 +147,24 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c,
acoo[num_gverts + 2*i+1] = -1;
acoo[vv]++;
acoo[network->nv + i]++;
+
+ rowind[num_gverts + 2 * network->bound_inds[1] + 2*i] = network->nv + i;
+ colind[num_gverts + 2 * network->bound_inds[1] + 2*i] = network->nv + network->bound_inds[1];
+ acoo[num_gverts + 2 * network->bound_inds[1] + 2*i] = -1;
+ rowind[num_gverts + 2 * network->bound_inds[1] + 2*i+1] = network->nv + network->bound_inds[1];
+ colind[num_gverts + 2 * network->bound_inds[1] + 2*i+1] = network->nv + i;
+ acoo[num_gverts + 2 * network->bound_inds[1] + 2*i+1] = -1;
+ acoo[network->nv + i]++;
+ acoo[network->nv + network->bound_inds[1]]++;
+
+ rowind[num_gverts + 4 * network->bound_inds[1] + 2*i] = vv;
+ colind[num_gverts + 4 * network->bound_inds[1] + 2*i] = network->nv + network->bound_inds[1];
+ acoo[num_gverts + 4 * network->bound_inds[1] + 2*i] = -1;
+ rowind[num_gverts + 4 * network->bound_inds[1] + 2*i+1] = network->nv + network->bound_inds[1];
+ colind[num_gverts + 4 * network->bound_inds[1] + 2*i+1] = vv;
+ acoo[num_gverts + 4 * network->bound_inds[1] + 2*i+1] = -1;
+ acoo[vv]++;
+ acoo[network->nv + network->bound_inds[1]]++;
}
acoo[bound_verts[0]]++;
}
@@ -158,6 +176,12 @@ cholmod_sparse *gen_laplacian(const net_t *instance, cholmod_common *c,
for (uint_t i = 0; i < num_bounds; i++) {
for (uint_t j = 0; j < bound_inds[i + 1] - bound_inds[i]; j++) {
acoo[bound_verts[bound_inds[i] + j]]++;
+ rowind[num_gverts + 2 * (bound_inds[i] + j)] = network->nv;
+ colind[num_gverts + 2 * (bound_inds[i] + j)] = bound_verts[bound_inds[i] + j];
+ rowind[num_gverts + 2 * (bound_inds[i] + j) + 1] = bound_verts[bound_inds[i] + j];
+ colind[num_gverts + 2 * (bound_inds[i] + j) + 1] = network->nv;
+ acoo[network->nv]++;
+ acoo[bound_verts[bound_inds[i] + j]]++;
}
}
} else {