1 #include	"BSprivate.h"
2 
3 /*+ BSrem_diag - Remove the diagonal entries from the sparse matrix
4 
5     Input Parameters:
6 .   A - the sparse matrix
7 
8     Output Parameters:
9 .   A - the sparse matrix with diagonals hidden
10 
11     Returns:
12     void
13 
14     Notes:
15     The entries are actually hidden at the end.  This routine is
16     necessary to interface to an older coloring algorithm.  The
17     entries are reinserted (moved back) by another BSins_diag.
18  +*/
BSrem_diag(BSspmat * A)19 void	BSrem_diag(BSspmat *A)
20 {
21 	int	i, j;
22 	int	ival;
23 	BSsprow *row;
24 
25 	for (i=0;i<A->num_rows;i++) {
26 		row = A->rows[i];
27 		row->length--;
28 		ival = row->col[row->diag_ind];
29 		for (j=row->diag_ind;j<row->length;j++) {
30 			row->col[j] = row->col[j+1];
31 		}
32 		row->diag_ind = -row->diag_ind;
33 		row->col[row->length] = ival;
34 	}
35 }
36