MAGMA  2.3.0 Matrix Algebra for GPU and Multicore Architectures
laln2: Solve 2x2 system; used by trevc

## Functions

magma_int_t magma_dlaln2 (magma_int_t trans, magma_int_t na, magma_int_t nw, double smin, double ca, const double *A, magma_int_t lda, double d1, double d2, const double *B, magma_int_t ldb, double wr, double wi, double *X, magma_int_t ldx, double *scale, double *xnorm, magma_int_t *info)
DLALN2 solves a system of the form (ca A - w D) X = s B or (ca A**T - w D) X = s B with possible scaling ("s") and perturbation of A. More...

magma_int_t magma_slaln2 (magma_int_t trans, magma_int_t na, magma_int_t nw, float smin, float ca, const float *A, magma_int_t lda, float d1, float d2, const float *B, magma_int_t ldb, float wr, float wi, float *X, magma_int_t ldx, float *scale, float *xnorm, magma_int_t *info)
SLALN2 solves a system of the form (ca A - w D) X = s B or (ca A**T - w D) X = s B with possible scaling ("s") and perturbation of A. More...

## Function Documentation

 magma_int_t magma_dlaln2 ( magma_int_t trans, magma_int_t na, magma_int_t nw, double smin, double ca, const double * A, magma_int_t lda, double d1, double d2, const double * B, magma_int_t ldb, double wr, double wi, double * X, magma_int_t ldx, double * scale, double * xnorm, magma_int_t * info )

DLALN2 solves a system of the form (ca A - w D) X = s B or (ca A**T - w D) X = s B with possible scaling ("s") and perturbation of A.

(A**T means A-transpose.)

A is an NA x NA real matrix, ca is a real scalar, D is an NA x NA real diagonal matrix, w is a real or complex value, and X and B are NA x 1 matrices – real if w is real, complex if w is complex. NA may be 1 or 2.

If w is complex, X and B are represented as NA x 2 matrices, the first column of each being the real part and the second being the imaginary part.

"s" is a scaling factor (.LE. 1), computed by DLALN2, which is so chosen that X can be computed without overflow. X is further scaled if necessary to assure that norm(ca A - w D)*norm(X) is less than overflow.

If both singular values of (ca A - w D) are less than SMIN, SMIN*identity will be used instead of (ca A - w D). If only one singular value is less than SMIN, one element of (ca A - w D) will be perturbed enough to make the smallest singular value roughly SMIN. If both singular values are at least SMIN, (ca A - w D) will not be perturbed. In any case, the perturbation will be at most some small multiple of max( SMIN, ulp*norm(ca A - w D) ). The singular values are computed by infinity-norm approximations, and thus will only be correct to a factor of 2 or so.

Note: all input quantities are assumed to be smaller than overflow by a reasonable factor. (See BIGNUM.)

Parameters
 [in] trans LOGICAL = true (1): A**T will be used. = false (0): A will be used (not transposed.) [in] na INTEGER The size of the matrix A. It may (only) be 1 or 2. [in] nw INTEGER 1 if "w" is real, 2 if "w" is complex. It may only be 1 or 2. [in] smin DOUBLE PRECISION The desired lower bound on the singular values of A. This should be a safe distance away from underflow or overflow, say, between (underflow/machine precision) and (machine precision * overflow ). (See BIGNUM and ULP.) [in] ca DOUBLE PRECISION The coefficient c, which A is multiplied by. [in] A DOUBLE PRECISION array, dimension (LDA,NA) The NA x NA matrix A. [in] lda INTEGER The leading dimension of A. It must be at least NA. [in] d1 DOUBLE PRECISION The 1,1 element in the diagonal matrix D. [in] d2 DOUBLE PRECISION The 2,2 element in the diagonal matrix D. Not used if NW=1. [in] B DOUBLE PRECISION array, dimension (LDB,NW) The NA x NW matrix B (right-hand side). If NW=2 ("w" is complex), column 1 contains the real part of B and column 2 contains the imaginary part. [in] ldb INTEGER The leading dimension of B. It must be at least NA. [in] wr DOUBLE PRECISION The real part of the scalar "w". [in] wi DOUBLE PRECISION The imaginary part of the scalar "w". Not used if NW=1. [out] X DOUBLE PRECISION array, dimension (LDX,NW) The NA x NW matrix X (unknowns), as computed by DLALN2. If NW=2 ("w" is complex), on exit, column 1 will contain the real part of X and column 2 will contain the imaginary part. [in] ldx INTEGER The leading dimension of X. It must be at least NA. [out] scale DOUBLE PRECISION The scale factor that B must be multiplied by to insure that overflow does not occur when computing X. Thus, (ca A - w D) X will be SCALE*B, not B (ignoring perturbations of A.) It will be at most 1. [out] xnorm DOUBLE PRECISION The infinity-norm of X, when X is regarded as an NA x NW real matrix. [out] info INTEGER An error flag. It will be set to zero if no error occurs, a negative number if an argument is in error, or a positive number if ca A - w D had to be perturbed. The possible values are: = 0: No error occurred, and (ca A - w D) did not have to be perturbed. = 1: (ca A - w D) had to be perturbed to make its smallest (or only) singular value greater than SMIN. NOTE: In the interests of speed, this routine does not check the inputs for errors.
 magma_int_t magma_slaln2 ( magma_int_t trans, magma_int_t na, magma_int_t nw, float smin, float ca, const float * A, magma_int_t lda, float d1, float d2, const float * B, magma_int_t ldb, float wr, float wi, float * X, magma_int_t ldx, float * scale, float * xnorm, magma_int_t * info )

SLALN2 solves a system of the form (ca A - w D) X = s B or (ca A**T - w D) X = s B with possible scaling ("s") and perturbation of A.

(A**T means A-transpose.)

A is an NA x NA real matrix, ca is a real scalar, D is an NA x NA real diagonal matrix, w is a real or complex value, and X and B are NA x 1 matrices – real if w is real, complex if w is complex. NA may be 1 or 2.

If w is complex, X and B are represented as NA x 2 matrices, the first column of each being the real part and the second being the imaginary part.

"s" is a scaling factor (.LE. 1), computed by SLALN2, which is so chosen that X can be computed without overflow. X is further scaled if necessary to assure that norm(ca A - w D)*norm(X) is less than overflow.

If both singular values of (ca A - w D) are less than SMIN, SMIN*identity will be used instead of (ca A - w D). If only one singular value is less than SMIN, one element of (ca A - w D) will be perturbed enough to make the smallest singular value roughly SMIN. If both singular values are at least SMIN, (ca A - w D) will not be perturbed. In any case, the perturbation will be at most some small multiple of max( SMIN, ulp*norm(ca A - w D) ). The singular values are computed by infinity-norm approximations, and thus will only be correct to a factor of 2 or so.

Note: all input quantities are assumed to be smaller than overflow by a reasonable factor. (See BIGNUM.)

Parameters
 [in] trans LOGICAL = true (1): A**T will be used. = false (0): A will be used (not transposed.) [in] na INTEGER The size of the matrix A. It may (only) be 1 or 2. [in] nw INTEGER 1 if "w" is real, 2 if "w" is complex. It may only be 1 or 2. [in] smin REAL The desired lower bound on the singular values of A. This should be a safe distance away from underflow or overflow, say, between (underflow/machine precision) and (machine precision * overflow ). (See BIGNUM and ULP.) [in] ca REAL The coefficient c, which A is multiplied by. [in] A REAL array, dimension (LDA,NA) The NA x NA matrix A. [in] lda INTEGER The leading dimension of A. It must be at least NA. [in] d1 REAL The 1,1 element in the diagonal matrix D. [in] d2 REAL The 2,2 element in the diagonal matrix D. Not used if NW=1. [in] B REAL array, dimension (LDB,NW) The NA x NW matrix B (right-hand side). If NW=2 ("w" is complex), column 1 contains the real part of B and column 2 contains the imaginary part. [in] ldb INTEGER The leading dimension of B. It must be at least NA. [in] wr REAL The real part of the scalar "w". [in] wi REAL The imaginary part of the scalar "w". Not used if NW=1. [out] X REAL array, dimension (LDX,NW) The NA x NW matrix X (unknowns), as computed by SLALN2. If NW=2 ("w" is complex), on exit, column 1 will contain the real part of X and column 2 will contain the imaginary part. [in] ldx INTEGER The leading dimension of X. It must be at least NA. [out] scale REAL The scale factor that B must be multiplied by to insure that overflow does not occur when computing X. Thus, (ca A - w D) X will be SCALE*B, not B (ignoring perturbations of A.) It will be at most 1. [out] xnorm REAL The infinity-norm of X, when X is regarded as an NA x NW real matrix. [out] info INTEGER An error flag. It will be set to zero if no error occurs, a negative number if an argument is in error, or a positive number if ca A - w D had to be perturbed. The possible values are: = 0: No error occurred, and (ca A - w D) did not have to be perturbed. = 1: (ca A - w D) had to be perturbed to make its smallest (or only) singular value greater than SMIN. NOTE: In the interests of speed, this routine does not check the inputs for errors.