]> granicus.if.org Git - graphviz/commitdiff
remove unused SparseMatrix_delete_sparse_columns
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 31 May 2021 16:48:54 +0000 (09:48 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Jun 2021 18:06:37 +0000 (11:06 -0700)
lib/sparse/SparseMatrix.c
lib/sparse/SparseMatrix.h

index 1346ba0f0d64d5cc657204939b9c68729fa1c821..03deca89b07542f285104ab293e5ca9ff4ef63b3 100644 (file)
@@ -2818,56 +2818,6 @@ SparseMatrix SparseMatrix_get_submatrix(SparseMatrix A, int nrow, int ncol, int
 
 }
 
-SparseMatrix SparseMatrix_delete_sparse_columns(SparseMatrix A, int threshold, int **new2old, int *nnew, int inplace){
-  /* delete sparse columns of threshold or less entries in A. After than number of columns will be nnew, and 
-     the mapping from new matrix column to old matrix column is new2old.
-     On entry, if new2old is NULL, it is allocated.
-  */
-  SparseMatrix B;
-  int *ia, *ja;
-  int *old2new;
-  int i;
-  old2new = MALLOC(sizeof(int)*((size_t)A->n));
-  for (i = 0; i < A->n; i++) old2new[i] = -1;
-
-  *nnew = 0;
-  B = SparseMatrix_transpose(A);
-  ia = B->ia; ja = B->ja;
-  for (i = 0; i < B->m; i++){
-    if (ia[i+1] > ia[i] + threshold){
-      (*nnew)++;
-    }
-  }
-  if (!(*new2old)) *new2old = MALLOC(sizeof(int)*((size_t)(*nnew)));
-
-  *nnew = 0;
-  for (i = 0; i < B->m; i++){
-    if (ia[i+1] > ia[i] + threshold){
-      (*new2old)[*nnew] = i;
-      old2new[i] = *nnew;
-      (*nnew)++;
-    }
-  }
-  SparseMatrix_delete(B);
-
-  if (inplace){
-    B = A;
-  } else {
-    B = SparseMatrix_copy(A);
-  }
-  ia = B->ia; ja = B->ja;
-  for (i = 0; i < ia[B->m]; i++){
-    assert(old2new[ja[i]] >= 0);
-    ja[i] = old2new[ja[i]];
-  }
-  B->n = *nnew;
-
-  FREE(old2new);
-  return B;
-  
-
-}
-
 SparseMatrix SparseMatrix_set_entries_to_real_one(SparseMatrix A){
   real *a;
   int i;
index cea1151d448e4073d5aea4b38838271bf7b2df43..24aa9817a8115fd9c81937417f928f1266b6a13a 100644 (file)
@@ -106,9 +106,6 @@ SparseMatrix SparseMatrix_get_augmented(SparseMatrix A);
 */
 SparseMatrix SparseMatrix_to_square_matrix(SparseMatrix A, int bipartite_options);
 
-/* columns with <= threhold entries are deleted */
-SparseMatrix SparseMatrix_delete_sparse_columns(SparseMatrix A, int threshold, int **new2old, int *nnew, int inplace);
-
 SparseMatrix SparseMatrix_sort(SparseMatrix A);
 
 SparseMatrix SparseMatrix_set_entries_to_real_one(SparseMatrix A);