SpM Handbook 1.2.4
Loading...
Searching...
No Matches
c_spm_genmat.c File Reference
#include "common.h"
#include <cblas.h>
#include <lapacke.h>

Go to the source code of this file.

Functions

static unsigned long long int Rnd64_jump (unsigned long long int n, unsigned long long int seed)
 Random generator from the HPL library.
 
static void c_updateRndVal (spm_complex32_t scale, spm_complex32_t *val, unsigned long long int *ran)
 Generate a value of the RHS.
 
int c_spmRhsGenRndShm (const spmatrix_t *spm, spm_complex32_t scale, spm_int_t n, spm_complex32_t *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in shared memory.
 
static int c_spm_rhs_dist_genRnd_csx (const spmatrix_t *spm, spm_complex32_t alpha, spm_int_t n, spm_complex32_t *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in distributed memory for CSX format.
 
static int c_spm_rhs_dist_genRnd_ijv (const spmatrix_t *spm, spm_complex32_t alpha, spm_int_t n, spm_complex32_t *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in distributed memory for IJV format.
 
int c_spmRhsGenRndDist (const spmatrix_t *spm, spm_complex32_t alpha, spm_int_t n, spm_complex32_t *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in distributed memory.
 
static int c_spmRhsGenOne (const spmatrix_t *spm, spm_complex32_t alpha, spm_int_t n, spm_complex32_t *A, spm_int_t lda)
 Generate a set of vectors of constant values.
 
static int c_spm_rhs_genI_csx (const spmatrix_t *spm, spm_complex32_t alpha, spm_int_t n, spm_complex32_t *A, spm_int_t lda)
 Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for CSC format.
 
static int c_spm_rhs_genI_ijv (const spmatrix_t *spm, spm_complex32_t alpha, spm_int_t n, spm_complex32_t *A, spm_int_t lda)
 Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for IJV format.
 
static int c_spmRhsGenI (const spmatrix_t *spm, spm_complex32_t alpha, spm_int_t n, spm_complex32_t *A, spm_int_t lda)
 Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ).
 
int c_spmGenMat (spm_rhstype_t type, int nrhs, const spmatrix_t *spm, void *alphaptr, 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.
 

Detailed Description

SParse Matrix package matrix generators.

Version
1.2.4
Author
Mathieu Faverge
Tony Delarue
Alycia Lisito
Date
2024-06-25
Generated arithmetic file from /builds/2mk6rsew/0/fpruvost/spm/src/z_spm_genmat.c, normal z -> c, Fri Nov 29 11:34:28 2024

Definition in file c_spm_genmat.c.

Function Documentation

◆ c_spm_rhs_dist_genRnd_csx()

static int c_spm_rhs_dist_genRnd_csx ( const spmatrix_t spm,
spm_complex32_t  alpha,
spm_int_t  n,
spm_complex32_t A,
spm_int_t  lda,
int  shift,
unsigned long long int  seed 
)
static

Generate a set of vectors of random values in distributed memory for CSX format.

Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
[in]shiftThe initial shift in the random sequence.
[in]seedThe seed used for random generation. Must be the same for all tiles initialized with this routine.
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

Definition at line 215 of file c_spm_genmat.c.

References spmatrix_s::baseval, c_updateRndVal(), spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::gNexp, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::replicated, Rnd64_jump(), and SPM_SUCCESS.

Referenced by c_spmRhsGenRndDist().

◆ c_spm_rhs_dist_genRnd_ijv()

static int c_spm_rhs_dist_genRnd_ijv ( const spmatrix_t spm,
spm_complex32_t  alpha,
spm_int_t  n,
spm_complex32_t A,
spm_int_t  lda,
int  shift,
unsigned long long int  seed 
)
static

Generate a set of vectors of random values in distributed memory for IJV format.

Warning
The matrix has to be sorted by column or by row.
Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
[in]shiftThe initial shift in the random sequence.
[in]seedThe seed used for random generation. Must be the same for all tiles initialized with this routine.
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

Definition at line 303 of file c_spm_genmat.c.

References spmatrix_s::baseval, c_updateRndVal(), spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::gNexp, spmatrix_s::nnz, Rnd64_jump(), spmatrix_s::rowptr, SPM_ERR_BADPARAMETER, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, and SpmDistByRow.

Referenced by c_spmRhsGenRndDist().

◆ c_spm_rhs_genI_csx()

static int c_spm_rhs_genI_csx ( const spmatrix_t spm,
spm_complex32_t  alpha,
spm_int_t  n,
spm_complex32_t A,
spm_int_t  lda 
)
static

Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for CSC format.

Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

Definition at line 529 of file c_spm_genmat.c.

References spmatrix_s::baseval, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nexp, spmatrix_s::replicated, and SPM_SUCCESS.

Referenced by c_spmRhsGenI().

◆ c_spm_rhs_genI_ijv()

static int c_spm_rhs_genI_ijv ( const spmatrix_t spm,
spm_complex32_t  alpha,
spm_int_t  n,
spm_complex32_t A,
spm_int_t  lda 
)
static

Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for IJV format.

Warning
The matrix has to be sorted by column or by row.
Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

If the spm is global, we have to know which vertice is sorted

Definition at line 607 of file c_spm_genmat.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::nexp, spmatrix_s::nnz, spmatrix_s::rowptr, SPM_ERR_BADPARAMETER, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, and SpmDistByRow.

Referenced by c_spmRhsGenI().