NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
numerical::ldl_decomposition< T > Class Template Reference

The symmetric indefinite factorisation of a symmetric or Hermitian matrix, as scipy.linalg.ldl: A = L D Lᴴ (Hermitian) or A = L D Lᵀ (symmetric), Bunch and Kaufman's diagonal pivoting (LAPACK's sytrf, hetrf: by panels of 64 columns from order 384, their trailing update one matrix product; the unblocked sytf2, hetf2 below it and for the last columns) on the lower triangle, or on the upper one (lower = false, L then upper triangular); D block diagonal with blocks of order 1 and 2; L with a unit diagonal once its rows are permuted (permutation), as SciPy returns them. More...

#include <ldl.hpp>

Public Member Functions

 ldl_decomposition (const matrix< T > &a, bool lower=true, bool hermitian=true)
 Factorises a, of which only the triangle lower names is read.
 
const matrix< T > & factor () const noexcept
 L, permuted (SciPy's lu): L[permutation()] is triangular with a unit diagonal.
 
const matrix< T > & d () const noexcept
 D, block diagonal (blocks of order 1 and 2).
 
const std::vector< std::size_t > & permutation () const noexcept
 The rows' order that makes factor triangular (SciPy's perm).
 

Private Member Functions

void shape (const buffer< T > &ldu, const std::vector< std::ptrdiff_t > &ipiv, bool lower, bool hermitian)
 L, D and the permutation from LAPACK's packed factors ldu and ipiv, as SciPy's _ldl_sanitize_ipiv, _ldl_get_d_and_l and _ldl_construct_tri_factor form them.
 

Private Attributes

std::size_t n_
 The order.
 
matrix< T > l_
 L, permuted.
 
matrix< T > d_
 D.
 
std::vector< std::size_t > permutation_
 The rows' order making L triangular.
 

Detailed Description

template<double_field T>
class numerical::ldl_decomposition< T >

The symmetric indefinite factorisation of a symmetric or Hermitian matrix, as scipy.linalg.ldl: A = L D Lᴴ (Hermitian) or A = L D Lᵀ (symmetric), Bunch and Kaufman's diagonal pivoting (LAPACK's sytrf, hetrf: by panels of 64 columns from order 384, their trailing update one matrix product; the unblocked sytf2, hetf2 below it and for the last columns) on the lower triangle, or on the upper one (lower = false, L then upper triangular); D block diagonal with blocks of order 1 and 2; L with a unit diagonal once its rows are permuted (permutation), as SciPy returns them.

Template Parameters
Tdouble or std::complex<double>.

Definition at line 548 of file ldl.hpp.

Constructor & Destructor Documentation

◆ ldl_decomposition()

template<double_field T>
numerical::ldl_decomposition< T >::ldl_decomposition ( const matrix< T > &  a,
bool  lower = true,
bool  hermitian = true 
)
inlineexplicit

Factorises a, of which only the triangle lower names is read.

Parameters
[in]aThe square matrix.
[in]lowerThe lower triangle (and a lower L), or the upper.
[in]hermitianFor a complex matrix, A = Aᴴ (the diagonal's imaginary parts ignored) or A = Aᵀ; a real one's either.
Exceptions
dimension_errorIf a is not square.
non_finite_errorIf an entry is infinite or NaN.

Definition at line 561 of file ldl.hpp.

Member Function Documentation

◆ d()

template<double_field T>
const matrix< T > & numerical::ldl_decomposition< T >::d ( ) const
inlinenoexcept

D, block diagonal (blocks of order 1 and 2).

Definition at line 599 of file ldl.hpp.

◆ factor()

template<double_field T>
const matrix< T > & numerical::ldl_decomposition< T >::factor ( ) const
inlinenoexcept

L, permuted (SciPy's lu): L[permutation()] is triangular with a unit diagonal.

Definition at line 593 of file ldl.hpp.

◆ permutation()

template<double_field T>
const std::vector< std::size_t > & numerical::ldl_decomposition< T >::permutation ( ) const
inlinenoexcept

The rows' order that makes factor triangular (SciPy's perm).

Definition at line 605 of file ldl.hpp.

◆ shape()

template<double_field T>
void numerical::ldl_decomposition< T >::shape ( const buffer< T > &  ldu,
const std::vector< std::ptrdiff_t > &  ipiv,
bool  lower,
bool  hermitian 
)
inlineprivate

L, D and the permutation from LAPACK's packed factors ldu and ipiv, as SciPy's _ldl_sanitize_ipiv, _ldl_get_d_and_l and _ldl_construct_tri_factor form them.

Definition at line 616 of file ldl.hpp.

Member Data Documentation

◆ d_

template<double_field T>
matrix<T> numerical::ldl_decomposition< T >::d_
private

D.

Definition at line 693 of file ldl.hpp.

◆ l_

template<double_field T>
matrix<T> numerical::ldl_decomposition< T >::l_
private

L, permuted.

Definition at line 692 of file ldl.hpp.

◆ n_

template<double_field T>
std::size_t numerical::ldl_decomposition< T >::n_
private

The order.

Definition at line 691 of file ldl.hpp.

◆ permutation_

template<double_field T>
std::vector<std::size_t> numerical::ldl_decomposition< T >::permutation_
private

The rows' order making L triangular.

Definition at line 694 of file ldl.hpp.


The documentation for this class was generated from the following file: