LU_COMPLEX

The LU_COMPLEX function solves an n by n complex linear system Az = b using LU decomposition. The result is an n -element complex vector z . Alternatively, LU_COMPLEX computes the generalized inverse of an n by n complex array. The result is an n by n complex array.

This routine is written in the IDL language. Its source code can be found in the file lu_complex.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = LU_COMPLEX( A, B )

Arguments

A

An n by n complex array.

B

An n -element right-hand side vector (real or complex).

Keywords

DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

INVERSE

Set this keyword to compute the generalized inverse of A . If INVERSE is specified, the input argument B is ignored.

SPARSE

Set this keyword to convert the input array to row-indexed sparse storage format. Computations are done using the iterative biconjugate gradient method. This keyword is effective only when solving complex linear systems. This keyword has no effect when calculating the generalized inverse.

Example

Define a complex array A and right-side vector B :

A = [[COMPLEX(1, 0), COMPLEX(2,-2), COMPLEX(-3,1)], $

     [COMPLEX(1,-2), COMPLEX(2, 2), COMPLEX(1, 0)], $

     [COMPLEX(1, 1), COMPLEX(0, 1), COMPLEX(1, 5)]]

B = [COMPLEX(1, 1), COMPLEX(3,-2), COMPLEX(1,-2)]

Solve the complex linear system Az = b .

Z = LU_COMPLEX(A, B)

PRINT, Z

IDL prints:

( 0.552267, 1.22818)( -0.290371, -0.600974)

( -0.629824, -0.340952)

Compute the inverse of the complex array A by supplying a scalar for B (in this example -1).

inv = LU_COMPLEX(A, B, /INVERSE)

PRINT, inv

IDL prints:

( 0.261521, -0.0303485)( 0.0138629, 0.329337)

( -0.102660, -0.168602)

( 0.102660, 0.168602)( 0.0340952, -0.162982)

( 0.125890, -0.0633196)

( -0.0689397, 0.0108655)( -0.0666916, -0.0438366)

( 0.0614462, -0.161858)

See Also

CRAMER , CHOLSOL , GS_ITER , LUSOL , SVSOL , TRISOL , and Sparse Arrays .