accelerInt  v0.1
Macros | Functions
exponential_linear_algebra.cuh File Reference

Definitions of various linear algebra functions needed in the exponential integrators. More...

#include "header.cuh"
#include "solver_options.cuh"
#include "solver_props.cuh"
Include dependency graph for exponential_linear_algebra.cuh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EXPONENTIAL_LINEAR_ALGEBRA_CUH
 

Functions

__device__ void matvec_m_by_m (const int m, const double *const __restrict__ A, const double *const __restrict__ V, double *const __restrict__ Av)
 Matrix-vector multiplication of a matrix sized MxM and a vector Mx1. More...
 
__device__ void matvec_m_by_m_plusequal (const int m, const double *const __restrict__ A, const double *const __restrict__ V, double *const __restrict__ Av)
 Matrix-vector plus equals for a matrix of size MxM and vector of size Mx1. That is, it returns (A + I) * v. More...
 
__device__ void matvec_n_by_m_scale (const int m, const double scale, const double *const __restrict__ A, const double *const __restrict__ V, double *const __restrict__ Av)
 Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor That is, it returns A * v * scale. More...
 
__device__ void matvec_n_by_m_scale_special (const int m, const double *__restrict__ scale, const double *__restrict__ A, double *const __restrict__ *V, double *__restrict__ *Av)
 Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor. More...
 
__device__ void matvec_n_by_m_scale_special2 (const int m, const double *__restrict__ scale, const double *__restrict__ A, double *const __restrict__ *V, double *__restrict__ *Av)
 Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor. More...
 
__device__ void matvec_n_by_m_scale_add (const int m, const double scale, const double *__restrict__ add, const double *__restrict__ A, double *__restrict__ V, const double *__restrict__ Av)
 Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor and added to another vector. More...
 
__device__ void matvec_n_by_m_scale_add_subtract (const int m, const double scale, const double *__restrict__ A, const double *V, double *__restrict__ Av, const double *__restrict__ add, const double *__restrict__ sub)
 Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor and adds and subtracts the specified vectors note, the addition is twice the specified vector. More...
 
__device__ void scale (const double *__restrict__ y0, const double *__restrict__ y1, double *__restrict__ sc)
 Get scaling for weighted norm. More...
 
__device__ void scale_init (const double *__restrict__ y0, double *__restrict__ sc)
 Get scaling for weighted norm for the initial timestep (used in krylov process) More...
 
__device__ double sc_norm (const double *__restrict__ nums, const double *__restrict__ sc)
 Perform weighted norm. More...
 
__device__ double two_norm (const double *__restrict__ v)
 Computes and returns the two norm of a vector. More...
 
__device__ double normalize (const double *__restrict__ v, double *__restrict__ v_out)
 Normalize the input vector using a 2-norm. More...
 
__device__ double dotproduct (const double *__restrict__ w, const double *__restrict__ Vm)
 Performs the dot product of the w (NSP x 1) vector with the given subspace vector (NSP x 1) More...
 
__device__ void scale_subtract (const double s, const double *__restrict__ Vm, double *__restrict__ w)
 Subtracts Vm scaled by s from w. More...
 
__device__ void scale_mult (const double s, const double *__restrict__ w, double *__restrict__ Vm)
 Sets Vm to s * w. More...
 

Detailed Description

Definitions of various linear algebra functions needed in the exponential integrators.

Author
Nicholas Curtis
Date
03/09/2015

Definition in file exponential_linear_algebra.cuh.

Macro Definition Documentation

◆ EXPONENTIAL_LINEAR_ALGEBRA_CUH

#define EXPONENTIAL_LINEAR_ALGEBRA_CUH

Definition at line 11 of file exponential_linear_algebra.cuh.

Function Documentation

◆ dotproduct()

__device__ double dotproduct ( const double *__restrict__  w,
const double *__restrict__  Vm 
)

Performs the dot product of the w (NSP x 1) vector with the given subspace vector (NSP x 1)

returns \(Vm \dot w\)

Parameters
[in]wthe vector with with to dot
[in]Vmthe subspace vector
Returns
sum - the dot product of the specified vectors

Definition at line 217 of file exponential_linear_algebra.cu.

◆ matvec_m_by_m()

__device__ void matvec_m_by_m ( const int  m,
const double *const __restrict__  A,
const double *const __restrict__  V,
double *const __restrict__  Av 
)

Matrix-vector multiplication of a matrix sized MxM and a vector Mx1.

Parameters
[in]msize of the matrix
[in]Amatrix of size MxM
[in]Vvector of size Mx1
[out]Avvector that is A * v

Definition at line 15 of file exponential_linear_algebra.cu.

◆ matvec_m_by_m_plusequal()

__device__ void matvec_m_by_m_plusequal ( const int  m,
const double *const __restrict__  A,
const double *const __restrict__  V,
double *const __restrict__  Av 
)

Matrix-vector plus equals for a matrix of size MxM and vector of size Mx1. That is, it returns (A + I) * v.

Parameters
[in]msize of the matrix
[in]Amatrix of size MxM
[in]Vvector of size Mx1
[out]Avvector that is (A + I) * v

Definition at line 31 of file exponential_linear_algebra.cu.

◆ matvec_n_by_m_scale()

__device__ void matvec_n_by_m_scale ( const int  m,
const double  scale,
const double *const __restrict__  A,
const double *const __restrict__  V,
double *const __restrict__  Av 
)

Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor That is, it returns A * v * scale.

Parameters
[in]msize of the matrix
[in]scalea number to scale the multplication by
[in]Amatrix
[in]Vthe vector
[out]Avvector that is A * V * scale

Definition at line 48 of file exponential_linear_algebra.cu.

◆ matvec_n_by_m_scale_add()

__device__ void matvec_n_by_m_scale_add ( const int  m,
const double  scale,
const double *__restrict__  add,
const double *__restrict__  A,
double *__restrict__  V,
const double *__restrict__  Av 
)

Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor and added to another vector.

Computes \(A * V * scale + add\)

Parameters
[in]msize of the matrix
[in]scalea number to scale the multplication by
[in]addthe vector to add to the result
[in]Amatrix
[in]Vthe vector
[out]Avvector that is A * V * scale + add

Definition at line 114 of file exponential_linear_algebra.cu.

◆ matvec_n_by_m_scale_add_subtract()

__device__ void matvec_n_by_m_scale_add_subtract ( const int  m,
const double  scale,
const double *__restrict__  A,
const double *  V,
double *__restrict__  Av,
const double *__restrict__  add,
const double *__restrict__  sub 
)

Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor and adds and subtracts the specified vectors note, the addition is twice the specified vector.

Computes \(scale * A * V + 2 * add - sub\)

Parameters
[in]msize of the matrix
[in]scalea number to scale the multplication by
[in]Amatrix
[in]Vthe vector
[out]Avvector that is scale * A * V + 2 * add - sub
[in]addthe vector to add to the result
[in]subthe vector to subtract from the result

Definition at line 134 of file exponential_linear_algebra.cu.

◆ matvec_n_by_m_scale_special()

__device__ void matvec_n_by_m_scale_special ( const int  m,
const double *__restrict__  scale,
const double *__restrict__  A,
double *const __restrict__ *  V,
double *__restrict__ *  Av 
)

Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor.

Computes the following: \(Av1 = A * V1 * scale[0]\), \(Av2 = A * V2 * scale[1]\), and \(Av3 = A * V3 * scale[2] + V4 + V5\)

Parameters
[in]msize of the matrix
[in]scalea list of numbers to scale the multplication by
[in]Amatrix
[in]Va list of 5 pointers corresponding to V1, V2, V3, V4, V5
[out]Ava list of 3 pointers corresponding to Av1, Av2, Av3

Definition at line 67 of file exponential_linear_algebra.cu.

◆ matvec_n_by_m_scale_special2()

__device__ void matvec_n_by_m_scale_special2 ( const int  m,
const double *__restrict__  scale,
const double *__restrict__  A,
double *const __restrict__ *  V,
double *__restrict__ *  Av 
)

Matrix-vector multiplication of a matrix sized NSPxM and a vector of size Mx1 scaled by a specified factor.

Computes the following: \(Av1 = A * V1 * scale[0]\) and: \(Av2 = A * V2 * scale[1]\)

Performs inline matrix-vector multiplication (with unrolled loops)

Parameters
[in]msize of the matrix
[in]scalea list of numbers to scale the multplication by
[in]Amatrix
[in]Va list of 2 pointers corresponding to V1, V2
[out]Ava list of 2 pointers corresponding to Av1, Av2

Definition at line 92 of file exponential_linear_algebra.cu.

◆ normalize()

__device__ double normalize ( const double *__restrict__  v,
double *__restrict__  v_out 
)

Normalize the input vector using a 2-norm.

\(v_{out} = \frac{v}{\left| v \right|}_2\)

Parameters
[in]vvector to be normalized
[out]v_outwhere to stick the normalized part of v (in a column)

Definition at line 199 of file exponential_linear_algebra.cu.

◆ sc_norm()

__device__ double sc_norm ( const double *__restrict__  nums,
const double *__restrict__  sc 
)

Perform weighted norm.

Computes \(\left| nums * sc\right|_2\)

Parameters
[in]numsvalues to be normed
[in]scscaling array for norm
Returns
norm weighted norm

Definition at line 176 of file exponential_linear_algebra.cu.

◆ scale()

__device__ void scale ( const double *__restrict__  y0,
const double *__restrict__  y1,
double *__restrict__  sc 
)

Get scaling for weighted norm.

Computes \(\frac{1.0}{ATOL + \max\left(\left|y0\right|, \left|y1\right|) * RTOL\right)}\)

Parameters
[in]y0values at current timestep
[in]y1values at next timestep
[out]scarray of scaling values

Definition at line 156 of file exponential_linear_algebra.cu.

◆ scale_init()

__device__ void scale_init ( const double *__restrict__  y0,
double *__restrict__  sc 
)

Get scaling for weighted norm for the initial timestep (used in krylov process)

Parameters
[in]y0values at current timestep
[out]scarray of scaling values

Definition at line 166 of file exponential_linear_algebra.cu.

◆ scale_mult()

__device__ void scale_mult ( const double  s,
const double *__restrict__  w,
double *__restrict__  Vm 
)

Sets Vm to s * w.

\(Vm = s * w\)

Parameters
[in]sthe scale multiplier to use
[in]wthe vector to use as a base
[out]Vmthe subspace matrix to set

Definition at line 237 of file exponential_linear_algebra.cu.

◆ scale_subtract()

__device__ void scale_subtract ( const double  s,
const double *__restrict__  Vm,
double *__restrict__  w 
)

Subtracts Vm scaled by s from w.

\( w -= Vm * s\)

Parameters
[in]sthe scale multiplier to use
[in]Vmthe subspace matrix
[out]wthe vector to subtract from

Definition at line 228 of file exponential_linear_algebra.cu.

◆ two_norm()

__device__ double two_norm ( const double *__restrict__  v)

Computes and returns the two norm of a vector.

Computes \(\sqrt{\sum{v^2}}\)

Parameters
[in]vthe vector

Definition at line 188 of file exponential_linear_algebra.cu.