From: Matthew Fernandez Date: Thu, 1 Jul 2021 02:04:49 +0000 (-0700) Subject: remove SUM_REPEATED_IMAGINARY_PART option X-Git-Tag: 2.48.0~11^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=557edea280ccd4e63ba38f0e58c4e6136a7fb7e9;p=graphviz remove SUM_REPEATED_IMAGINARY_PART option This is a configuration option to SparseMatrix_from_coordinate_arrays_not_compacted that is never used. --- diff --git a/lib/sparse/SparseMatrix.c b/lib/sparse/SparseMatrix.c index 97411775f..e1c700b7e 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -1587,8 +1587,8 @@ SparseMatrix SparseMatrix_multiply3(SparseMatrix A, SparseMatrix B, SparseMatrix but unfortunately I do not have such object implemented yet. - For other matrix, what_to_sum = SUM_REPEATED_REAL_PART is the same as what_to_sum = SUM_REPEATED_IMAGINARY_PART - or what_to_sum = SUM_REPEATED_ALL. In this implementation we assume that + For other matrix, what_to_sum = SUM_REPEATED_REAL_PART is the same as + what_to_sum = SUM_REPEATED_ALL. In this implementation we assume that the {j,y} pairs are dense, so we usea 2D array for hashing */ SparseMatrix SparseMatrix_sum_repeat_entries(SparseMatrix A, int what_to_sum){ @@ -1681,41 +1681,6 @@ SparseMatrix SparseMatrix_sum_repeat_entries(SparseMatrix A, int what_to_sum){ ia[i+1] = nz; } - } else if (what_to_sum == SUM_REPEATED_IMAGINARY_PART){ - int xmin, xmax, id; - xmax = xmin = a[1]; - nz = 0; - for (i = 0; i < A->m; i++){ - for (j = ia[i]; j < ia[i+1]; j++){ - xmax = MAX(xmax, (int) a[2*nz]); - xmin = MAX(xmin, (int) a[2*nz]); - nz++; - } - } - FREE(mask); - mask = MALLOC(sizeof(int)*((size_t)n)*((size_t)(xmax-xmin+1))); - for (i = 0; i < n*(xmax-xmin+1); i++) mask[i] = -1; - - nz = 0; - sta = ia[0]; - for (i = 0; i < A->m; i++){ - for (j = sta; j < ia[i+1]; j++){ - id = ja[j] + ((int)a[2*j] - xmin)*n; - if (mask[id] < ia[i]){ - ja[nz] = ja[j]; - a[2*nz] = a[2*j]; - a[2*nz+1] = a[2*j+1]; - mask[id] = nz++; - } else { - assert(ja[mask[id]] == ja[j]); - a[2*mask[id]] = a[2*j]; - a[2*mask[id]+1] += a[2*j+1]; - } - } - sta = ia[i+1]; - ia[i+1] = nz; - } - } } break; diff --git a/lib/sparse/SparseMatrix.h b/lib/sparse/SparseMatrix.h index 79d269757..7976010ab 100644 --- a/lib/sparse/SparseMatrix.h +++ b/lib/sparse/SparseMatrix.h @@ -63,11 +63,10 @@ SparseMatrix SparseMatrix_multiply3(SparseMatrix A, SparseMatrix B, SparseMatrix /* For complex matrix: if what_to_sum = SUM_REPEATED_REAL_PART, we find entries {i,j,x + i y} and sum the x's if {i,j,Round(y)} are the same - if what_to_sum = SUM_REPEATED_IMAGINARY_PART, we find entries {i,j,x + i y} and sum the y's if {i,j,Round(x)} are the same - For other matrix, what_to_sum = SUM_REPEATED_REAL_PART is the same as what_to_sum = SUM_REPEATED_IMAGINARY_PART - or what_to_sum = SUM_REPEATED_ALL + For other matrix, what_to_sum = SUM_REPEATED_REAL_PART is the same as + what_to_sum = SUM_REPEATED_ALL */ -enum {SUM_REPEATED_NONE = 0, SUM_REPEATED_ALL, SUM_REPEATED_REAL_PART, SUM_REPEATED_IMAGINARY_PART, }; +enum {SUM_REPEATED_NONE = 0, SUM_REPEATED_ALL, SUM_REPEATED_REAL_PART, }; 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); int SparseMatrix_is_symmetric(SparseMatrix A, int test_pattern_symmetry_only);