XLPack 7.0
XLPack Numerical Library (Excel Worksheet Functions) Reference Manual
Loading...
Searching...
No Matches

◆ WZgesv2()

Function WZgesv2 ( N As  Long,
A As  Variant,
B As  Variant,
Optional Nrhs As  Long = 1 
)

Solution to system of linear equations AX = B for a complex matrix (complex numbers in pairs of cells)

Purpose
WZgesv2 computes the solution to a real system of linear equations
A * X = B
where A is an N x N matrix and X and B are N x Nrhs matrices.

The LU decomposition with partial pivoting and row interchanges is used to factor A as
A = P * L * U
where P is a permutation matrix, L is unit lower triangular, and U is upper triangular. The factored form of A is then used to solve the system of equations A * X = B.

To represent complex numbers, a real part and an imaginary part are stored in a pair of adjacent cells (a real part in a left cell, and an imaginary part in a right cell). The computed results are stored in the same way.
Returns
N+1 x 2Nrhs
Column 1Column 2. . .Column 2Nrhs
Rows 1 to NSolution matrix X (a real part and an imaginary part are stored in a pair of adjacent columns (a real part is left and an imaginary part is right))
Row N+1Reciprocal condition numberReturn code. . .0

Return code.
= 0: Successful exit.
= i > 0: The i-th diagonal element of the factor is zero. (Matrix A is singular)
Parameters
[in]NNumber of linear equations, i.e., order of the matrix A. (N >= 1)
[in]A(N x 2N) N x N coefficient matrix A.
[in]B(N x 2Nrhs) N x Nrhs right hand side matrix B.
[in]Nrhs(Optional)
Number of columns of right hand side matrix B. (Nrhs >= 1) (default = 1)
Reference
LAPACK
Example
Solve the system of linear equations Ax = B and estimate the reciprocal of the condition number (RCond) of A, where
( 0.2-0.11i -0.93-0.32i 0.81+0.37i )
A = ( -0.8-0.92i -0.29+0.86i 0.64+0.51i )
( 0.71+0.59i -0.15+0.19i 0.2+0.94i )
( -0.5853-0.9457i )
B = ( -2.1697-1.0006i )
( 0.0116-0.5094i )

WZgesv2