start = clock();
assert(A->m == A->n);
- A2 = SparseMatrix_symmetrize(A, TRUE);
+ A2 = SparseMatrix_symmetrize(A, true);
ia = A2->ia; ja = A2->ja;
/* Laplacian */
int iter_max = 100;
{double *dist = NULL;
- A = SparseMatrix_symmetrize(A0, FALSE);
+ A = SparseMatrix_symmetrize(A0, false);
SparseMatrix_distance_matrix(A, 0, &dist);
SparseMatrix_delete(A);
A = SparseMatrix_from_dense(n, n, dist);
int *ia = graph->ia, *ja = graph->ja, nz = 0, jj;
int KB;
- graph = SparseMatrix_symmetrize(graph, TRUE);
+ graph = SparseMatrix_symmetrize(graph, true);
ia = graph->ia; ja = graph->ja;
dist=avgdist = 0.;
for (i = 0; i < n; i++){
return 1;
}
- A = SparseMatrix_symmetrize(A, TRUE);
+ A = SparseMatrix_symmetrize(A, true);
if (opts->fmt == FMT_GV) {
PointMap* pm = newPM(); /* map from node id pairs to edge index */
Agnode_t* n;
}
ctmp = MALLOC(sizeof(double)*cdim*n);
- B = SparseMatrix_symmetrize(A, FALSE);
+ B = SparseMatrix_symmetrize(A, false);
A = B;
SparseMatrix_weakly_connected_components(A, &ncomps, &comps, &comps_ptr);
edges[i] = pedge_new(2, dim, &x[dim*2*i]);
}
- A = SparseMatrix_symmetrize(A0, TRUE);
+ A = SparseMatrix_symmetrize(A0, true);
#include <common/memory.h>
#include <neatogen/delaunay.h>
#include <stddef.h>
+#include <stdbool.h>
SparseMatrix call_tri(int n, int dim, double * x)
{
}
B = SparseMatrix_from_coordinate_format(A);
SparseMatrix_delete(A);
- A = SparseMatrix_symmetrize(B, FALSE);
+ A = SparseMatrix_symmetrize(B, false);
SparseMatrix_delete(B);
B = A;
SparseMatrix_coordinate_form_add_entries(A, 1, &i, &i, &one);
}
B = SparseMatrix_from_coordinate_format(A);
- B = SparseMatrix_symmetrize(B, FALSE);
+ B = SparseMatrix_symmetrize(B, false);
SparseMatrix_delete(A);
free (x);
B = SparseMatrix_from_coordinate_format(A);
SparseMatrix_delete(A);
- A = SparseMatrix_symmetrize(B, FALSE);
+ A = SparseMatrix_symmetrize(B, false);
SparseMatrix_delete(B);
if (Verbose) fprintf(stderr, "found %d clashes\n", A->nz);
return A;
goto RETURN;
}
assert(A->format == FORMAT_CSR);
- A = SparseMatrix_symmetrize(A, TRUE);
+ A = SparseMatrix_symmetrize(A, true);
ia = A->ia;
ja = A->ja;
goto RETURN;
}
assert(A->format == FORMAT_CSR);
- A = SparseMatrix_symmetrize(A, TRUE);
+ A = SparseMatrix_symmetrize(A, true);
ia = A->ia;
ja = A->ja;
goto RETURN;
}
assert(A->format == FORMAT_CSR);
- A = SparseMatrix_symmetrize(A, TRUE);
+ A = SparseMatrix_symmetrize(A, true);
ia = A->ia;
ja = A->ja;
assert(A->format == FORMAT_CSR);
- A = SparseMatrix_symmetrize(A, TRUE);
+ A = SparseMatrix_symmetrize(A, true);
ia = A->ia;
ja = A->ja;
if (D){
goto RETURN;
}
assert(A->format == FORMAT_CSR);
- A = SparseMatrix_symmetrize(A, TRUE);
+ A = SparseMatrix_symmetrize(A, true);
ia = A->ia;
ja = A->ja;
id = D->ia;
if (!SparseMatrix_is_symmetric(A, false) || A->type != MATRIX_TYPE_REAL){
if (A->type == MATRIX_TYPE_REAL){
- A = SparseMatrix_symmetrize(A, FALSE);
+ A = SparseMatrix_symmetrize(A, false);
A = SparseMatrix_remove_diagonal(A);
} else {
A = SparseMatrix_get_real_adjacency_matrix_symmetrized(A);
int i;
if (A->type == MATRIX_TYPE_REAL){
- B = SparseMatrix_symmetrize(A, FALSE);
+ B = SparseMatrix_symmetrize(A, false);
} else {
B = SparseMatrix_get_real_adjacency_matrix_symmetrized(A);
}
SparseMatrix SparseMatrix_make_undirected(SparseMatrix A){
/* make it strictly low diag only, and set flag to undirected */
SparseMatrix B;
- B = SparseMatrix_symmetrize(A, FALSE);
+ B = SparseMatrix_symmetrize(A, false);
SparseMatrix_set_undirected(B);
return SparseMatrix_remove_upper(B);
}
return B;
}
-SparseMatrix SparseMatrix_symmetrize(SparseMatrix A, int pattern_symmetric_only){
+SparseMatrix SparseMatrix_symmetrize(SparseMatrix A,
+ bool pattern_symmetric_only) {
SparseMatrix B;
- if (SparseMatrix_is_symmetric(A, pattern_symmetric_only != 0)) return SparseMatrix_copy(A);
+ if (SparseMatrix_is_symmetric(A, pattern_symmetric_only)) return SparseMatrix_copy(A);
B = SparseMatrix_transpose(A);
if (!B) return NULL;
A = SparseMatrix_add(A, B);
memcpy(B->ja, ja, sizeof(int)*((size_t)nz));
B->nz = A->nz;
- A = SparseMatrix_symmetrize(B, TRUE);
+ A = SparseMatrix_symmetrize(B, true);
SparseMatrix_delete(B);
A = SparseMatrix_remove_diagonal(A);
A->a = MALLOC(sizeof(double)*((size_t)(A->nz)));
int m = A->m, i, nn;
if (!SparseMatrix_is_symmetric(A, true)){
- A = SparseMatrix_symmetrize(A, TRUE);
+ A = SparseMatrix_symmetrize(A, true);
}
if (!(*comps_ptr)) *comps_ptr = MALLOC(sizeof(int)*((size_t)(m+1)));
double dmax;
if (!SparseMatrix_is_symmetric(D, false)){
- D = SparseMatrix_symmetrize(D, FALSE);
+ D = SparseMatrix_symmetrize(D, false);
}
assert(m == n);
double dmax, dtmp;
if (!SparseMatrix_is_symmetric(D, false)){
- D = SparseMatrix_symmetrize(D, FALSE);
+ D = SparseMatrix_symmetrize(D, false);
}
assert(m == n);
.
may be there is a better way to ensure symmetric, but for now we just symmetrize it
*/
- D = SparseMatrix_symmetrize(C, FALSE);
+ D = SparseMatrix_symmetrize(C, false);
SparseMatrix_delete(C);
return D;
SparseMatrix SparseMatrix_coordinate_form_add_entries(SparseMatrix A, int nentries, 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, int pattern_symmetric_only);
+SparseMatrix SparseMatrix_symmetrize(SparseMatrix A,
+ bool pattern_symmetric_only);
SparseMatrix SparseMatrix_symmetrize_nodiag(SparseMatrix A);
void SparseMatrix_multiply_vector(SparseMatrix A, double *v, double **res, int transposed);/* if v = NULL, v is assumed to be {1,1,...,1}*/
SparseMatrix SparseMatrix_remove_diagonal(SparseMatrix A);
assert(A->m == A->n);
- B = SparseMatrix_symmetrize(A, FALSE);
+ B = SparseMatrix_symmetrize(A, false);
if (!inplace && B == A) {
B = SparseMatrix_copy(A);
assert(A->m == A->n);
- B = SparseMatrix_symmetrize(A, FALSE);
+ B = SparseMatrix_symmetrize(A, false);
if (!inplace && B == A) {
B = SparseMatrix_copy(A);