CUSP
Loading...
Searching...
No Matches
Gallery

Collection of example matrices. More...

Functions

template<typename Method , typename MatrixType >
void cusp::gallery::diffusion (MatrixType &matrix, const size_t m, const size_t n, const double eps=1e-5, const double theta=M_PI/4.0)
 
template<typename MatrixType >
void cusp::gallery::grid2d (MatrixType &matrix, const size_t m, const size_t n)
 
template<typename MatrixType >
void cusp::gallery::grid3d (MatrixType &matrix, const size_t m, const size_t n, const size_t l)
 
template<typename MatrixType >
void cusp::gallery::poisson5pt (MatrixType &matrix, const size_t m, const size_t n)
 
template<typename MatrixType >
void cusp::gallery::poisson9pt (MatrixType &matrix, const size_t m, const size_t n)
 
template<typename MatrixType >
void cusp::gallery::poisson7pt (MatrixType &matrix, const size_t m, const size_t n, const size_t k)
 
template<typename MatrixType >
void cusp::gallery::poisson27pt (MatrixType &matrix, const size_t m, const size_t n, const size_t l)
 
template<typename MatrixType >
void cusp::gallery::random (MatrixType &matrix, const size_t m, const size_t n, const size_t num_samples)
 

Detailed Description

Collection of example matrices.

Function Documentation

◆ diffusion()

template<typename Method , typename MatrixType >
void cusp::gallery::diffusion ( MatrixType &  matrix,
const size_t  m,
const size_t  n,
const double  eps = 1e-5,
const double  theta = M_PI/4.0 
)

diffusion: Create a matrix representing an anisotropic Poisson problem discretized on an m by n grid with the a given direction.

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
epsmagnitude of anisotropy
thetaangle of anisotropy in radians
Template Parameters
MatrixTypematrix container

◆ grid2d()

template<typename MatrixType >
void cusp::gallery::grid2d ( MatrixType &  matrix,
const size_t  m,
const size_t  n 
)

grid2d: Create a matrix representing a 2d m by n grid.

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
Template Parameters
MatrixTypematrix container
#include <cusp/print.h>
int main(void)
{
// create a matrix for a 4x4 grid
// print matrix
return 0;
}
Coordinate (COO) representation a sparse matrix.
Definition coo_matrix.h:117
Coordinate matrix format.
Grid matrix generators.
void print(const Printable &p)
print a textual representation of an object
Print textual representation of an object.

◆ grid3d()

template<typename MatrixType >
void cusp::gallery::grid3d ( MatrixType &  matrix,
const size_t  m,
const size_t  n,
const size_t  l 
)

grid3d: Create a matrix representing a 3d m by n by l grid.

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
lnumber of grid layers
Template Parameters
MatrixTypematrix container
#include <cusp/print.h>
int main(void)
{
// create a matrix for a 4x4x4 grid
cusp::gallery::grid3d(A, 4, 4, 4);
// print matrix
return 0;
}

◆ poisson27pt()

template<typename MatrixType >
void cusp::gallery::poisson27pt ( MatrixType &  matrix,
const size_t  m,
const size_t  n,
const size_t  l 
)

poisson27pt: Create a matrix representing a 27pt Poisson problem discretized on an m by n by l grid with the standard 3D 27-point finite-difference stencil.

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
lnumber of grid layers
Template Parameters
MatrixTypematrix container
#include <cusp/print.h>
int main(void)
{
// create a matrix for a Poisson problem on a 4x4x4 grid
// print matrix
return 0;
}
Poisson matrix generators.

◆ poisson5pt()

template<typename MatrixType >
void cusp::gallery::poisson5pt ( MatrixType &  matrix,
const size_t  m,
const size_t  n 
)

poisson5pt: Create a matrix representing a 5pt Poisson problem discretized on an m by n grid with the standard 2D 5-point finite-difference stencil.

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
Template Parameters
MatrixTypematrix container
#include <cusp/print.h>
int main(void)
{
// create a matrix for a Poisson problem on a 4x4 grid
// print matrix
return 0;
}

◆ poisson7pt()

template<typename MatrixType >
void cusp::gallery::poisson7pt ( MatrixType &  matrix,
const size_t  m,
const size_t  n,
const size_t  k 
)

poisson7pt: Create a matrix representing a 7pt Poisson problem discretized on an m by n by k grid with the standard 3D 7-point finite-difference stencil.

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
knumber of grid layers
Template Parameters
MatrixTypematrix container
#include <cusp/print.h>
int main(void)
{
// create a matrix for a Poisson problem on a 4x4x4 grid
// print matrix
return 0;
}

◆ poisson9pt()

template<typename MatrixType >
void cusp::gallery::poisson9pt ( MatrixType &  matrix,
const size_t  m,
const size_t  n 
)

poisson9pt: Create a matrix representing a 9pt Poisson problem discretized on an m by n grid with the standard 2D 9-point finite-difference stencil.

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
Template Parameters
MatrixTypematrix container
#include <cusp/print.h>
int main(void)
{
// create a matrix for a Poisson problem on a 4x4 grid
// print matrix
return 0;
}

◆ random()

template<typename MatrixType >
void cusp::gallery::random ( MatrixType &  matrix,
const size_t  m,
const size_t  n,
const size_t  num_samples 
)

random: Create a matrix with random connections

Parameters
matrixoutput
mnumber of grid rows
nnumber of grid columns
num_samplesnumber of random edges
Template Parameters
MatrixTypematrix container
#include <cusp/print.h>
int main(void)
{
// create a matrix for a Poisson problem on a 4x4 grid
cusp::gallery::random(A, 4, 4, 12);
// print matrix
return 0;
}
Random matrix generators.