/*******************************************************************/ /*** FILE : ReduceMatrix.c ***/ /*** AUTHOR: David P Jacobs ***/ /*** PROGRAMMER: Sekhar Muddana ***/ /*** DATE WRITTEN: May 1990. ***/ /*** MODIFIED: David Lee (Aug 1992). ***/ /*** - Added code to gather statistics. ***/ /*** PUBLIC ROUTINES: ***/ /*** int ReduceMatrix() ***/ /*** PRIVATE ROUTINES: ***/ /*** MODULE DESCRIPTION: ***/ /*******************************************************************/ #include #include "Build_defs.h" #include "CreateMatrix.h" #define assert_not_null(p) if (p == NULL) return(0) /********************* These are for density measurement on last matrix. *********************/ extern short int gather_density_flag; extern long unsigned int num_elements; extern long unsigned int max_num_elements; static Matrix TheMatrix; static int Num_rows; static int Num_cols; int ReduceTheMatrix(Mptr,Rows,Cols,Rank) Matrix Mptr; int Rows; int Cols; int *Rank; { int i,j; int nextstairrow = 0; /* next row with stair step 1 */ Scalar S_zero(); TheMatrix = Mptr; Num_rows = Rows; Num_cols = Cols; if ((Rows == 0) || (Cols == 0)) return(OK); assert_not_null(Mptr); for (i=0;i max_num_elements) { max_num_elements=num_elements; } } if ((before!=S_zero()) && (after == S_zero())) num_elements--; } } } /* int GetRank() { Scalar S_zero(); int i,j; int rank = 0; for (i=0;i