SpM Handbook 1.2.4
Loading...
Searching...
No Matches
spm_gen_fake_values.c File Reference
#include "common.h"

Go to the source code of this file.

Functions

static spm_int_t spm_compute_degrees_csx (const spmatrix_t *spm, spm_int_t *degrees)
 Compute the local degree of each vertex of an SPM in CSR/CSC format.
 
static spm_int_t spm_compute_degrees_ijv (const spmatrix_t *spm, spm_int_t *degrees)
 Compute the degree of each vertex of an IJV matrix.
 
static spm_int_t spm_compute_degrees (const spmatrix_t *spm, spm_int_t *degrees)
 Compute the degree of each vertex.
 
static void spm_add_diag_csx (spmatrix_t *spm, spm_int_t diagval)
 Insert diagonal elements to the graph of a CSC/CSR matrix to have a full Laplacian generated.
 
static void spm_add_diag_ijv (spmatrix_t *spm, spm_int_t diagval)
 Insert diagonal elements to the graph of an IJV matrix to have a full Laplacian generated.
 
static void spm_add_diag (spmatrix_t *spm, spm_int_t diagval)
 Insert diagonal elements to the graph of a matrix to have a full Laplacian generated.
 
static void spm_generate_fake_values (spmatrix_t *spm, const spm_int_t *degrees, double alpha, double beta)
 Generate the fake values array such that $ M =  \alpha * D - \beta * A $.
 
SPM basic subroutines
void spmGenFakeValues (spmatrix_t *spm)
 Generate the fake values array such that $ M =  \alpha * D - \beta * A $.
 

Detailed Description

SParse Matrix generic laplacian value generator routines.

Version
1.2.4
Author
Mathieu Faverge
Tony Delarue
Alycia Lisito
Date
2024-06-25

Definition in file spm_gen_fake_values.c.

Function Documentation

◆ spm_compute_degrees_csx()

static spm_int_t spm_compute_degrees_csx ( const spmatrix_t spm,
spm_int_t degrees 
)
static

Compute the local degree of each vertex of an SPM in CSR/CSC format.

Parameters
[in]spmThe spm to study in CSC/CSR format.
[in,out]degreesArray of size spm->gN allocated and set to 0 on entry. On exit, contains the degree of each vertex in the spm matrix for the local node.
Returns
the number of diagonal elements found during the computation.

Definition at line 41 of file spm_gen_fake_values.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::mtxtype, spmatrix_s::n, spmatrix_s::replicated, spmatrix_s::rowptr, SpmCSR, and SpmGeneral.

Referenced by spm_compute_degrees().

◆ spm_compute_degrees_ijv()

static spm_int_t spm_compute_degrees_ijv ( const spmatrix_t spm,
spm_int_t degrees 
)
static

Compute the degree of each vertex of an IJV matrix.

Parameters
[in]spmThe spm to study in IJV format.
[in,out]degreesArray of size spm->gN allocated and set to 0 on entry. On exit, contains the degree of each vertex in the spm matrix for the local node.
Returns
the number of diagonal elements found during the computation.

Definition at line 104 of file spm_gen_fake_values.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::mtxtype, spmatrix_s::nnz, spmatrix_s::rowptr, and SpmGeneral.

Referenced by spm_compute_degrees().

◆ spm_compute_degrees()

static spm_int_t spm_compute_degrees ( const spmatrix_t spm,
spm_int_t degrees 
)
static

Compute the degree of each vertex.

Parameters
[in]spmThe spm to study.
[in,out]degreesArray of size spm->n allocated on entry. On exit, contains the degree of each vertex in the spm matrix.
Returns
the number of diagonal elements found during the computation.

Definition at line 156 of file spm_gen_fake_values.c.

References spmatrix_s::clustnbr, spmatrix_s::comm, spmatrix_s::fmttype, spmatrix_s::gN, spmatrix_s::loc2glob, spmatrix_s::replicated, spm_compute_degrees_csx(), spm_compute_degrees_ijv(), SPM_MPI_INT, and SpmIJV.

Referenced by spmGenFakeValues().

◆ spm_add_diag_csx()

static void spm_add_diag_csx ( spmatrix_t spm,
spm_int_t  diagval 
)
static

Insert diagonal elements to the graph of a CSC/CSR matrix to have a full Laplacian generated.

Parameters
[in,out]spmAt start, the initial spm structure with missing diagonal elements. At exit, contains the same sparse matrix with diagonal elements added.
[in]diagvalThe number of diagonal elements already present in the matrix.

Definition at line 205 of file spm_gen_fake_values.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::replicated, spmatrix_s::rowptr, and SpmCSC.

Referenced by spm_add_diag().

◆ spm_add_diag_ijv()

static void spm_add_diag_ijv ( spmatrix_t spm,
spm_int_t  diagval 
)
static

Insert diagonal elements to the graph of an IJV matrix to have a full Laplacian generated.

Parameters
[in,out]spmAt start, the initial spm structure with missing diagonal elements. At exit, contains the same sparse matrix with diagonal elements added.
[in]diagvalThe number of diagonal elements already present in the matrix.

Definition at line 292 of file spm_gen_fake_values.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::replicated, and spmatrix_s::rowptr.

Referenced by spm_add_diag().

◆ spm_add_diag()

static void spm_add_diag ( spmatrix_t spm,
spm_int_t  diagval 
)
static

Insert diagonal elements to the graph of a matrix to have a full Laplacian generated.

Parameters
[in,out]spmAt start, the initial spm structure with missing diagonal elements. At exit, contains the same sparse matrix with diagonal elements added.
[in]diagvalThe number of diagonal elements already present in the matrix.

Definition at line 365 of file spm_gen_fake_values.c.

References spmatrix_s::fmttype, spm_add_diag_csx(), spm_add_diag_ijv(), and SpmIJV.

Referenced by spmGenFakeValues().

◆ spm_generate_fake_values()

static void spm_generate_fake_values ( spmatrix_t spm,
const spm_int_t degrees,
double  alpha,
double  beta 
)
static

Generate the fake values array such that $ M =  \alpha * D - \beta * A $.

D is the degree matrix, and A the adjacency matrix.

Parameters
[in,out]spmThe spm structure for which the values array must be generated.
[in]degreesArray of size spm->n that contains the degree of each vertex in the spm structure.
[in]alphaThe scalar alpha.
[in]betaThe scalar beta.

Definition at line 401 of file spm_gen_fake_values.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::mtxtype, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::replicated, spmatrix_s::rowptr, SpmCSC, SpmCSR, SpmDouble, SpmHermitian, SpmIJV, SpmSymmetric, and spmatrix_s::values.

Referenced by spmGenFakeValues().