Contents

class

SushiDSP::dk::DenseLu

template <std::size_t N>

Factorises a dense N x N system by LU with partial pivoting, in fixed storage.

Declared in
include/SushiDSP/math/dk/DenseLu.hpp

factorise() and solve() allocate nothing, and the factors persist after factorise(), so one factorisation serves several right-hand sides. The size-aware overloads work on the leading order x order block of a compile-time-maximum array (include/SushiDSP/README.md).

Template parameters

N

System dimension.

Static public attributes

static constexpr double kMinimumPivot = 1e-300

Smallest pivot magnitude accepted as non-singular.

Public member functions

bool factorise(const std::array< std::array< double, N >, N > &matrix)

Factorises the matrix into the internal L/U storage.

Parameters

matrix

The system matrix; not modified.

Returns

False when a pivot is numerically zero; solve() must not be called after that.

bool factorise(const std::array< std::array< double, N >, N > &matrix, std::size_t order)

Factorises only the leading order x order block of the matrix.

Parameters

matrix

The system matrix; only its leading block is read, and it is not modified.

order

Active dimension, at most N. An order of zero always succeeds.

Returns

False when a pivot is numerically zero; solve() must not be called after that.

void solve(const std::array< double, N > &right_hand_side, std::array< double, N > &solution) const

Solves A x = b using the factors from the last successful factorise().

Parameters

right_hand_side

b.

solution

x, overwritten.

void solve(const std::array< double, N > &right_hand_side, std::array< double, N > &solution, std::size_t order) const

Solves the leading order x order block using the factors from the last successful factorise() of the same order.

Parameters

right_hand_side

b; only its leading order entries are read.

solution

x; only its leading order entries are written.

order

Active dimension, at most N and matching the last factorise().