ldlp

Purpose

Returns the Bunch-Kaufmann factorization of a real symmetric matrix along with a permutation vector.

Format

ldl_factor = ldlp(A)
Parameters:A (NxN matrix) – real symmetric data matrix
Returns:ldl_factor ((N+1)xN matrix) – contains the factors L and D as well as the permutation vector P, which can be passed directly to ldlsol() to solve a system of linear equations.

Examples

// Assign A matrix
A = { 5   9   3   4,
      9  -6   8   1,
      3   8   2   3,
      4   1   3   9 };

// Assign b matrix
b = { 1.4, 4, 0.5, 3 };

// Factorize matrix 'A'
ldl_f = ldlp(A);

// Solve system of equations
x = ldlsol(b, ldl_f);

The above code will solve the system of linear equations \(Ax = b\), assigning x to be equal to:

     0.5729
x = -0.1529
    -0.2829
     0.1900

Remarks

Matrix factorization is the most computationally intense part of solving a system of linear equations. The factorization can be saved and reused multiple times to prevent the need to repeat the matrix factorization step. ldlp() uses the LAPACK function dsytrf to compute the factorization.

See also

Functions ldlsol(), chol(), solpd()