44 MALLOC_INTERN( csr->nnz, n, pastix_int_t );
45 MALLOC_INTERN( csr->rows, n, pastix_int_t * );
47 memset( csr->nnz, 0, n *
sizeof( pastix_int_t ) );
48 memset( csr->rows, 0, n *
sizeof( pastix_int_t * ) );
68 for ( i = 0; i < csr->n; i++ ) {
69 if ( csr->nnz[i] != 0 ) {
70 memFree_null( csr->rows[i] );
73 memFree_null( csr->rows );
74 memFree_null( csr->nnz );
103 for ( i = 0; i < csr->n; i++ ) {
131 pastix_int_t n = csr->n;
135 for ( i = 0, j = 0; i < n; i++, j++ ) {
136 if ( csr->nnz[i] == 0 )
141 for ( ; i < n; i++ ) {
142 if ( csr->nnz[i] > 0 ) {
144 csr->nnz[j] = csr->nnz[i];
145 csr->rows[j] = csr->rows[i];
185 pastix_int_t *rowsPA, *rowsA;
186 pastix_int_t i, j, ip;
187 pastix_int_t baseval;
188 pastix_int_t n = graphPA->n = graphA->n;
190 baseval = graphA->colptr[0];
195 for ( i = 0; i < n; i++ ) {
198 graphPA->nnz[ip] = graphA->colptr[i + 1] - graphA->colptr[i] + 1;
202 for ( i = 0; i < n; i++ ) {
203 ip = perm[i] - baseval;
205 MALLOC_INTERN( graphPA->rows[ip], graphPA->nnz[ip], pastix_int_t );
207 rowsPA = graphPA->rows[ip];
208 rowsA = graphA->rowptr + graphA->colptr[i] - baseval;
214 for ( j = 1; j < graphPA->nnz[ip]; j++, rowsPA++ ) {
215 *rowsPA = perm[*rowsA];
219 intSort1asc1( graphPA->rows[ip], graphPA->nnz[ip] );
254 pastix_int_t i, j, k, nnznbr;
255 const pastix_int_t cblknbr = order->cblknbr;
256 const pastix_int_t *rangtab = order->rangtab;
258 pastix_int_t *tmp, *tmp1, *tmp2;
260 MALLOC_INTERN( work2, graphA->n, pastix_int_t );
264 assert( order->baseval == 0 );
272 for ( k = 0; k < cblknbr; k++ ) {
275 for ( i = rangtab[k]; i < rangtab[k + 1]; i++ ) {
280 for ( i = rangtab[k]; i < rangtab[k + 1]; i++ ) {
284 while ( ( j < graphA->nnz[i] ) && ( graphA->rows[i][j] <= i ) ) {
290 pastix_intset_union( nnznbr, tmp1, graphA->nnz[i] - j, graphA->rows[i] + j, tmp2 );
298 #if !defined( NDEBUG ) && defined( PASTIX_DEBUG_SYMBOL )
303 assert( nnznbr >= ( rangtab[k + 1] - rangtab[k] ) );
304 for ( j = rangtab[k]; j < rangtab[k + 1]; j++ ) {
305 assert( tmp1[ind] == j );
308 assert( nnznbr > 0 );
313 graphL->nnz[k] = nnznbr;
314 MALLOC_INTERN( graphL->rows[k], nnznbr, pastix_int_t );
315 memcpy( graphL->rows[k], tmp1,
sizeof( pastix_int_t ) * nnznbr );
BEGIN_C_DECLS struct pastix_order_s pastix_order_t
Order structure.
int faxCSRGenPA(const pastix_graph_t *graphA, const pastix_int_t *perm, fax_csr_t *graphPA)
Generate the graph of P*A from the graph of A and the permutation vector.
pastix_int_t faxCSRGetNNZ(const fax_csr_t *csr)
Computes the number of non zero entries in the graph.
void faxCSRClean(fax_csr_t *csr)
Free the data store in the structure.
void faxCSRCblkCompress(const fax_csr_t *graphA, const pastix_order_t *order, fax_csr_t *graphL, pastix_int_t *work)
Compact a element wise graph of a matrix A, according to the associated partition.
void faxCSRCompact(fax_csr_t *csr)
Compact a compressed graph.
void faxCSRInit(pastix_int_t n, fax_csr_t *csr)
Initialize the data structure by doing the first allocations within the structure and initializing th...
Fax blocked csr structure.