template class xf::fintech::internal::Solver

#include "fd_solver.hpp"

Overview

Class to encapsulate the Finite Difference engine components.

template <
    typename DT,
    unsigned int M_SIZE,
    unsigned int LOG2_M_SIZE,
    unsigned int A_SIZE,
    unsigned int MEM_WIDTH,
    unsigned int DIM2_SIZE1 = 3,
    unsigned int DIM2_SIZE2 = 5
    >
class Solver

Methods

reorderS2V

void reorderS2V (
    const DT v_in [M_SIZE],
    DT v_out [M_SIZE],
    const unsigned int m1,
    const unsigned int m2
    )

Copy and reorder S ordered vector into V inner form.

Parameters:

v_in Vector representing array of size m1 x m2 flattened in S inner form
m1 Size of array [0..m1-1] in S direction
m2 Size of array [0..m2-1] in V direction
v_out Vector representing array of size m1 x m2 flattened in V inner form

reorderV2S

void reorderV2S (
    const DT v_in [M_SIZE],
    DT v_out [M_SIZE],
    const unsigned int m1,
    const unsigned int m2
    )

Copy and reorder V ordered vector into S inner form.

Parameters:

v_in Vector representing array of size m1 x m2 flattened in V inner form
m1 Size of array [0..m1] in S direction
m2 Size of array [0..m2] in V direction
v_out Vector representing array of size m1 x m2 flattened in S inner form

CopyVector

void CopyVector (
    const DT v_in [M_SIZE],
    DT v_out [M_SIZE]
    )

Utility function to copy a vector.

vectorAdd

void vectorAdd (
    const DT v_in0 [M_SIZE],
    const DT v_in1 [M_SIZE],
    DT v_out [M_SIZE]
    )

Utility function to add two vectors.

vectorSub

void vectorSub (
    const DT v_in0 [M_SIZE],
    const DT v_in1 [M_SIZE],
    DT v_out [M_SIZE]
    )

Utility function to subtract two vectors.

triDiagSovlerPCR

void triDiagSovlerPCR (
    DT X1 [M_SIZE][DIM2_SIZE1],
    DT rhs [M_SIZE],
    DT v_out [M_SIZE],
    const unsigned int m1,
    const unsigned int m2
    )

Wrapper to PCR tridiagonal solver.

Solves tridiagonal linear system

Parameters:

X1 M x 3 array holding lower/main/upper diagonals of X1 tridiagonal matrix
rhs Right hand side of linear system to be solved
m1 Size of array [0..m1-1] in S direction
m2 Size of array [0..m2-1] in V direction
v_out Solution vector representing array of size m1 x m2 flattened in V inner form

pendaDiagSovler

void pendaDiagSovler (
    DT A [M_SIZE][DIM2_SIZE2],
    DT rhs [M_SIZE],
    DT v_out [M_SIZE],
    bool precompute
    )

Solve pentadiagonal form linear system.

This is a highly serial algorithm and is the bottleneck in this solver Unfortunately due to the formulation used by In ‘T Hout & Foulon, the pentadiagonal array contains diagonals which are not fully populated. This causes the common parallel pentadiagonal systems to fail due to divide-by-zero errors or similar.

Parameters:

A M x 5 array holding lower/lower/main/upper/upper diagonals of X1 tridiagonal matrix
rhs Right hand side of linear system to be solved
precompute Flag to indicate the scaling factors should be computed
v_out Solution vector representing array of size m1 x m2 flattened in V inner form