nag_real_lu (f03afc) (PDF version)
f03 Chapter Contents
f03 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_real_lu (f03afc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_real_lu (f03afc) computes an LU  factorization of a real matrix, with partial pivoting, and evaluates the determinant.

2  Specification

#include <nag.h>
#include <nagf03.h>
void  nag_real_lu (Integer n, double a[], Integer tda, Integer pivot[], double *detf, Integer *dete, NagError *fail)

3  Description

nag_real_lu (f03afc) computes an LU  factorization of a real matrix A  with partial pivoting: PA = LU , where P  is a permutation matrix, L  is lower triangular and U  is unit upper triangular. The determinant of A  is the product of the diagonal elements of L  with the correct sign determined by the row interchanges.

4  References

Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

5  Arguments

1:     nIntegerInput
On entry: n , the order of the matrix A .
Constraint: n1 .
2:     a[n×tda]doubleInput/Output
Note: the i,jth element of the matrix A is stored in a[i-1×tda+j-1].
On entry: the n  by n  matrix A .
On exit: A  is overwritten by the lower triangular matrix L  and the off-diagonal elements of the upper triangular matrix U . The unit diagonal elements of U  are not stored.
3:     tdaIntegerInput
On entry: the stride separating matrix column elements in the array a.
Constraint: tdan .
4:     pivot[n]IntegerOutput
On exit: pivot[i-1]  gives the row index of the i th pivot.
5:     detfdouble *Output
6:     deteInteger *Output
On exit: the determinant of A  is given by detf × 2.0 dete . It is given in this form to avoid overflow or underflow.
7:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_2_INT_ARG_LT
On entry, tda=value  while n=value . The arguments must satisfy tdan .
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_INT_ARG_LT
On entry, n=value.
Constraint: n1.
NE_SINGULAR
The matrix A  is singular, possibly due to rounding errors. The factorization could not be completed. detf and dete are set to zero.

7  Accuracy

The accuracy of the determinant depends on the conditioning of the original matrix. For a detailed error analysis, see Wilkinson and Reinsch (1971).

8  Parallelism and Performance

Not applicable.

9  Further Comments

The time taken by nag_real_lu (f03afc) is approximately proportional to n 3 .

10  Example

To compute the LU  factorization with partial pivoting, and calculate the determinant, of the real matrix
33 16 72 -24 -10 -57 -8 -4 -17 .

10.1  Program Text

Program Text (f03afce.c)

10.2  Program Data

Program Data (f03afce.d)

10.3  Program Results

Program Results (f03afce.r)


nag_real_lu (f03afc) (PDF version)
f03 Chapter Contents
f03 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014