25#include "spm/config.h"
128 int opt_distByColumn,
158void spmScalMatrix(
double alpha,
spmatrix_t *spm ) __attribute__((__deprecated__(
"Please replace by spmScal() function (will be removed in 1.3.0)")));
180 unsigned long long int seed,
186 unsigned long long int seed,
237void spmIntSort1Asc1(
void *
const pbase,
spm_int_t n );
238void spmIntSort2Asc1(
void *
const pbase,
spm_int_t n );
239void spmIntSort2Asc2(
void *
const pbase,
spm_int_t n );
240void spmIntMSortIntAsc(
void **
const pbase,
spm_int_t n );
257 const char *filename,
260 const char *filename,
308 fprintf( f,
"%ld %ld %e %e\n", (
long)i, (
long)j, creal( A ), cimag( A ) );
318 fprintf( f,
"%ld %ld %e %e\n", (
long)i, (
long)j, crealf( A ), cimagf( A ) );
327 fprintf( f,
"%ld %ld %e\n", (
long)i, (
long)j, A );
336 fprintf( f,
"%ld %ld %e\n", (
long)i, (
long)j, A );
344#define p_spmPrintElt( f, i, j, A ) \
346 fprintf( f, "%ld %ld\n", (long)( i ), (long)( j ) ); \
float _Complex spm_complex32_t
enum spm_driver_e spm_driver_t
The list of matrix driver readers and generators.
enum spm_layout_e spm_layout_t
Direction of the matrix storage.
enum spm_fmttype_e spm_fmttype_t
Sparse matrix format.
enum spm_rhstype_e spm_rhstype_t
How to generate RHS.
enum spm_coeftype_e spm_coeftype_t
Arithmetic types.
enum spm_normtype_e spm_normtype_t
Norms.
enum spm_trans_e spm_trans_t
Transpostion.
enum spm_mtxtype_e spm_mtxtype_t
Matrix symmetry type property.
static void z_spmPrintElt(FILE *f, spm_int_t i, spm_int_t j, spm_complex64_t A)
Subroutines to print one element of an spm structure.
int spmGather(const spmatrix_t *spm_scattered, int root, spmatrix_t *opt_spm_gathered)
Gather a distributed Sparse Matrix on a single node.
int spmParseLaplacianInfo(const char *filename, spm_coeftype_t *flttype, spm_int_t *dim1, spm_int_t *dim2, spm_int_t *dim3, double *alpha, double *beta, spm_int_t *dof)
Parse information given through the filename string to configure the laplacian matrix to generate.
double spmNormMat(spm_normtype_t ntype, const spmatrix_t *spm, spm_int_t n, const void *A, spm_int_t lda)
Compute the norm of the spm.
void spmAlloc(spmatrix_t *spm)
Allocate the arrays of an spm structure.
int spmLoadDist(spmatrix_t *spm, const char *filename, SPM_Comm comm)
Load the spm structure from a file (internal format).
void spmExit(spmatrix_t *spm)
Cleanup the spm structure but do not free the spm pointer.
int spmLoad(spmatrix_t *spm, const char *filename)
Load the spm structure from a file (internal format).
spm_int_t spmSymmetrize(spmatrix_t *spm)
Symmetrize the pattern of the spm.
int spmReduceRHS(spm_int_t nrhs, const spmatrix_t *spm, void *Bg, spm_int_t ldbg, void *Bl, spm_int_t ldbl)
Reduce an RHS thanks to spm distribution.
void spmUpdateComputedFields(spmatrix_t *spm)
Update all the computed fields based on the static values stored.
int spmGenRHS(spm_rhstype_t type, spm_int_t nrhs, const spmatrix_t *spm, void *opt_X, spm_int_t opt_ldx, void *B, spm_int_t ldb)
Generate right hand side vectors associated to a given matrix.
void spmBase(spmatrix_t *spm, int baseval)
Rebase the arrays of the spm to the given value.
struct spmatrix_s spmatrix_t
The sparse matrix data structure.
int spmScatter(spmatrix_t *spm_scattered, int root, const spmatrix_t *opt_spm_gathered, spm_int_t opt_n, const spm_int_t *opt_loc2glob, int opt_distByColumn, SPM_Comm opt_comm)
Scatter the SPM thanks to loc2glob.
int spm_int_t
The main integer datatype used in spm arrays.
spm_int_t spmFindBase(const spmatrix_t *spm)
Search the base used in the spm structure.
int spmMatVec(spm_trans_t trans, double alpha, const spmatrix_t *spm, const void *x, double beta, void *y)
Compute a matrix-vector product.
void spmPrintRHS(const spmatrix_t *spm, int nrhs, const void *x, spm_int_t ldx, FILE *stream)
Print a set of vector associated to an spm matrix.
int spmCheckAxb(double eps, spm_int_t nrhs, const spmatrix_t *spm, void *opt_X0, spm_int_t opt_ldx0, void *B, spm_int_t ldb, const void *X, spm_int_t ldx)
Check the backward error, and the forward error if x0 is provided.
void spmInitDist(spmatrix_t *spm, SPM_Comm comm)
Init the spm structure with a specific communicator.
int spmConvert(int ofmttype, spmatrix_t *ospm)
Convert the storage format of the spm.
int spmExtractLocalRHS(spm_int_t nrhs, const spmatrix_t *spm, const void *Bg, spm_int_t ldbg, void *Bl, spm_int_t ldbl)
Stores the local values of a global RHS in the local one thanks to spm distribution.
int spmGatherRHS(spm_int_t nrhs, const spmatrix_t *spm, const void *Bl, spm_int_t ldbl, int root, void *Bg, spm_int_t ldbg)
Gather an RHS thanks to spm distribution.
double spmNormVec(spm_normtype_t ntype, const spmatrix_t *spm, const void *x, spm_int_t incx)
Compute the norm of the spm.
spm_int_t spmMergeDuplicate(spmatrix_t *spm)
Merge multiple entries in a spm by summing their values together.
int spmMatMat(spm_trans_t trans, spm_int_t n, double alpha, const spmatrix_t *A, const void *B, spm_int_t ldb, double beta, void *C, spm_int_t ldc)
Compute a matrix-matrix product.
void spmGenFakeValues(spmatrix_t *spm)
Generate the fake values array such that .
int spmRedistribute(const spmatrix_t *spm, spm_int_t new_n, const spm_int_t *newl2g, spmatrix_t *newspm)
Create a copy of a given SPM with a new distribution corresponding to the given loc2glob array.
int spmCheckAndCorrect(const spmatrix_t *spm_in, spmatrix_t *spm_out)
Check the correctness of a spm.
int spmGatherInPlace(spmatrix_t *spm)
This routine performs a allgather of a distributed spm in place.
int spmReadDriver(spm_driver_t driver, const char *filename, spmatrix_t *spm)
Import a matrix file into a spm structure.
int spmSort(spmatrix_t *spm)
Sort the subarray of edges of each vertex.
void spmScal(double alpha, spmatrix_t *spm)
Scale the spm.
void spmExpand(const spmatrix_t *spm_in, spmatrix_t *spm_out)
Expand a multi-dof spm matrix into an spm with constant dof set to 1.
int spmDofExtend(const spmatrix_t *spm, int type, int dof, spmatrix_t *spm_out)
Generate a random multidof spm from a given spm (with dof=1).
void spmPrint(const spmatrix_t *spm, FILE *f)
Print an spm matrix into into a given file.
void spmScalVec(double alpha, const spmatrix_t *spm, void *x, spm_int_t incx)
Scale a vector associated to a sparse matrix. Deprecated function replaced by spmScalVec() or spmScal...
void spmIntConvert(spm_int_t n, const int *input, spm_int_t *output)
Convert integer array to spm_int_t format.
void spmScalMat(double alpha, const spmatrix_t *spm, spm_int_t n, void *A, spm_int_t lda)
Scale a matrix associated to a sparse matrix.
void spmScalMatrix(double alpha, spmatrix_t *spm) __attribute__((__deprecated__("Please replace by spmScal() function (will be removed in 1.3.0)")))
Scale the spm.
int spmReadDriverDist(spm_driver_t driver, const char *filename, spmatrix_t *spm, SPM_Comm comm)
Import a matrix file into an spm structure for a specific communicator.
int spmSave(const spmatrix_t *spm, const char *filename)
Save the spm structure into a file (internal format).
int spmGenVec(spm_rhstype_t type, const spmatrix_t *spm, void *alpha, unsigned long long int seed, void *x, spm_int_t incx)
Generate a vector associated to a given matrix.
double spmNorm(spm_normtype_t ntype, const spmatrix_t *spm)
Compute the norm of the spm.
void spm2Dense(const spmatrix_t *spm, void *A)
Convert the spm matrix into a dense matrix for test purpose.
void spmCopy(const spmatrix_t *spm_in, spmatrix_t *spm_out)
Create a copy of the spm.
void spmInit(spmatrix_t *spm)
Init the spm structure.
int spmGenMat(spm_rhstype_t type, spm_int_t nrhs, const spmatrix_t *spm, void *alpha, unsigned long long int seed, void *A, spm_int_t lda)
Generate a set of vectors associated to a given matrix.
void spmScalVector(spm_coeftype_t flt, double alpha, spm_int_t n, void *A, spm_int_t lda) __attribute__((__deprecated__("Please replace by spmScalVec() or spmScalMat() depending on usage (will be removed in 1.3.0)")))
Scale a vector according to the spm type.
void spmPrintInfo(const spmatrix_t *spm, FILE *f)
Print basic informations about the spm matrix into a given stream.
The sparse matrix data structure.
int spmBlasSetNumThreadsOne(void)
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) to 1 and return the previous number of...
static void s_spmPrintElt(FILE *f, spm_int_t i, spm_int_t j, float A)
Subroutines to print one element of an spm structure.
static void d_spmPrintElt(FILE *f, spm_int_t i, spm_int_t j, double A)
Subroutines to print one element of an spm structure.
int spmBlasGetNumThreads(void)
Return the current number of threads used for blas calls.
int spmBlasSetNumThreads(int nt)
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) and return the previous number of blas...
static void c_spmPrintElt(FILE *f, spm_int_t i, spm_int_t j, spm_complex32_t A)
Subroutines to print one element of an spm structure.