LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
lu.h File Reference

LU factorization with partial pivoting, templated on the number type. More...

#include <cstddef>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for lu.h:

Go to the source code of this file.

Classes

struct  line::pivot_mag< T >
 The ordered type the pivot search compares in. More...

Namespaces

namespace  line

Functions

template<class T>
std::vector< std::size_t > line::lu_factor (Matrix< T > &A)
 In-place LU of A (n x n).
template<class T>
void line::lu_solve (const Matrix< T > &LU, const std::vector< std::size_t > &piv, std::vector< T > &b)
 Solve LUx = Pb in place on b, using the factors from lu_factor.
template<class T>
line::lu_det (const Matrix< T > &A)
 Determinant of a square matrix, by the same partial-pivoting elimination.
template<class T>
std::vector< T > line::solve (const Matrix< T > &A, const std::vector< T > &b)
 Convenience: solve Ax = b, leaving A and b untouched.

Detailed Description

LU factorization with partial pivoting, templated on the number type.

Port of mp_pfqn's gmpla/mpq_ludcmp.c + mpq_lubksb.c, generalized from mpq_t to any field type and with the 1-based Numerical-Recipes indexing removed. In exact arithmetic pivoting is not needed for stability, only to avoid a zero pivot, but the same largest-magnitude rule is kept so that the exact and double paths take identical elimination orders and can be diffed.

Definition in file lu.h.