SpM Handbook 1.2.4
Loading...
Searching...
No Matches
c_spm_convert_to_csc.c
Go to the documentation of this file.
1/**
2 *
3 * @file c_spm_convert_to_csc.c
4 *
5 * SParse Matrix package conversion routines.
6 *
7 * @copyright 2016-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8 * Univ. Bordeaux. All rights reserved.
9 *
10 * @version 1.2.4
11 * @author Mathieu Faverge
12 * @author Matias Hastaran
13 * @author Tony Delarue
14 * @author Alycia Lisito
15 * @date 2024-06-25
16 *
17 * @generated from /builds/2mk6rsew/0/fpruvost/spm/src/z_spm_convert_to_csc.c, normal z -> c, Fri Nov 29 11:34:28 2024
18 *
19 **/
20#include "common.h"
21
22#if defined(SPM_WITH_MPI)
23/**
24 *******************************************************************************
25 *
26 * @brief Convert a matrix in IJV format to a matrix in CSC format for a
27 * distributed variadic multidof spm without a sorted distribution.
28 *
29 *******************************************************************************
30 *
31 * @param[inout] spm
32 * The matrix to convert in CSC format.
33 *
34 * @param[in] oldrow
35 * Pointer to the old rowptr in IJV format.
36 *
37 * @param[in] oldval
38 * Pointer to the old sorted values ptr.
39 *
40 * @param[in] l2g_sorted
41 * Represents the corresponding sorted distribution of the spm.
42 *
43 *******************************************************************************/
44static inline void
45c_spm_dijv2csc_vdof( spmatrix_t *spm,
46 const spm_int_t *oldrowptr,
47 const spm_complex32_t *oldval,
48 const spm_int_t *l2g_sorted )
49{
50 const spm_int_t *glob2loc;
51 const spm_int_t *newcol;
52 const spm_int_t *oldrow;
53 spm_int_t *newrow;
54 spm_int_t k, j, jl, jg, baseval;
55 size_t size;
56#if !defined(PRECISION_p)
57 spm_complex32_t *newval;
58 spm_int_t *dofshift = NULL;
59#else
60 (void)oldval;
61#endif
62 baseval = spm->baseval;
63 glob2loc = spm->glob2loc;
64 newcol = spm->colptr;
65 newrow = spm->rowptr;
66 oldrow = oldrowptr;
67 size = 0;
68
69 /*
70 * Copy the datas from the sorted rowptr to
71 * its unsorted distribution counterpart
72 */
73 for ( j = 0; j < spm->n; j++, oldrow+=size )
74 {
75 jg = l2g_sorted[j] - baseval;
76 jl = glob2loc[jg];
77 k = newcol[jl] - baseval;
78 size = newcol[jl+1] - newcol[jl];
79 memcpy( newrow + k, oldrow, size * sizeof(spm_int_t) );
80 }
81 assert( (oldrow - oldrowptr) == spm->nnz );
82
83#if !defined(PRECISION_p)
84 /*
85 * Copy the datas from the sorted values to
86 * its unsorted distribution counterpart
87 */
88 oldrow = oldrowptr;
89 newval = spm->values;
90
91 /* Get the values shift for the new spm */
92 dofshift = spm_get_value_idx_by_col( spm );
93 for ( j = 0; j < spm->n; j++ )
94 {
95 jg = l2g_sorted[j] - baseval;
96 jl = glob2loc[jg];
97 size = dofshift[jl+1] - dofshift[jl];
98
99#if !defined(NDEBUG)
100 /* Check that we compute the same size as in spm_value_idx_by_col() */
101 {
102 const spm_int_t *dofs = spm->dofs;
103 spm_int_t ig, dofi, dofj;
104
105 dofj = dofs[jg+1] - dofs[jg];
106
107 dofi = 0;
108 for( k = newcol[jl]; k < newcol[jl+1]; k++, oldrow++ )
109 {
110 ig = *oldrow - baseval;
111 dofi += dofs[ig+1] - dofs[ig];
112 }
113
114 /* Get the position and size of the column */
115 assert( (size_t)(dofi * dofj) == size );
116 }
117#endif
118
119 memcpy( newval + dofshift[jl], oldval, size * sizeof(spm_complex32_t) );
120 oldval += size;
121 }
122 assert( (oldrow - oldrowptr) == spm->nnz );
123
124 free( dofshift );
125#endif
126}
127
128/**
129 *******************************************************************************
130 *
131 * @brief convert a matrix in IJV format to a matrix in CSC
132 * format for a distributed constant multidof spm without a sorted distribution.
133 *
134 *******************************************************************************
135 *
136 * @param[inout] spm
137 * The matrix to convert in CSC format.
138 *
139 * @param[inout] oldcol
140 * Pointer to the old IJV colptr. Will store the new rowptr.
141 *
142 * @param[in] l2g_sorted
143 * Represents the corresponding sorted distribution of the spm.
144 *
145 *******************************************************************************/
146static inline void
147c_spm_dijv2csc_cdof( spmatrix_t *spm,
148 const spm_int_t *oldrowptr,
149 const spm_complex32_t *oldval,
150 const spm_int_t *l2g_sorted )
151{
152 const spm_int_t *glob2loc;
153 const spm_int_t *newcol;
154 const spm_int_t *oldrow;
155 spm_int_t *newrow;
156 spm_int_t k, j, jl, jg, baseval;
157 size_t size;
158#if !defined(PRECISION_p)
159 spm_complex32_t *newval;
160 spm_int_t dof2;
161
162 newval = spm->values;
163 dof2 = spm->dof * spm->dof;
164#else
165 (void)oldval;
166#endif
167 baseval = spm->baseval;
168 glob2loc = spm->glob2loc;
169 newcol = spm->colptr;
170 newrow = spm->rowptr;
171 oldrow = oldrowptr;
172 size = 0;
173
174 /*
175 * Copy the datas from the sorted rowptr (and values) to
176 * its unsorted distribution counterpart
177 */
178 for ( j = 0; j < spm->n; j++, oldrow+=size )
179 {
180 jg = l2g_sorted[j] - baseval;
181 jl = glob2loc[jg];
182 k = newcol[jl] - baseval;
183 size = newcol[jl+1] - newcol[jl];
184 memcpy( newrow + k, oldrow, size * sizeof(spm_int_t) );
185
186#if !defined(PRECISION_p)
187 memcpy( newval + k * dof2, oldval,
188 size * dof2 * sizeof(spm_complex32_t) );
189 oldval += size * dof2;
190#endif
191 }
192 assert( (oldrow - oldrowptr) == spm->nnz );
193}
194
195/**
196 *******************************************************************************
197 *
198 * @brief convert a matrix in IJV format to a matrix in CSC
199 * format for a distributed spm.
200 *
201 *******************************************************************************
202 *
203 * @param[inout] spm
204 * The matrix to convert in CSC format.
205 *
206 *******************************************************************************
207 *
208 * @retval SPM_SUCCESS on success
209 * @retval SPM_ERR_NOTIMPLEMENTED on non supported cases
210 *
211 *******************************************************************************/
212static inline int
213c_spm_dijv2csc( spmatrix_t *spm )
214{
215 spm_int_t *newcol, *oldcol;
216 spm_int_t *glob2loc, *l2g_sorted;
217 spm_int_t k, j, jg, baseval;
218 int is_sorted;
219 int distribution;
220
221 assert( !spm->replicated );
222
223 /* Allocate and compute the glob2loc array */
224 glob2loc = spm_getandset_glob2loc( spm );
225
226 distribution = spm_get_distribution( spm );
227 if ( !(distribution & SpmDistByColumn) ) {
228 fprintf( stderr, "spmConvert: Conversion of non column distributed matrices to CSC is not yet implemented\n");
230 }
231 baseval = spm->baseval;
232
233 /* Allocate and compute the new colptr */
234 newcol = (spm_int_t *) calloc(spm->n+1,sizeof(spm_int_t));
235
236 /* Store a sorted version of the loc2glob */
237 l2g_sorted = (spm_int_t *) malloc(spm->n * sizeof(spm_int_t));
238 memcpy( l2g_sorted, spm->loc2glob, spm->n * sizeof(spm_int_t) );
239 spmIntSort1Asc1( l2g_sorted, spm->n );
240
241 /* Compute the number of edges per row */
242 oldcol = spm->colptr;
243 {
244 for ( k=0; k<spm->nnz; k++, oldcol++ )
245 {
246 jg = *oldcol - baseval;
247 j = glob2loc[ jg ];
248 assert( j >= 0 );
249 newcol[j]++;
250 }
251 }
252
253 /* Update the colptr */
254 oldcol = spm->colptr;
255 spm->colptr = newcol;
256 {
257 spm_int_t total, tmp;
258 total = baseval;
259 for (j=0; j<(spm->n+1); j++, newcol++)
260 {
261 tmp = *newcol;
262 *newcol = total;
263 total += tmp;
264 }
265 assert( (total-baseval) == spm->nnz );
266 }
267
268 /* Check if the loc2glob is sorted to avoid unecessary computations */
269 {
270 spm_int_t *loc2glob = spm->loc2glob;
271 is_sorted = 1;
272 for ( j=0; j<(spm->n-1); j++, loc2glob++ )
273 {
274 if ( loc2glob[0] > loc2glob[1] ) {
275 is_sorted = 0;
276 break;
277 }
278 }
279 }
280
281 if ( is_sorted ) {
282 /*
283 * There is nothing more to do.
284 * The old colptr can be freed.
285 */
286 free( oldcol );
287 }
288 else {
289 /*
290 * Update the rowptr/values
291 * The old colptr will be will be used to store the new rowptr.
292 * The old rowptr and old values will be freed.
293 */
294 spm_complex32_t *oldval = spm->values;
295 spm_int_t *oldrow = spm->rowptr;
296
297 spm->rowptr = oldcol;
298#if !defined(PRECISION_p)
299 spm->values = malloc( spm->nnzexp * sizeof(spm_complex32_t) );
300#endif
301
302 /*
303 * The spm is already partially in CSC, and we need it to compute the
304 * value indices
305 */
306 spm->fmttype = SpmCSC;
307 if ( spm->dof > 0 ) {
308 c_spm_dijv2csc_cdof( spm, oldrow, oldval, l2g_sorted );
309 }
310 else {
311 c_spm_dijv2csc_vdof( spm, oldrow, oldval, l2g_sorted );
312 }
313
314 free( oldrow );
315 if ( oldval ) {
316 free( oldval );
317 }
318 }
319 spm->fmttype = SpmCSC;
320 free(l2g_sorted);
321
322 return SPM_SUCCESS;
323}
324#endif
325
326/**
327 *******************************************************************************
328 *
329 * @ingroup spm_dev_convert
330 *
331 * @brief convert a matrix in IJV format to a matrix in CSC
332 * format.
333 *
334 *******************************************************************************
335 *
336 * @param[inout] spm
337 * The ijv matrix at enter,
338 * the csc matrix at exit.
339 *
340 *******************************************************************************
341 *
342 * @retval SPM_SUCCESS on success
343 * @retval SPM_ERR_NOTIMPLEMENTED on non supported cases
344 *
345 *******************************************************************************/
346int
348{
349 spm_int_t *newcol, *oldcol;
350 spm_int_t k, j, tmp, baseval, total;
351
352 /*
353 * Sort the IJV structure by column/row indexes
354 */
355 c_spmSort( spm );
356
357#if defined(SPM_WITH_MPI)
358 if ( !spm->replicated ) {
359 return c_spm_dijv2csc( spm );
360 }
361#endif
362 /* Allocate and compute the new colptr */
363 newcol = (spm_int_t *) calloc(spm->n+1,sizeof(spm_int_t));
364
365 /* Compute the number of edges per row */
366 baseval = spm->baseval;
367 oldcol = spm->colptr;
368 for (k=0; k<spm->nnz; k++, oldcol++)
369 {
370 j = *oldcol - baseval;
371 assert( j >= 0 );
372 newcol[j]++;
373 }
374 free( spm->colptr );
375
376 /* Update the colptr */
377 total = baseval;
378 spm->colptr = newcol;
379 for (j=0; j<(spm->n+1); j++, newcol++)
380 {
381 tmp = *newcol;
382 *newcol = total;
383 total += tmp;
384 }
385 assert( (total - baseval) == spm->nnz );
386 spm->fmttype = SpmCSC;
387
388 return SPM_SUCCESS;
389}
390
391/**
392 *******************************************************************************
393 *
394 * @ingroup spm_dev_convert
395 *
396 * @brief convert a symmetric matrix in CSR format to a matrix in CSC format.
397 *
398 * Note that the transposed matrix is returned.
399 *
400 *******************************************************************************
401 *
402 * @param[inout] spm
403 * The csr matrix on entry,
404 * the csc matrix on exit.
405 *
406 *******************************************************************************
407 *
408 * @retval SPM_SUCCESS, if succeeded
409 * @retval SPM_ERR_NOTIMPLEMENTED, it not yet implemented
410 *
411 *******************************************************************************/
412static inline int
414{
415 spm_int_t *tmp;
416
417 assert( spm->fmttype == SpmCSR );
418
419 spm->fmttype = SpmCSC;
420
421 /* Just need to swap the pointers */
422 tmp = spm->rowptr;
423 spm->rowptr = spm->colptr;
424 spm->colptr = tmp;
425 spm->fmttype = SpmCSC;
426
427 return SPM_SUCCESS;
428}
429
430#if defined(PRECISION_z) || defined(PRECISION_c)
431static inline void
432c_spmConvert_conj_elt( const spm_layout_t layout,
433 const spm_int_t row,
434 const spm_int_t dofi,
435 const spm_int_t col,
436 const spm_int_t dofj,
437 spm_complex32_t *valptr )
438{
439 spm_int_t ii, jj;
440
441 if ( layout == SpmColMajor ) {
442 for ( jj = 0; jj < dofj; jj++ ) {
443 for ( ii = 0; ii < dofi; ii++, valptr++ ) {
444 if ( ( col + jj ) == ( row + ii ) ) {
445 continue;
446 }
447 *valptr = conjf( *valptr );
448 }
449 }
450 }
451 else {
452 for ( ii = 0; ii < dofi; ii++ ) {
453 for ( jj = 0; jj < dofj; jj++, valptr++ ) {
454 if ( ( col + jj ) == ( row + ii ) ) {
455 continue;
456 }
457 *valptr = conjf( *valptr );
458 }
459 }
460 }
461}
462
463/**
464 *******************************************************************************
465 *
466 * @ingroup spm_dev_convert
467 *
468 * @brief convert an hermitian matrix in CSR format to a matrix in CSC format.
469 *
470 * Note that the conjugate transposed matrix is returned.
471 *
472 *******************************************************************************
473 *
474 * @param[inout] spm
475 * The csr matrix on entry,
476 * the csc matrix on exit.
477 *
478 *******************************************************************************
479 *
480 * @retval SPM_SUCCESS, if succeeded
481 * @retval SPM_ERR_NOTIMPLEMENTED, it not yet implemented
482 *
483 *******************************************************************************/
484static inline int
485c_spmConvertCSR2CSC_her( spmatrix_t *spm )
486{
487 const spm_int_t *dofs;
488 const spm_int_t *loc2glob;
489 spm_complex32_t *valptr = spm->values;
490 spm_int_t *colptr = spm->colptr;
491 spm_int_t *rowptr = spm->rowptr;
492 spm_int_t ig, dofi, row;
493 spm_int_t jg, dofj, col;
494 spm_int_t i, k;
495 spm_int_t *tmp;
496 spm_int_t baseval = spm->baseval;
497
498 assert( spm->fmttype == SpmCSR );
499
500 spm->fmttype = SpmCSC;
501 dofs = spm->dofs;
502 loc2glob = spm->loc2glob;
503
504 for( i=0; i<spm->n; i++, rowptr++, loc2glob++ )
505 {
506 ig = spm->replicated ? i : (*loc2glob) - baseval;
507 if ( spm->dof > 0 ) {
508 dofi = spm->dof;
509 row = spm->dof * ig;
510 }
511 else {
512 dofi = dofs[ig+1] - dofs[ig];
513 row = dofs[ig] - baseval;
514 }
515
516 for( k=rowptr[0]; k<rowptr[1]; k++, colptr++ )
517 {
518 jg = (*colptr - baseval);
519 if ( spm->dof > 0 ) {
520 dofj = spm->dof;
521 col = spm->dof * jg;
522 }
523 else {
524 dofj = dofs[jg+1] - dofs[jg];
525 col = dofs[jg] - baseval;
526 }
527
528 c_spmConvert_conj_elt( spm->layout,
529 row, dofi, col, dofj, valptr );
530 valptr += dofi * dofj;
531 }
532 }
533
534 /* Just need to swap the pointers */
535 tmp = spm->rowptr;
536 spm->rowptr = spm->colptr;
537 spm->colptr = tmp;
538 spm->fmttype = SpmCSC;
539
540 return SPM_SUCCESS;
541}
542#endif
543
544/**
545 *******************************************************************************
546 *
547 * @ingroup spm_dev_convert
548 *
549 * @brief convert a general matrix in CSR format to a matrix in CSC format.
550 *
551 *******************************************************************************
552 *
553 * @param[inout] spm
554 * The csr matrix on entry,
555 * the csc matrix on exit.
556 *
557 *******************************************************************************
558 *
559 * @retval SPM_SUCCESS, if succeeded
560 * @retval SPM_ERR_NOTIMPLEMENTED, it not yet implemented
561 *
562 *******************************************************************************/
563static inline int
565{
566 spm_int_t *row_csc;
567 spm_int_t *col_csc;
568 spm_int_t *dofs;
569
570#if !defined(PRECISION_p)
571 spm_complex32_t *val_csc, *valtmp;
572 spm_complex32_t *valptr = (spm_complex32_t *)(spm->values);
573#endif
574 spm_int_t j, k, col, row, nnz, baseval;
575
576#if defined(SPM_WITH_MPI)
577 if ( !spm->replicated ) {
579 }
580#endif
581 assert( spm->loc2glob == NULL );
582 assert( spm->fmttype == SpmCSR );
583
584 baseval = spm->baseval;
585 nnz = spm->nnz;
586
587 row_csc = malloc( nnz * sizeof(spm_int_t) );
588 col_csc = calloc( spm->n+1,sizeof(spm_int_t) );
589
590 assert( row_csc );
591 assert( col_csc );
592
593#if !defined(PRECISION_p)
594 val_csc = malloc( spm->nnzexp * sizeof(spm_complex32_t) );
595 assert( val_csc );
596 valtmp = val_csc;
597#endif
598
599 /* Count the number of elements per column */
600 for (j=0; j<nnz; j++) {
601 col = spm->colptr[j] - baseval;
602 assert( col < spm->n );
603 col_csc[ col+1 ] ++;
604 }
605
606 /* Compute the index of each column */
607 col_csc[0] = 0;
608 for (j=0; j<spm->n; j++){
609 col_csc[j+1] += col_csc[j];
610 }
611
612 assert( col_csc[spm->gN] == nnz );
613
614 for (row=0; row<spm->n; row++) {
615 spm_int_t fcol = spm->rowptr[row ] - baseval;
616 spm_int_t lcol = spm->rowptr[row+1] - baseval;
617
618 for ( k=fcol; k<lcol; k++ ) {
619 col = spm->colptr[k] - baseval;
620 j = col_csc[col];
621 row_csc[j] = row + baseval;
622
623#if !defined(PRECISION_p)
624 val_csc[j] = valptr[k];
625#endif
626 col_csc[col]++;
627 }
628 }
629
630 /* Restore the colptr indexes */
631 {
632 spm_int_t tmp, tmp2;
633
634 tmp = col_csc[0];
635 col_csc[0] = baseval;
636 for ( j=0; j<spm->n; j++ ) {
637 tmp2 = col_csc[j+1];
638 col_csc[j+1] = tmp + baseval;
639 tmp = tmp2;
640 }
641 }
642
643 /**
644 * If the spm has multidof, we have to recompute the newal array
645 * It's done here because we need the new rowptr array
646 */
647 dofs = spm->dofs;
648#if !defined(PRECISION_p)
649 if ( spm->dof != 1 ) {
650 spm_int_t *coltmp = col_csc;
651 spm_int_t *rowtmp = row_csc;
652 spm_int_t *validx = spm_get_value_idx_by_elt( spm );
653 spm_int_t *colcsr;
654 spm_int_t dof, idx;
655 spm_int_t dofi, dofj, dof2;
656
657 dof = spm->dof;
658 for ( col = 0; col < spm->n; col++, coltmp++ )
659 {
660 dofj = (dof > 0) ? dof : dofs[col+1] - dofs[col];
661 for ( k = coltmp[0]; k < coltmp[1]; k++, rowtmp++ )
662 {
663 row = *rowtmp - baseval;
664 dofi = (dof > 0) ? dof : dofs[row+1] - dofs[row];
665 dof2 = dofi * dofj;
666
667 /* Get the validx */
668 colcsr = spm->colptr + spm->rowptr[row] - baseval;
669 for ( j = spm->rowptr[row]; j < spm->rowptr[row + 1]; j++, colcsr++ )
670 {
671 if( col == (*colcsr - baseval) ){
672 break;
673 }
674 }
675 idx = validx[colcsr - spm->colptr];
676
677 memcpy( valtmp, valptr + idx, dof2 * sizeof( spm_complex32_t ) );
678 valtmp += dof2;
679 }
680 }
681 free( validx );
682 assert( (valtmp - val_csc) == spm->nnzexp );
683 }
684#endif
685
686 spm->dofs = NULL;
687 spmExit( spm );
688 spm->fmttype = SpmCSC;
689 spm->colptr = col_csc;
690 spm->rowptr = row_csc;
691#if !defined(PRECISION_p)
692 spm->values = val_csc;
693#else
694 spm->values = NULL;
695#endif
696 spm->dofs = dofs;
697
698 return SPM_SUCCESS;
699}
700
701/**
702 *******************************************************************************
703 *
704 * @ingroup spm_dev_convert
705 *
706 * @brief convert a matrix in CSR format to a matrix in CSC
707 * format.
708 *
709 * If the matrix is SpmSymmetric or SpmHermitian, then the
710 * transpose or respectively the conjugate is returned.
711 *
712 *******************************************************************************
713 *
714 * @param[inout] spm
715 * The csr matrix at enter,
716 * the csc matrix at exit.
717 *
718 *******************************************************************************
719 *
720 * @retval SPM_SUCCESS
721 *
722 *******************************************************************************/
723int
725{
726 assert( spm->fmttype == SpmCSR );
727
728 switch( spm->mtxtype ) {
729 case SpmGeneral:
730 return c_spmConvertCSR2CSC_gen( spm );
731#if defined(PRECISION_z) || defined(PRECISION_c)
732 case SpmHermitian:
733 return c_spmConvertCSR2CSC_her( spm );
734#endif
735 case SpmSymmetric:
736 default:
737 return c_spmConvertCSR2CSC_sym( spm );
738 }
739
740 return SPM_ERR_UNKNOWN;
741}
float _Complex spm_complex32_t
Definition datatypes.h:161
enum spm_layout_e spm_layout_t
Direction of the matrix storage.
#define SpmDistByColumn
Distribution of the matrix storage.
Definition const.h:42
@ SPM_ERR_BADPARAMETER
Definition const.h:89
@ SPM_SUCCESS
Definition const.h:82
@ SPM_ERR_UNKNOWN
Definition const.h:83
@ SPM_ERR_NOTIMPLEMENTED
Definition const.h:85
@ SpmColMajor
Definition const.h:148
@ SpmGeneral
Definition const.h:165
@ SpmSymmetric
Definition const.h:166
@ SpmHermitian
Definition const.h:167
@ SpmCSC
Definition const.h:73
@ SpmCSR
Definition const.h:74
spm_int_t * spm_get_value_idx_by_elt(const spmatrix_t *spm)
Create an array that represents the shift for each sub-element of the original multidof value array.
Definition spm.c:2211
void c_spmSort(spmatrix_t *spm)
This routine sorts the spm matrix.
Definition c_spm_sort.c:303
spm_int_t * spm_get_value_idx_by_col(const spmatrix_t *spm)
Create an array that represents the shift for each sub-element of the original multidof value array.
Definition spm.c:2140
int c_spmConvertCSR2CSC(spmatrix_t *spm)
convert a matrix in CSR format to a matrix in CSC format.
static int c_spmConvertCSR2CSC_gen(spmatrix_t *spm)
convert a general matrix in CSR format to a matrix in CSC format.
int c_spmConvertIJV2CSC(spmatrix_t *spm)
convert a matrix in IJV format to a matrix in CSC format.
static int c_spmConvertCSR2CSC_sym(spmatrix_t *spm)
convert a symmetric matrix in CSR format to a matrix in CSC format.
spm_int_t * dofs
Definition spm.h:85
void * values
Definition spm.h:92
spm_int_t nnz
Definition spm.h:75
spm_int_t nnzexp
Definition spm.h:80
spm_int_t * rowptr
Definition spm.h:90
spm_fmttype_t fmttype
Definition spm.h:69
spm_int_t dof
Definition spm.h:82
spm_int_t n
Definition spm.h:73
spm_mtxtype_t mtxtype
Definition spm.h:65
spm_int_t * loc2glob
Definition spm.h:91
spm_layout_t layout
Definition spm.h:87
spm_int_t baseval
Definition spm.h:71
spm_int_t * glob2loc
Definition spm.h:94
spm_int_t * colptr
Definition spm.h:89
spm_int_t gN
Definition spm.h:72
int replicated
Definition spm.h:98
void spmExit(spmatrix_t *spm)
Cleanup the spm structure but do not free the spm pointer.
Definition spm.c:224
int spm_int_t
The main integer datatype used in spm arrays.
Definition datatypes.h:70
The sparse matrix data structure.
Definition spm.h:64
spm_int_t * spm_getandset_glob2loc(spmatrix_t *spm)
Computes the glob2loc array if needed, and returns it.
Definition spm.c:2007
int spm_get_distribution(const spmatrix_t *spm)
Search the distribution pattern used in the spm structure.
Definition spm.c:2049