The LA_TRIMPROVE function improves the solution to a system of linear equations with a tridiagonal array, *AX* = *B*, and provides optional error bounds and backward error estimates.

The LA_TRIMPROVE function may also be used to improve the solutions for multiple systems of linear equations, with each column of *B* representing a different set of equations. In this case, the result is a *k*-by-*n* array where each of the *k* columns represents the improved solution vector for that set of equations.

LA_TRIMPROVE is based on the following LAPACK routines:

Output Type |
LAPACK Routine |

Float |
sgtrfs |

Double |
dgtrfs |

Complex |
cgtrfs |

Double complex |
zgtrfs |

## Examples

Given the tridiagonal system of equations:

-4t + u = 6

2t - 4u + v = -8

2u - 4v + w = -5

2v -4w = 8

the solution can be found and improved by using the following program:

`; Define array a:`

aupper = [1, 1, 1]

adiag = [-4, -4, -4, -4]

alower = [2, 2, 2]

`; Define right-hand side vector b:`

b = [6, -8, -5, 8]

`; Decompose a:`

dlower = alower

darray = adiag

dupper = aupper

`LA_TRIDC, dlower, darray, dupper, u2, index`

`; Compute and improve the solution:`

`x = LA_TRISOL(dlower, darray, dupper, u2, index, b)`

`xnew = LA_TRIMPROVE(Alower, Adiag, Aupper, $`

dlower, darray, dupper, u2, index, b, x)

PRINT, 'LA_TRISOL improved solution:'

`PRINT, xnew`

IDL prints:

LA_TRISOL improved solution:

-1.00000 2.00000 2.00000 -1.00000

## Syntax

*Result* = LA_TRIMPROVE( *AL*, *A*, *AU*, *DAL*, *DA*, *DAU*, *DU2*, *Index*, *B*, *X* [, BACKWARD_ERROR=*variable*] [, /DOUBLE] [, FORWARD_ERROR=*variable*] )

## Return Value

The result is an *n*-element vector or *k*-by-*n* array.

## Arguments

### AL

A vector of length (*n* - 1) containing the subdiagonal elements of the original array.

### A

A vector of length *n *containing the main diagonal elements of the original array.

### AU

A vector of length (*n* - 1) containing the superdiagonal elements of the original array.

### DAL

The (*n* - 1) elements of the lower bidiagonal array, created by the LA_TRIDC procedure.

### DA

The *n* diagonal elements of the upper triangular array, created by the LA_TRIDC procedure.

### DAU

The (*n* - 1) superdiagonal elements of the upper triangular array, created by the LA_TRIDC procedure.

### DU2

The (*n* - 2) elements of the second superdiagonal of the upper triangular array, created by the LA_TRIDC procedure.

### Index

An input vector, created by the LA_TRIDC procedure, containing the row permutations which occurred as a result of partial pivoting.

### B

An *n*-element input vector containing the right-hand side of the linear system, or a *k*-by-*n* array, where each of the *k* columns represents a different linear system.

### X

An *n*-element input vector, or a *k*-by-*n* array, containing the approximate solutions to the linear system, created by the LA_TRISOL function.

## Keywords

### BACKWARD_ERROR

Set this keyword to a named variable that will contain the relative backward error estimate for each linear system. If *B* is a vector containing a single linear system, then BACKWARD_ERROR will be a scalar. If *B* is an array containing *k* linear systems, then BACKWARD_ERROR will be a *k*-element vector. The backward error is the smallest relative change in any element of *A* or *B* that makes *X* an exact solution.

### DOUBLE

Set this keyword to use double-precision for computations and to return a double-precision (real or complex) result. Set DOUBLE = 0 to use single-precision for computations and to return a single-precision (real or complex) result. The default is /DOUBLE if *AL *is double precision, otherwise the default is DOUBLE = 0.

### FORWARD_ERROR

Set this keyword to a named variable that will contain the estimated forward error bound for each linear system. If *B* is a vector containing a single linear system, then FORWARD_ERROR will be a scalar. If *B* is an array containing *k* linear systems, then FORWARD_ERROR will be a *k*-element vector. For each linear system, if *Xtrue* is the true solution corresponding to *X*, then the forward error is an estimated upper bound for the magnitude of the largest element in (*X* - *Xtrue*) divided by the magnitude of the largest element in *X*.

## Version History

5.6 |
Introduced |

## Resources and References

For details see Anderson et al., *LAPACK Users' Guide*, 3rd ed., SIAM, 1999.

## See Also

ï»¿

## Notes

This page has no user notes yet. Be the first one!