SpM Handbook 1.3.0
Loading...
Searching...
No Matches
d_spm.h
Go to the documentation of this file.
1/**
2 *
3 * @file d_spm.h
4 *
5 * SParse Matrix package precision dependent header.
6 *
7 * @copyright 2016-2026 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8 * Univ. Bordeaux. All rights reserved.
9 *
10 * @version 1.3.0
11 * @author Pierre Ramet
12 * @author Mathieu Faverge
13 * @author Alban Bellot
14 * @author Tony Delarue
15 * @author Alycia Lisito
16 * @author Fatima-Zahra Salhi
17 * @date 2026-07-15
18 *
19 * @generated from /builds/fpruvost/spm/include/spm/z_spm.h, normal z -> d, Fri Oct 23 13:04:58 2026
20 *
21 * @addtogroup spm_dev_integer
22 * @{
23 *
24 **/
25#ifndef _d_spm_h_
26#define _d_spm_h_
27
28/**
29 * @brief Integer routines
30 */
31void d_spmIntFltSortAsc( void **const pbase,
32 const spm_int_t n );
33void d_spmIntIntFltSortAsc( void ** const pbase,
34 const spm_int_t n );
35
36/**
37 * @}
38 * @addtogroup spm_dev_convert
39 * @{
40 *
41 * @brief Conversion routines
42 */
49
50void d_spm2dense( const spmatrix_t *spm, double *A );
51
52/**
53 * @}
54 * @addtogroup spm_dev_matvec
55 * @{
56 *
57 * @brief Matrix-Vector and matrix-matrix product routines
58 */
59int spm_dspmv( spm_trans_t trans,
60 double alpha,
61 const spmatrix_t *A,
62 const double *x,
63 spm_int_t incx,
64 double beta,
65 double *y,
66 spm_int_t incy );
67int spm_dspmm( spm_side_t side,
68 spm_trans_t transA,
69 spm_trans_t transB,
70 spm_int_t K,
71 double alpha,
72 const spmatrix_t *A,
73 const double *B,
74 spm_int_t ldb,
75 double beta,
76 double *C,
77 spm_int_t ldc );
78
79/**
80 * @}
81 * @addtogroup spm_dev_norm
82 * @{
83 *
84 * @brief Norm computation routines
85 */
86double d_spmNorm( spm_normtype_t ntype,
87 const spmatrix_t *spm );
88double d_spmNormMat( spm_normtype_t ntype,
89 const spmatrix_t *spm,
90 spm_int_t n,
91 const double *A,
92 spm_int_t lda );
93
94/**
95 * @}
96 * @addtogroup spm_dev_check
97 * @{
98 *
99 * @brief Extra routines
100 */
101void d_spmSort( spmatrix_t *spm );
103
104/**
105 * @}
106 * @addtogroup spm_dev_rhs
107 * @{
108 *
109 * @brief RHS routines
110 */
111int d_spmGenRHS( spm_rhstype_t type,
112 int nrhs,
113 const spmatrix_t *spm,
114 void *x,
115 int ldx,
116 void *b,
117 int ldb );
118int d_spmGenMat( spm_rhstype_t type,
119 int nrhs,
120 const spmatrix_t *spm,
121 void *alpha,
122 unsigned long long int seed,
123 void *A,
124 int lda );
126 int nrhs,
127 const spmatrix_t *spm,
128 void *x0,
129 int ldx0,
130 void *b,
131 int ldb,
132 const void *x,
133 int ldx );
134
135void d_spmGatherRHS( int nrhs,
136 const spmatrix_t *spm,
137 const double *x,
138 spm_int_t ldx,
139 int root,
140 double *gx,
141 spm_int_t ldgx );
142
143void d_spmReduceRHS( int nrhs,
144 const spmatrix_t *spm,
145 double *bglob,
146 spm_int_t ldbg,
147 double *bloc,
148 spm_int_t ldbl );
149void d_spmExtractLocalRHS( int nrhs,
150 const spmatrix_t *spm,
151 const double *bglob,
152 spm_int_t ldbg,
153 double *bloc,
154 spm_int_t ldbl );
155
156/**
157 * @}
158 * @addtogroup spm_dev_print
159 * @{
160 *
161 * @brief Output routines
162 */
163void d_spmPrint( FILE *f,
164 const spmatrix_t *spm );
165void d_spmPrintRHS( FILE *f,
166 const spmatrix_t *spm,
167 int nrhs,
168 const void *x,
169 spm_int_t ldx );
170void d_spmDensePrint( FILE *f,
171 spm_int_t m,
172 spm_int_t n,
173 const double *A,
174 spm_int_t lda );
175
176/**
177 * @}
178 * @addtogroup spm_dev_dof
179 * @{
180 *
181 * @brief DOF routines
182 */
183void d_spmExpand( const spmatrix_t *spm_in,
184 spmatrix_t *spm_out );
185void d_spmDofExtend( spmatrix_t *spm );
186
187/**
188 * @}
189 * @addtogroup spm_dev_scal
190 * @{
191 *
192 * @brief Scaling routines
193 */
194void d_spmScal( const double alpha,
195 spmatrix_t *spm );
196
197/**
198 * @}
199 * @addtogroup spm_dev_rhs
200 * @{
201 *
202 * @brief Subroutines for random vector generation to be used in testings
203 */
204int d_spmRhsGenRndShm( const spmatrix_t *spm,
205 double scale,
206 spm_int_t n,
207 double *A,
208 spm_int_t lda,
209 int shift,
210 unsigned long long int seed );
211int d_spmRhsGenRndDist( const spmatrix_t *spm,
212 double scale,
213 spm_int_t n,
214 double *A,
215 spm_int_t lda,
216 int shift,
217 unsigned long long int seed );
218
219/**
220 * @}
221 * @addtogroup spm_dev_zeros
222 * @{
223 *
224 * @brief Subroutines to detect diagonal zeros
225 */
226int d_spmGetDiagonalZeros( const spmatrix_t *spm,
227 spm_int_t *zeros_n,
228 spm_int_t **zeros_list );
229
230/**
231 * @}
232 */
233#endif /* _d_spm_h_ */
double spm_fixdbl_t
Double datatype that is not converted through precision generator functions.
Definition datatypes.h:150
enum spm_rhstype_e spm_rhstype_t
How to generate RHS.
enum spm_normtype_e spm_normtype_t
Norms.
enum spm_trans_e spm_trans_t
Transpostion.
enum spm_side_e spm_side_t
Side of the operation.
void d_spmSort(spmatrix_t *spm)
This routine sorts the spm matrix.
Definition d_spm_sort.c:303
spm_int_t d_spmMergeDuplicate(spmatrix_t *spm)
This routine merge the multiple entries in a sparse matrix by summing their values together.
int d_spmConvertIJV2CSC(spmatrix_t *spm)
convert a matrix in IJV format to a matrix in CSC format.
int d_spmConvertCSR2IJV(spmatrix_t *spm)
convert a matrix in CSR format to a matrix in IJV format.
int d_spmConvertCSR2CSC(spmatrix_t *spm)
convert a matrix in CSR format to a matrix in CSC format.
int d_spmConvertCSC2IJV(spmatrix_t *spm)
Convert a matrix in CSC format to a matrix in IJV format.
int d_spmConvertCSC2CSR(spmatrix_t *spm)
convert a matrix in CSC format to a matrix in CSR format.
int d_spmConvertIJV2CSR(spmatrix_t *spm)
convert a matrix in IJV format to a matrix in CSR format.
void d_spm2dense(const spmatrix_t *spm, double *A)
Convert a sparse matrix into a dense matrix.
void d_spmExpand(const spmatrix_t *spm_in, spmatrix_t *spm_out)
Expand a single dof sparse matrix to a multi-dofs sparse matrix.
void d_spmDofExtend(spmatrix_t *spm)
Extend a single dof sparse matrix to a multi-dof sparse matrix.
void d_spmIntFltSortAsc(void **const pbase, const spm_int_t n)
Integer routines.
void d_spmIntIntFltSortAsc(void **const pbase, const spm_int_t n)
Sort 2 arrays simultaneously, the first array is an array of spm_int_t and used as key for sorting....
int spm_dspmm(spm_side_t side, spm_trans_t transA, spm_trans_t transB, spm_int_t K, double alpha, const spmatrix_t *A, const double *B, spm_int_t ldb, double beta, double *C, spm_int_t ldc)
Compute a matrix-matrix product.
int spm_dspmv(spm_trans_t trans, double alpha, const spmatrix_t *A, const double *x, spm_int_t incx, double beta, double *y, spm_int_t incy)
compute the matrix-vector product:
double d_spmNorm(spm_normtype_t ntype, const spmatrix_t *spm)
Compute the norm of an spm matrix.
double d_spmNormMat(spm_normtype_t ntype, const spmatrix_t *spm, spm_int_t n, const double *A, spm_int_t lda)
Compute the norm of a dense matrix that follows the distribution of an spm matrix.
void d_spmDensePrint(FILE *f, spm_int_t m, spm_int_t n, const double *A, spm_int_t lda)
Print a dense matrix to the given file.
void d_spmPrintRHS(FILE *f, const spmatrix_t *spm, int nrhs, const void *x, spm_int_t ldx)
Write into a file the vectors associated to a spm.
void d_spmPrint(FILE *f, const spmatrix_t *spm)
Write a spm matrix in a file.
int d_spmRhsGenRndShm(const spmatrix_t *spm, double scale, spm_int_t n, double *A, spm_int_t lda, int shift, unsigned long long int seed)
Generate a set of vectors of random values in shared memory.
int d_spmCheckAxb(spm_fixdbl_t eps, int nrhs, const spmatrix_t *spm, void *x0, int ldx0, void *b, int ldb, const void *x, int ldx)
Check the backward error, and the forward error if x0 is provided.
int d_spmGenRHS(spm_rhstype_t type, int nrhs, const spmatrix_t *spm, void *x, int ldx, void *b, int ldb)
Generate nrhs right hand side vectors associated to a given matrix to test a problem with a solver.
int d_spmGenMat(spm_rhstype_t type, int nrhs, const spmatrix_t *spm, void *alpha, unsigned long long int seed, void *A, int lda)
Generate nrhs right hand side vectors associated to a given matrix to test a problem with a solver.
void d_spmReduceRHS(int nrhs, const spmatrix_t *spm, double *bglob, spm_int_t ldbg, double *bloc, spm_int_t ldbl)
Reduce all the global coefficients of a rhs and store the local ones.
Definition d_spm_rhs.c:109
int d_spmRhsGenRndDist(const spmatrix_t *spm, double scale, spm_int_t n, double *A, spm_int_t lda, int shift, unsigned long long int seed)
Generate a set of vectors of random values in distributed memory.
void d_spmGatherRHS(int nrhs, const spmatrix_t *spm, const double *x, spm_int_t ldx, int root, double *gx, spm_int_t ldgx)
Gather all the global C coefficients and store the good ones in local.
Definition d_spm_rhs.c:165
void d_spmExtractLocalRHS(int nrhs, const spmatrix_t *spm, const double *bglob, spm_int_t ldbg, double *bloc, spm_int_t ldbl)
Stores the local values of a global RHS in the local one.
Definition d_spm_rhs.c:51
void d_spmScal(const double alpha, spmatrix_t *spm)
Scal the spm: A = alpha * A.
Definition d_spm_scal.c:39
int d_spmGetDiagonalZeros(const spmatrix_t *spm, spm_int_t *zeros_n, spm_int_t **zeros_list)
Detect unknowns with a zero or missing diagonal entry.
struct spmatrix_s spmatrix_t
The sparse matrix data structure.
int spm_int_t
The main integer datatype used in spm arrays.
Definition datatypes.h:70