]> granicus.if.org Git - graphviz/commitdiff
remove SUM_REPEATED_REAL_PART option
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 1 Jul 2021 02:07:35 +0000 (19:07 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 7 Jul 2021 14:30:16 +0000 (07:30 -0700)
This is a configuration option to
SparseMatrix_from_coordinate_arrays_not_compacted that is never used. The
leading comment that is also removed in this commit seems to have been a
mistake. If refers to incorrect constants, repeats variables, and contains
numerous typographical errors.

lib/sparse/SparseMatrix.c
lib/sparse/SparseMatrix.h

index e1c700b7e7fe5c81454c634c2d627d8c7be4c7fa..6c27563591af55fc928ed2640cb9a85a6e83eecb 100644 (file)
@@ -1574,23 +1574,6 @@ 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_REAL_PART, we find entries {i,j,x + i y} and sum the y's if {i,j,Round(x)} are the same
-   so a matrix like {{1,1,2+3i},{1,2,3+4i},{1,1,5+3i},{1,2,4+5i},{1,2,4+4i}} becomes
-   {{1,1,2+5+3i},{1,2,3+4+4i},{1,2,4+5i}}. 
-
-   Really this kind of thing is best handled using a 3D sparse matrix like
-   {{{1,1,3},2},{{1,2,4},3},{{1,1,3},5},{{1,2,4},4}}, 
-   which is then aggreted into
-   {{{1,1,3},2+5},{{1,2,4},3+4},{{1,1,3},5}}
-   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_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){
   /* sum repeated entries in the same row, i.e., {1,1}->1, {1,1}->2 becomes {1,1}->3 */
   int *ia = A->ia, *ja = A->ja, type = A->type, n = A->n;
@@ -1645,42 +1628,6 @@ SparseMatrix SparseMatrix_sum_repeat_entries(SparseMatrix A, int what_to_sum){
          sta = ia[i+1];
          ia[i+1] = nz;
        }
-      } else if (what_to_sum == SUM_REPEATED_REAL_PART){
-       int ymin, ymax, id;
-       ymax = ymin = a[1];
-       nz = 0;
-       for (i = 0; i < A->m; i++){
-         for (j = ia[i]; j < ia[i+1]; j++){
-           ymax = MAX(ymax, (int) a[2*nz+1]);
-           ymin = MIN(ymin, (int) a[2*nz+1]);
-           nz++;
-         }       
-       }
-       FREE(mask);
-       mask = MALLOC(sizeof(int)*((size_t)n)*((size_t)(ymax-ymin+1)));
-       for (i = 0; i < n*(ymax-ymin+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+1] - ymin)*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(id < n*(ymax-ymin+1));
-             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;
index 7976010ab3f855a48f357e4b018293d54e063c36..09da0d08e16a05219619b828bc4ff3d0fe30bfad 100644 (file)
@@ -61,12 +61,7 @@ SparseMatrix SparseMatrix_add(SparseMatrix A, SparseMatrix B);
 SparseMatrix SparseMatrix_multiply(SparseMatrix A, SparseMatrix B);
 SparseMatrix SparseMatrix_multiply3(SparseMatrix A, SparseMatrix B, SparseMatrix C);
 
-/* 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
-   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, };
+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);
 int SparseMatrix_is_symmetric(SparseMatrix A, int test_pattern_symmetry_only);