---
name: "im_lu_decomp"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.20.7-1+b3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/im_lu_decomp"
---

# im\_lu\_decomp(3)

Solve SLEs by LU decomposition

## 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)](/im_lu_decomp/3.md)** allocates a DOUBLEMASK representing the LU decomposition of the matrix in  DOUBLEMASK  *\*mat*,  and gives it the filename member *name*.

**[im\_lu\_solve(3)](/im_lu_solve/3.md)** 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)](/im_matinv/3.md)**, 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)](/im_norm_dmask/3.md)**.

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)](/im_lu_decomp/3.md)** will fail, calling **[im\_error(3)](/im_error/3.md)**.

## RETURN VALUE

**[im\_lu\_decomp(3)](/im_lu_decomp/3.md)** returns a pointer to the new DOUBLEMASK, or NULL on error.

**[im\_lu\_solve(3)](/im_lu_solve/3.md)** always returns zero, unless  *lu* was not returned by  **[im\_lu\_decomp(3)](/im_lu_decomp/3.md)**, when it returns -1.

## SEE ALSO

[im\_create\_dmask(3)](/im_create_dmask/3.md), [im\_free\_dmask(3)](/im_free_dmask/3.md), [im\_norm\_dmask(3)](/im_norm_dmask/3.md), [im\_matinv(3)](/im_matinv/3.md)

## 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
