accelerInt  v0.1
Functions
exponential_linear_algebra.h File Reference

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

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

Go to the source code of this file.

Functions

static void matvec_m_by_m (const int m, const double *__restrict__ A, const double *__restrict__ V, double *__restrict__ Av)
 Matrix-vector multiplication of a matrix sized MxM and a vector Mx1. More...
 
static void matvec_m_by_m_plusequal (const int m, const double *__restrict__ A, const double *__restrict__ V, double *__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...
 
static void matvec_n_by_m_scale (const int m, const double scale, const double *__restrict__ A, const double *__restrict__ V, double *__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...
 
static void matvec_n_by_m_scale_special (const int m, const double *__restrict__ scale, const double *__restrict__ A, const double **__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...
 
static void matvec_n_by_m_scale_special2 (const int m, const double *__restrict__ scale, const double *__restrict__ A, const double **__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...
 
static void matvec_n_by_m_scale_add (const int m, const double scale, const double *__restrict__ A, const double *__restrict__ V, double *__restrict__ Av, const double *__restrict__ add)
 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...
 
static void matvec_n_by_m_scale_add_subtract (const int m, const double scale, const double *__restrict__ A, const double *__restrict__ 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...
 
static void scale (const double *__restrict__ y0, const double *__restrict__ y1, double *__restrict__ sc)
 Get scaling for weighted norm. More...
 
static void scale_init (const double *__restrict__ y0, double *__restrict__ sc)
 Get scaling for weighted norm for the initial timestep (used in krylov process) More...
 
static double sc_norm (const double *__restrict__ nums, const double *__restrict__ sc)
 Perform weighted norm. More...
 
static double two_norm (const double *__restrict__ v)
 Computes and returns the two norm of a vector. More...
 
static double normalize (const double *__restrict__ v, double *__restrict__ v_out)
 Normalize the input vector using a 2-norm. More...
 
static 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...
 
static void scale_subtract (const double s, const double *__restrict__ Vm, double *__restrict__ w)
 Subtracts Vm scaled by s from w. More...
 
static void scale_mult (const double s, const double *__restrict__ w, double *__restrict__ Vm)
 Sets Vm to s * w. More...
 

Detailed Description

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

Author
Nicholas Curtis
Date
03/09/2015

Definition in file exponential_linear_algebra.h.

Function Documentation

◆ dotproduct()

static double dotproduct ( const double *__restrict__  w,
const double *__restrict__  Vm 
)
inlinestatic

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 356 of file exponential_linear_algebra.h.

◆ matvec_m_by_m()

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

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 28 of file exponential_linear_algebra.h.

◆ matvec_m_by_m_plusequal()

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

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 54 of file exponential_linear_algebra.h.

◆ matvec_n_by_m_scale()

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

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 84 of file exponential_linear_algebra.h.

◆ matvec_n_by_m_scale_add()

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

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 193 of file exponential_linear_algebra.h.

◆ matvec_n_by_m_scale_add_subtract()

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

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 227 of file exponential_linear_algebra.h.

◆ matvec_n_by_m_scale_special()

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

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 118 of file exponential_linear_algebra.h.

◆ matvec_n_by_m_scale_special2()

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

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 158 of file exponential_linear_algebra.h.

◆ normalize()

static double normalize ( const double *__restrict__  v,
double *__restrict__  v_out 
)
inlinestatic

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 330 of file exponential_linear_algebra.h.

◆ sc_norm()

static double sc_norm ( const double *__restrict__  nums,
const double *__restrict__  sc 
)
inlinestatic

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 293 of file exponential_linear_algebra.h.

◆ scale()

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

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 258 of file exponential_linear_algebra.h.

◆ scale_init()

static void scale_init ( const double *__restrict__  y0,
double *__restrict__  sc 
)
inlinestatic

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 274 of file exponential_linear_algebra.h.

◆ scale_mult()

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

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 395 of file exponential_linear_algebra.h.

◆ scale_subtract()

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

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 376 of file exponential_linear_algebra.h.

◆ two_norm()

static double two_norm ( const double *__restrict__  v)
inlinestatic

Computes and returns the two norm of a vector.

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

Parameters
[in]vthe vector

Definition at line 311 of file exponential_linear_algebra.h.