Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
Functions
Gallery

Collection of example matrices. More...

Functions

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

Function Documentation

template<typename Method , typename MatrixType >
void cusp::gallery::diffusion ( MatrixType &  matrix,
size_t  m,
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
template<typename MatrixType >
void cusp::gallery::grid2d ( MatrixType &  matrix,
size_t  m,
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;
}
template<typename MatrixType >
void cusp::gallery::grid3d ( MatrixType &  matrix,
size_t  m,
size_t  n,
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;
}
template<typename MatrixType >
void cusp::gallery::poisson27pt ( MatrixType &  matrix,
size_t  m,
size_t  n,
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;
}
template<typename MatrixType >
void cusp::gallery::poisson5pt ( MatrixType &  matrix,
size_t  m,
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;
}
Examples:
ainv.cu, bicgstab.cu, cg.cu, cg_m.cu, cr.cu, gmres.cu, maximal_independent_set.cu, monitor.cu, poisson.cu, smoothed_aggregation.cu, and verbose_monitor.cu.
template<typename MatrixType >
void cusp::gallery::poisson7pt ( MatrixType &  matrix,
size_t  m,
size_t  n,
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;
}
template<typename MatrixType >
void cusp::gallery::poisson9pt ( MatrixType &  matrix,
size_t  m,
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;
}
template<typename MatrixType >
void cusp::gallery::random ( MatrixType &  matrix,
size_t  m,
size_t  n,
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;
}