1 #include "BSprivate.h" 2 3 /*+ BSrow_perm - Build a list that can access the rows of A in a permuted order 4 5 Input Parameters: 6 . A - a sparse matrix 7 . iperm - the permutation 8 9 Returns: 10 a structure that can access the rows of A in permuted order 11 12 +*/ BSrow_perm(BSspmat * A,BSpermutation * iperm)13BSsprow **BSrow_perm(BSspmat *A, BSpermutation *iperm) 14 { 15 int i; 16 BSsprow **t_rows; 17 18 /* build a temporary row list that is permuted by gnum */ 19 MY_MALLOCN(t_rows,(BSsprow **),sizeof(BSsprow *)*A->num_rows,1); 20 for (i=0;i<A->num_rows;i++) { 21 t_rows[i] = A->rows[iperm->perm[i]]; 22 } 23 24 return(t_rows); 25 } 26