**NAME**

im_lu_decomp, im_lu_solve - Solve SLEs by LU decomposition

**SYNOPSIS**

**#include** **<vips/vips.h>**
**DOUBLEMASK** ***im_lu_decomp(** **const** **DOUBLEMASK** __*mat__**,** **const** **char** __*name__ **);**
**int** **im_lu_solve(** **const** **DOUBLEMASK** __*lu__**,** **double** __*vec__ **);**

**DESCRIPTION**

**im_lu_decomp(3)** allocates a DOUBLEMASK representing the LU
decomposition of the matrix in DOUBLEMASK __*mat__, and gives it the
filename member __name__.
**im_lu_solve(3)** solves the system of linear equations (SLE) Ax=b, where
matrix A has already been decomposed into LU form in DOUBLEMASK __*lu__.
Input vector b is in __*vec__ and is overwritten with output vector x.
DOUBLEMASK __*lu__ is unaltered by **im_matinv(3)**, and can be used again to
solve a different SLE containing matrix A.

**NOTES**

The scale and offset members of __*mat__ are ignored. If they are not set
to 1.0 and zero respectively, you must first call **im_norm_dmask(3)**.
To understand the decomposition A=LU, see Press et al. (1992). For the
exact format used to represent the matrices L and U in __*lu__, see the
acompanying source code.

**ERRORS**

If matrix __*mat__ is singular (non-invertible), or close to singular then
**im_lu_decomp(3)** will fail, calling **im_error(3)**.

**RETURN** **VALUE**

**im_lu_decomp(3)** returns a pointer to the new DOUBLEMASK, or NULL on
error.
**im_lu_solve(3)** always returns zero, unless __lu__ was not returned by
**im_lu_decomp(3)**, when it returns -1.

**SEE ALSO**

im_create_dmask(3), im_free_dmask(3), im_norm_dmask(3), im_matinv(3)

**REFERENCES**

PRESS, W. et al, 1992. Numerical Recipies in C; The Art of Scientific
Computing, 2nd ed. Cambridge: Cambridge University Press, pp. 43-50.
[Available online: http://www.library.cornell.edu/nr/bookcpdf.html
accessed 2006-09-19]

**COPYRIGHT**

Copyright 2006, Tom Vajzovic.

**AUTHOR**

Tom Vajzovic
18 September 2006 IM_LU_DECOMP(3)