This parameter is always passed as 1.
jj = ja[j];
if (jj != i){
nrow ++;
- L = SparseMatrix_coordinate_form_add_entries(L, 1, &i, &jj, &a);
+ L = SparseMatrix_coordinate_form_add_entries(L, &i, &jj, &a);
}
}
- L = SparseMatrix_coordinate_form_add_entries(L, 1, &i, &i, &nrow);
+ L = SparseMatrix_coordinate_form_add_entries(L, &i, &i, &nrow);
}
L = SparseMatrix_from_coordinate_format(L);
if (i < j) {
i1 = j; j1 = i;
}
- A = SparseMatrix_coordinate_form_add_entries(A, 1, &j1, &i1, &val);
- return SparseMatrix_coordinate_form_add_entries(A, 1, &i1, &j1, &val);
+ A = SparseMatrix_coordinate_form_add_entries(A, &j1, &i1, &val);
+ return SparseMatrix_coordinate_form_add_entries(A, &i1, &j1, &val);
}
static void plot_dot_edges(FILE *f, SparseMatrix A){
ja = A->ja;
for (i = 0; i < n; i++){
ig1 = groups[i]-1;/* add a diagonal entry */
- SparseMatrix_coordinate_form_add_entries(B, 1, &ig1, &ig1, &one);
+ SparseMatrix_coordinate_form_add_entries(B, &ig1, &ig1, &one);
for (j = ia[i]; j < ia[i+1]; j++){
jj = ja[j];
if (i != jj && groups[i] != groups[jj] && groups[jj] != GRP_RANDOM && groups[jj] != GRP_BBOX){
ig1 = groups[i]-1; ig2 = groups[jj]-1;
- SparseMatrix_coordinate_form_add_entries(B, 1, &ig1, &ig2, &one);
+ SparseMatrix_coordinate_form_add_entries(B, &ig1, &ig2, &one);
}
}
}
for (j = ia[i]; j < ia[i+1]; j++){
jj = ja[j];
if (i != jj && groups[i] == groups[jj]){
- SparseMatrix_coordinate_form_add_entries(B, 1, &i, &jj, &one);
+ SparseMatrix_coordinate_form_add_entries(B, &i, &jj, &one);
}
}
}
} else {
ipoly2 = ipoly;
}
- SparseMatrix_coordinate_form_add_entries(*poly_lines, 1, &i, &cur, &ipoly2);
+ SparseMatrix_coordinate_form_add_entries(*poly_lines, &i, &cur, &ipoly2);
while (next != sta){
mask[next] = i;
} else {
ipoly2 = ipoly;
}
- SparseMatrix_coordinate_form_add_entries(*poly_lines, 1, &i, &next, &ipoly2);
+ SparseMatrix_coordinate_form_add_entries(*poly_lines, &i, &next, &ipoly2);
nn = neighbor(next, 0, edim, elist);
nlink = 0;
} else {
ipoly2 = ipoly;
}
- SparseMatrix_coordinate_form_add_entries(*poly_lines, 1, &i, &sta, &ipoly2);/* complete a cycle by adding starting point */
+ SparseMatrix_coordinate_form_add_entries(*poly_lines, &i, &sta, &ipoly2);/* complete a cycle by adding starting point */
ipoly++;
}
assert(jj < n);
edge_table[ne*2] = t1;/*t1->t2*/
edge_table[ne*2+1] = t2;
- half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, 1, &i, &jj, &ne);
- half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, 1, &jj, &i, &ne);
+ half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, &i, &jj, &ne);
+ half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, &jj, &i, &ne);
ne++;
edge_table[ne*2] = t2;/*t2->t1*/
edge_table[ne*2+1] = t1;
- half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, 1, &i, &jj, &ne);
- half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, 1, &jj, &i, &ne);
+ half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, &i, &jj, &ne);
+ half_edges = SparseMatrix_coordinate_form_add_entries(half_edges, &jj, &i, &ne);
ne++;
while ((enext = cycle_next(ecur)) != cycle_head){
edge_cycle_map[ecur] = NOT_ON_CYCLE;
head = edge_head(ecur);
- SparseMatrix_coordinate_form_add_entries(*polys, 1, &i, &head, &i);
+ SparseMatrix_coordinate_form_add_entries(*polys, &i, &head, &i);
ecur = enext;
}
edge_cycle_map[ecur] = NOT_ON_CYCLE;
head = edge_head(ecur); tail = edge_tail(ecur);
- SparseMatrix_coordinate_form_add_entries(*polys, 1, &i, &head, &i);
- SparseMatrix_coordinate_form_add_entries(*polys, 1, &i, &tail, &i);
+ SparseMatrix_coordinate_form_add_entries(*polys, &i, &head, &i);
+ SparseMatrix_coordinate_form_add_entries(*polys, &i, &tail, &i);
/* unset edge_map */
for (j = i+1; j < nz2; j++){
u2 = irn[j]; v2 = jcn[j];
if (splines_intersect(dim, u1, v1, u2, v2, cos_critical, check_edges_with_same_endpoint, xsplines[i], xsplines[j])){
- B = SparseMatrix_coordinate_form_add_entries(B, 1, &i, &j, &cos_a);
+ B = SparseMatrix_coordinate_form_add_entries(B, &i, &j, &cos_a);
}
}
}
cos_a = intersection_angle(&(x[dim*u1]), &(x[dim*v1]), &(x[dim*u2]), &(x[dim*v2]));
if (!check_edges_with_same_endpoint && cos_a >= -1) cos_a = fabs(cos_a);
if (cos_a > cos_critical) {
- B = SparseMatrix_coordinate_form_add_entries(B, 1, &i, &j, &cos_a);
+ B = SparseMatrix_coordinate_form_add_entries(B, &i, &j, &cos_a);
}
}
}
R1 = SparseMatrix_new(nc, n, 1, MATRIX_TYPE_REAL, FORMAT_COORD);
for (i = 0; i < n; i++){
jj = matching[i];
- SparseMatrix_coordinate_form_add_entries(R1, 1, &jj, &i, &one);
+ SparseMatrix_coordinate_form_add_entries(R1, &jj, &i, &one);
}
R = SparseMatrix_from_coordinate_format(R1);
SparseMatrix_delete(R1);
for (i = 0; i < ne; i++){
jj = assignment[i];
- SparseMatrix_coordinate_form_add_entries(C, 1, &jj, &i, NULL);
+ SparseMatrix_coordinate_form_add_entries(C, &jj, &i, NULL);
}
D = SparseMatrix_from_coordinate_format(C);
}
if (fabs(dist) > tol){
- B = SparseMatrix_coordinate_form_add_entries(B, 1, &i, &jj, &dist);
- B = SparseMatrix_coordinate_form_add_entries(B, 1, &jj, &i, &dist);
+ B = SparseMatrix_coordinate_form_add_entries(B, &i, &jj, &dist);
+ B = SparseMatrix_coordinate_form_add_entries(B, &jj, &i, &dist);
}
}
}
for (i = 0; i < numberofedges; i++) {
ii = edgelist[i * 2];
jj = edgelist[i * 2 + 1];
- SparseMatrix_coordinate_form_add_entries(A, 1, &(ii), &(jj), &one);
+ SparseMatrix_coordinate_form_add_entries(A, &(ii), &(jj), &one);
}
if (n == 2) { /* if two points, add edge i->j */
ii = 0;
jj = 1;
- SparseMatrix_coordinate_form_add_entries(A, 1, &(ii), &(jj), &one);
+ SparseMatrix_coordinate_form_add_entries(A, &(ii), &(jj), &one);
}
for (i = 0; i < n; i++) {
- SparseMatrix_coordinate_form_add_entries(A, 1, &i, &i, &one);
+ SparseMatrix_coordinate_form_add_entries(A, &i, &i, &one);
}
B = SparseMatrix_from_coordinate_format(A);
SparseMatrix_delete(A);
for (i = 0; i < n; i++) {
for (j = 1; j < delaunay[i].nedges; j++) {
- SparseMatrix_coordinate_form_add_entries(A, 1, &i,
+ SparseMatrix_coordinate_form_add_entries(A, &i,
&(delaunay[i].
edges[j]), &one);
}
}
for (i = 0; i < n; i++) {
- SparseMatrix_coordinate_form_add_entries(A, 1, &i, &i, &one);
+ SparseMatrix_coordinate_form_add_entries(A, &i, &i, &one);
}
B = SparseMatrix_from_coordinate_format(A);
B = SparseMatrix_symmetrize(B, false);
#endif
if (neighbor != k){
if (fabs(0.5*(bsta+bsto) - 0.5*(bbsta+bbsto)) < 0.5*(bsto-bsta) + 0.5*(bbsto-bbsta)){/* if the distance of the centers of the interval is less than sum of width, we have overlap */
- A = SparseMatrix_coordinate_form_add_entries(A, 1, &neighbor, &k, &one);
+ A = SparseMatrix_coordinate_form_add_entries(A, &neighbor, &k, &one);
#ifdef DEBUG_RBTREE
fprintf(stderr,"====================================== %d %d\n",k,neighbor);
#endif
return A;
}
-SparseMatrix SparseMatrix_coordinate_form_add_entries(SparseMatrix A, int nentries, int *irn, int *jcn, void *val){
- int nz, nzmax, i;
+SparseMatrix SparseMatrix_coordinate_form_add_entries(SparseMatrix A, int *irn,
+ int *jcn, void *val) {
+ int nz, nzmax;
+
+ static const int nentries = 1;
assert(A->format == FORMAT_COORD);
- if (nentries <= 0) return A;
nz = A->nz;
if (nz + nentries >= A->nzmax){
memcpy((char*) A->ia + ((size_t)nz)*sizeof(int)/sizeof(char), irn, sizeof(int)*((size_t)nentries));
memcpy((char*) A->ja + ((size_t)nz)*sizeof(int)/sizeof(char), jcn, sizeof(int)*((size_t)nentries));
if (A->size) memcpy((char*) A->a + ((size_t)nz)*A->size/sizeof(char), val, A->size*((size_t)nentries));
- for (i = 0; i < nentries; i++) {
- if (irn[i] >= A->m) A->m = irn[i]+1;
- if (jcn[i] >= A->n) A->n = jcn[i]+1;
- }
+ if (irn[0] >= A->m) A->m = irn[0] + 1;
+ if (jcn[0] >= A->n) A->n = jcn[0] + 1;
A->nz += nentries;
return A;
}
for (i = 0; i < nlevel; i++) {
for (j = levelset_ptr[i]; j < levelset_ptr[i+1]; j++){
itmp = levelset[j]; dtmp = i;
- if (k != itmp) B = SparseMatrix_coordinate_form_add_entries(B, 1, &k, &itmp, &dtmp);
+ if (k != itmp) B = SparseMatrix_coordinate_form_add_entries(B, &k, &itmp, &dtmp);
}
}
}
}
for (j = 0; j < nlist; j++){
itmp = list[j]; dtmp = dist[itmp];
- if (k != itmp) B = SparseMatrix_coordinate_form_add_entries(B, 1, &k, &itmp, &dtmp);
+ if (k != itmp) B = SparseMatrix_coordinate_form_add_entries(B, &k, &itmp, &dtmp);
}
}
}
enum {SUM_REPEATED_NONE = 0, SUM_REPEATED_ALL, };
SparseMatrix SparseMatrix_sum_repeat_entries(SparseMatrix A, int what_to_sum);
-SparseMatrix SparseMatrix_coordinate_form_add_entries(SparseMatrix A, int nentries, int *irn, int *jcn, void *val);
+SparseMatrix SparseMatrix_coordinate_form_add_entries(SparseMatrix A, int *irn,
+ int *jcn, void *val);
int SparseMatrix_is_symmetric(SparseMatrix A, bool test_pattern_symmetry_only);
SparseMatrix SparseMatrix_transpose(SparseMatrix A);
SparseMatrix SparseMatrix_symmetrize(SparseMatrix A,
R0 = SparseMatrix_new(nc, n, 1, MATRIX_TYPE_REAL, FORMAT_COORD);
for (i = 0; i < n; i++){
jj = matching[i];
- SparseMatrix_coordinate_form_add_entries(R0, 1, &jj, &i, &one);
+ SparseMatrix_coordinate_form_add_entries(R0, &jj, &i, &one);
}
R = SparseMatrix_from_coordinate_format(R0);
SparseMatrix_delete(R0);
R0 = SparseMatrix_new(nc, n, 1, MATRIX_TYPE_REAL, FORMAT_COORD);
for (i = 0; i < n; i++){
jj = matching[i];
- SparseMatrix_coordinate_form_add_entries(R0, 1, &jj, &i, &one);
+ SparseMatrix_coordinate_form_add_entries(R0, &jj, &i, &one);
}
R = SparseMatrix_from_coordinate_format(R0);
SparseMatrix_delete(R0);