Table of Contents

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


Table of Contents