NcmLapack

NcmLapack — Encapsulated LAPACK functions.

Object Hierarchy

    GBoxed
    ╰── NcmLapackWS

Description

This object is dedicated to encapsulate functions from LAPACK choosing the most suitable backend.

Priority order: (1) LAPACK and (2) GSL. It no longer tries to use clapack or lapacke, it is faster and simpler to stick to fortran's lapack.

The description of each function follows its respective LAPACK documentation.

Functions

ncm_lapack_ws_new ()

NcmLapackWS *
ncm_lapack_ws_new (void);

Creates a new Lapack workspace object.

Returns

a newly created NcmLapackWS.

[transfer full]


ncm_lapack_ws_dup ()

NcmLapackWS *
ncm_lapack_ws_dup (NcmLapackWS *ws);

Duplicates a Lapack workspace object.

Parameters

ws

a NcmLapackWS

 

Returns

a copy of ws .

[transfer full]


ncm_lapack_ws_free ()

void
ncm_lapack_ws_free (NcmLapackWS *ws);

Frees a Lapack workspace object.

Parameters

ws

a NcmLapackWS

 

ncm_lapack_ws_clear ()

void
ncm_lapack_ws_clear (NcmLapackWS **ws);

Clears a Lapack workspace object.

Parameters

ws

a NcmLapackWS

 

ncm_lapack_dptsv ()

gint
ncm_lapack_dptsv (gdouble *d,
                  gdouble *e,
                  gdouble *b,
                  gdouble *x,
                  gint n);

This function computes the solution to a real system of linear equations $A*X = B$ (B = b ), where $A$ is an N-by-N (N = n ) symmetric positive definite tridiagonal matrix, and $X$ and $B$ are N-by-NRHS (NRHS = 1) matrices.

$A$ is factored as $A = L*D*L^T$, and the factored form of $A$ is then used to solve the system of equations.

Parameters

d

array of doubles with dimension n

 

e

array of doubles with dimension n -1

 

b

array of doubles with dimension n

 

x

array of doubles with dimension n

 

n

The order of the matrix $A$ (>= 0)

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: i, the leading minor of order i is not positive definite, and the solution has not been computed. The factorization has not been completed unless i = N.


ncm_lapack_dpotrf ()

gint
ncm_lapack_dpotrf (gchar uplo,
                   gint n,
                   gdouble *a,
                   gint lda);

This function computes the Cholesky factorization of a real symmetric positive definite matrix a .

The factorization has the form $A = U^T * U$, if uplo = 'U', or $A = L * L^T$, if uplo = 'L', where A = a , $U$ is an upper triangular matrix and $L$ is lower triangular.

Parameters

uplo

'U' upper triangle of a is stored; 'L' lower triangle of a is stored

 

n

The order of the matrix a , n >= 0

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1,n )

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: i, the leading minor of order i is not positive definite, and the factorization could not be completed.


ncm_lapack_dpotri ()

gint
ncm_lapack_dpotri (gchar uplo,
                   gint n,
                   gdouble *a,
                   gint lda);

This function computes the inverse of a real symmetric positive definite matrix a = A using the Cholesky factorization $A = U^T*U$ or $A = L*L^T$ computed by ncm_lapack_dpotrf().

Parameters

uplo

'U' upper triangle of a is stored; 'L' lower triangle of a is stored

 

n

The order of the matrix a , n >= 0

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1,n )

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dpotrs ()

gint
ncm_lapack_dpotrs (gchar uplo,
                   gint n,
                   gint nrhs,
                   gdouble *a,
                   gint lda,
                   gdouble *b,
                   gint ldb);

This function computes the solution of $A X = B$ for a real symmetric positive definite matrix a = A using the Cholesky factorization $A = U^T*U$ or $A = L*L^T$ already performed by ncm_lapack_dpotrf(). On entry b contain the vectors $B$ and on exit b contain the solutions if the return is 0.

Parameters

uplo

'U' upper triangle of a is stored; 'L' lower triangle of a is stored

 

n

The order of the matrix a , n >= 0

 

nrhs

Number of right-hand-side vectors to solve

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1, n )

 

b

array of doubles with dimension (n , ldb )

 

ldb

The leading dimension of the array b , ldb >= max (1, n )

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dposv ()

gint
ncm_lapack_dposv (gchar uplo,
                  gint n,
                  gint nrhs,
                  gdouble *a,
                  gint lda,
                  gdouble *b,
                  gint ldb);

This function computes the solution of $A X = B$ for a real symmetric positive definite matrix a = A using the Cholesky factorization $A = U^T*U$ or $A = L*L^T$. On entry b contain the vectors $B$ and on exit b contain the solutions if the return is 0.

Parameters

uplo

'U' upper triangle of a is stored; 'L' lower triangle of a is stored

 

n

The order of the matrix a , n >= 0

 

nrhs

Number of right-hand-side vectors to solve

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1, n )

 

b

array of doubles with dimension (n , ldb )

 

ldb

The leading dimension of the array b , ldb >= max (1, n )

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dsytrf ()

gint
ncm_lapack_dsytrf (gchar uplo,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gint *ipiv,
                   NcmLapackWS *ws);

This function computes the factorization of a real symmetric matrix a , using the Bunch-Kaufman diagonal pivoting method.

Parameters

uplo

'U' upper triangle of a is stored; 'L' lower triangle of a is stored

 

n

The order of the matrix a , n >= 0

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1, n )

 

ipiv

Information about decomposition swaps and blocks

 

ws

a NcmLapackWS

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dsytrs ()

gint
ncm_lapack_dsytrs (gchar uplo,
                   gint n,
                   gint nrhs,
                   gdouble *a,
                   gint lda,
                   gint *ipiv,
                   gdouble *b,
                   gint ldb);

This function computes the solution of $A X = B$ for a real symmetric positive definite matrix a = A using the Cholesky factorization $A = U^T*U$ or $A = L*L^T$ already performed by ncm_lapack_dpotrf(). On entry b contain the vectors $B$ and on exit b contain the solutions if the return is 0.

Parameters

uplo

'U' upper triangle of a is stored; 'L' lower triangle of a is stored

 

n

The order of the matrix a , n >= 0

 

nrhs

Number of right-hand-side vectors to solve

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1, n )

 

ipiv

Information about decomposition swaps and blocks

 

b

array of doubles with dimension (n , ldb )

 

ldb

The leading dimension of the array b , ldb >= max (1, n )

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dsytri ()

gint
ncm_lapack_dsytri (gchar uplo,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gint *ipiv,
                   NcmLapackWS *ws);

This function compute the inverse of a real symmetric indefinite matrix a using the factorization a = U*D*U**T or a = L*D*L**T computed by ncm_lapack_dsytrf().

Parameters

uplo

'U' upper triangle of a is stored; 'L' lower triangle of a is stored

 

n

The order of the matrix a , n >= 0

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1, n )

 

ipiv

Information about decomposition swaps and blocks

 

ws

a NcmLapackWS

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dsysvx ()

gint
ncm_lapack_dsysvx (gchar fact,
                   gchar uplo,
                   gint n,
                   gint nrhs,
                   gdouble *a,
                   gint lda,
                   gdouble *af,
                   gint ldaf,
                   gint *ipiv,
                   gdouble *b,
                   gint ldb,
                   gdouble *x,
                   gint ldx,
                   gdouble *rcond,
                   gdouble *ferr,
                   gdouble *berr,
                   gdouble *work,
                   gint lwork,
                   gint *iwork);

Purpose

DSYSVX uses the diagonal pivoting factorization to compute the solution to a real system of linear equations A * X = B, where A is an N-by-N symmetric matrix and X and B are N-by-NRHS matrices.

Error bounds on the solution and a condition estimate are also provided.


Description

The following steps are performed:

  1. If FACT = 'N', the diagonal pivoting method is used to factor A. The form of the factorization is - A = U * D * U**T, if UPLO = 'U', or

    • A = L * D * L**T, if UPLO = 'L', where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is symmetric and block diagonal with 1-by-1 and 2-by-2 diagonal blocks.

  2. If some D(i,i)=0, so that D is exactly singular, then the routine returns with INFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A. If the reciprocal of the condition number is less than machine precision, INFO = N+1 is returned as a warning, but the routine still goes on to solve for X and compute error bounds as described below.

  3. The system of equations is solved for X using the factored form of A.

  4. Iterative refinement is applied to improve the computed solution matrix and calculate error bounds and backward error estimates for it.

Parameters

fact

FACT is CHARACTER*1 Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored.

  • = 'F': On entry, AF and IPIV contain the factored form of A. If EQUED is not 'N', the matrix A has been equilibrated with scaling factors given by S. A, AF, and IPIV are not modified.

  • = 'N': The matrix A will be copied to AF and factored.

 

uplo

UPLO is CHARACTER*1

  • = 'U': Upper triangle of A is stored;

  • = 'L': Lower triangle of A is stored.

 

n

N is INTEGER The number of linear equations, i.e., the order of the matrix A. N >= 0.

 

nrhs

NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.

 

a

A is DOUBLE PRECISION array, dimension (LDA,N) The symmetric matrix A. If UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. If UPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced.

 

lda

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).

 

af

AF is DOUBLE PRECISION array, dimension (LDAF,N)

  • If FACT = 'F', then AF is an input argument and on entry contains the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U**T or A = L*D*L**T as computed by DSYTRF.

  • If FACT = 'N', then AF is an output argument and on exit returns the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U**T or A = L*D*L**T.

 

ldaf

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).

 

ipiv

IPIV is INTEGER array, dimension (N) If FACT = 'F', then IPIV is an input argument and on entry contains details of the interchanges and the block structure of D, as determined by DSYTRF. If IPIV(k) > 0, then rows and columns k and IPIV(k) were interchanged and D(k,k) is a 1-by-1 diagonal block. If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. If FACT = 'N', then IPIV is an output argument and on exit contains details of the interchanges and the block structure of D, as determined by DSYTRF.

 

b

B is DOUBLE PRECISION array, dimension (LDB,NRHS) On entry, the N-by-NRHS right hand side matrix B. On exit,

  • if EQUED = 'N', B is not modified;

  • if EQUED = 'Y', B is overwritten by diag(S)*B;

 

ldb

LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).

 

x

X is DOUBLE PRECISION array, dimension (LDX,NRHS) If INFO = 0, the N-by-NRHS solution matrix X to the original system of equations. Note that A and B are modified on exit if EQUED .ne. 'N', and the solution to the equilibrated system is inv(diag(S))*X.

 

ldx

LDX is INTEGER The leading dimension of the array X. LDX >= max(1,N).

 

rcond

RCOND is DOUBLE PRECISION Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill- conditioned.

 

ferr

FERR is DOUBLE PRECISION array, dimension (NRHS) The estimated forward error bound for each solution vector X(j) (the j-th column of the solution matrix X). If XTRUE is the true solution corresponding to X(j), FERR(j) is an estimated upper bound for the magnitude of the largest element in (X(j) - XTRUE) divided by the magnitude of the largest element in X(j). The estimate is as reliable as the estimate for RCOND, and is almost always a slight overestimate of the true error..

 

berr

BERR is DOUBLE PRECISION array, dimension (NRHS) Componentwise relative backward error. This is the componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).

 

work

WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.

 

lwork

LWORK is INTEGER The length of WORK. LWORK >= max(1,3*N), and for best performance, when FACT = 'N', LWORK >= max(1,3*N,N*NB), where NB is the optimal blocksize for DSYTRF. If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.

 

iwork

IWORK is INTEGER array, dimension (N)

 

Returns

INFO is INTEGER

  • = 0: successful exit

  • < 0: if INFO = -i, the i-th argument had an illegal value

  • > 0: if INFO = i, and i is

  • <= N: D(i,i) is exactly zero. The factorization has been completed but the factor D is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned.

  • = N+1: D is nonsingular, but RCOND is less than machine precision, meaning that the matrix is singular to working precision. Nevertheless, the solution and error bounds are computed because there are a number of situations where the computed solution can be more accurate than the value of RCOND would suggest.


ncm_lapack_dsysvxx ()

gint
ncm_lapack_dsysvxx (gchar fact,
                    gchar uplo,
                    gint n,
                    gint nrhs,
                    gdouble *a,
                    gint lda,
                    gdouble *af,
                    gint ldaf,
                    gint *ipiv,
                    gchar *equed,
                    gdouble *s,
                    gdouble *b,
                    gint ldb,
                    gdouble *x,
                    gint ldx,
                    gdouble *rcond,
                    gdouble *rpvgrw,
                    gdouble *berr,
                    const gint n_err_bnds,
                    gdouble *err_bnds_norm,
                    gdouble *err_bnds_comp,
                    const gint nparams,
                    gdouble *params,
                    gdouble *work,
                    gint *iwork);

Purpose

DSYSVXX uses the diagonal pivoting factorization to compute the solution to a double precision system of linear equations A * X = B, where A is an N-by-N symmetric matrix and X and B are N-by-NRHS matrices.

If requested, both normwise and maximum componentwise error bounds are returned. DSYSVXX will return a solution with a tiny guaranteed error (O(eps) where eps is the working machine precision) unless the matrix is very ill-conditioned, in which case a warning is returned. Relevant condition numbers also are calculated and returned.

DSYSVXX accepts user-provided factorizations and equilibration factors; see the definitions of the FACT and EQUED options. Solving with refinement and using a factorization from a previous DSYSVXX call will also produce a solution with either O(eps) errors or warnings, but we cannot make that claim for general user-provided factorizations and equilibration factors if they differ from what DSYSVXX would itself produce.


Description

The following steps are performed:

  1. If FACT = 'E', double precision scaling factors are computed to equilibrate the system:

    • diag(S)*A*diag(S) *inv(diag(S))*X = diag(S)*B Whether or not the system will be equilibrated depends on the scaling of the matrix A, but if equilibration is used, A is overwritten by diag(S)*A*diag(S) and B by diag(S)*B.

  2. If FACT = 'N' or 'E', the LU decomposition is used to factor the matrix A (after equilibration if FACT = 'E') as

    • A = U * D * U**T, if UPLO = 'U', or

    • A = L * D * L**T, if UPLO = 'L', where U (or L) is a product of permutation and unit upper (lower) triangular matrices, and D is symmetric and block diagonal with 1-by-1 and 2-by-2 diagonal blocks.

  3. If some D(i,i)=0, so that D is exactly singular, then the routine returns with INFO = i. Otherwise, the factored form of A is used to estimate the condition number of the matrix A (see argument RCOND). If the reciprocal of the condition number is less than machine precision, the routine still goes on to solve for X and compute error bounds as described below.

  4. The system of equations is solved for X using the factored form of A.

  5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero), the routine will use iterative refinement to try to get a small error and error bounds. Refinement calculates the residual to at least twice the working precision.

  6. If equilibration was used, the matrix X is premultiplied by diag(R) so that it solves the original system before equilibration.

Some optional parameters are bundled in the PARAMS array. These settings determine how refinement is performed, but often the defaults are acceptable. If the defaults are acceptable, users can pass NPARAMS = 0 which prevents the source code from accessing the PARAMS argument.

Parameters

fact

FACT is CHARACTER*1 Specifies whether or not the factored form of the matrix A is supplied on entry, and if not, whether the matrix A should be equilibrated before it is factored.

  • = 'F': On entry, AF and IPIV contain the factored form of A. If EQUED is not 'N', the matrix A has been equilibrated with scaling factors given by S. A, AF, and IPIV are not modified.

  • = 'N': The matrix A will be copied to AF and factored.

  • = 'E': The matrix A will be equilibrated if necessary, then copied to AF and factored.

 

uplo

UPLO is CHARACTER*1

  • = 'U': Upper triangle of A is stored;

  • = 'L': Lower triangle of A is stored.

 

n

N is INTEGER The number of linear equations, i.e., the order of the matrix A. N >= 0.

 

nrhs

NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.

 

a

A is DOUBLE PRECISION array, dimension (LDA,N) The symmetric matrix A. If UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. If UPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced. On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by diag(S)*A*diag(S).

 

lda

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).

 

af

AF is DOUBLE PRECISION array, dimension (LDAF,N)

  • If FACT = 'F', then AF is an input argument and on entry contains the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U**T or A = L*D*L**T as computed by DSYTRF.

  • If FACT = 'N', then AF is an output argument and on exit returns the block diagonal matrix D and the multipliers used to obtain the factor U or L from the factorization A = U*D*U**T or A = L*D*L**T.

 

ldaf

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).

 

ipiv

IPIV is INTEGER array, dimension (N) If FACT = 'F', then IPIV is an input argument and on entry contains details of the interchanges and the block structure of D, as determined by DSYTRF. If IPIV(k) > 0, then rows and columns k and IPIV(k) were interchanged and D(k,k) is a 1-by-1 diagonal block. If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. If FACT = 'N', then IPIV is an output argument and on exit contains details of the interchanges and the block structure of D, as determined by DSYTRF.

 

equed

EQUED is CHARACTER*1 Specifies the form of equilibration that was done.

  • = 'N': No equilibration (always true if FACT = 'N').

  • = 'Y': Both row and column equilibration, i.e., A has been replaced by diag(S) * A * diag(S). EQUED is an input argument if FACT = 'F'; otherwise, it is an output argument.

 

s

S is DOUBLE PRECISION array, dimension (N) The scale factors for A. If EQUED = 'Y', A is multiplied on the left and right by diag(S). S is an input argument if FACT = 'F'; otherwise, S is an output argument. If FACT = 'F' and EQUED = 'Y', each element of S must be positive. If S is output, each element of S is a power of the radix. If S is input, each element of S should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.

 

b

B is DOUBLE PRECISION array, dimension (LDB,NRHS) On entry, the N-by-NRHS right hand side matrix B. On exit,

  • if EQUED = 'N', B is not modified;

  • if EQUED = 'Y', B is overwritten by diag(S)*B;

 

ldb

LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).

 

x

X is DOUBLE PRECISION array, dimension (LDX,NRHS) If INFO = 0, the N-by-NRHS solution matrix X to the original system of equations. Note that A and B are modified on exit if EQUED .ne. 'N', and the solution to the equilibrated system is inv(diag(S))*X.

 

ldx

LDX is INTEGER The leading dimension of the array X. LDX >= max(1,N).

 

rcond

RCOND is DOUBLE PRECISION Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill- conditioned.

 

rpvgrw

RPVGRW is DOUBLE PRECISION Reciprocal pivot growth. On exit, this contains the reciprocal pivot growth factor norm(A)/norm(U). The "max absolute element" norm is used. If this is much less than 1, then the stability of the LU factorization of the (equilibrated) matrix A could be poor. This also means that the solution X, estimated condition numbers, and error bounds could be unreliable. If factorization fails with 0<INFO<=N, then this contains the reciprocal pivot growth factor for the leading INFO columns of A.

 

berr

BERR is DOUBLE PRECISION array, dimension (NRHS) Componentwise relative backward error. This is the componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).

 

n_err_bnds

N_ERR_BNDS is INTEGER Number of error bounds to return for each right hand side and each type (normwise or componentwise). See ERR_BNDS_NORM and ERR_BNDS_COMP below.

 

err_bnds_norm

ERR_BNDS_NORM is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows: Normwise relative error in the ith solution vector: max_j (abs(XTRUE(j,i) - X(j,i))) ------------------------------ max_j abs(X(j,i)) The array is indexed by the type of error information as described below. There currently are up to three pieces of information returned. The first index in ERR_BNDS_NORM(i,:) corresponds to the ith right-hand side. The second index in ERR_BNDS_NORM(:,err) contains the following three fields:

  • err = 1 "Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * dlamch('Epsilon').

  • err = 2 "Guaranteed" error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.

  • err = 3 Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is "guaranteed". These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1. See Lapack Working Note 165 for further details and extra cautions.

 

err_bnds_comp

ERR_BNDS_COMP is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) For each right-hand side, this array contains information about various error bounds and condition numbers corresponding to the componentwise relative error, which is defined as follows: Componentwise relative error in the ith solution vector: abs(XTRUE(j,i) - X(j,i)) max_j ---------------------- abs(X(j,i)) The array is indexed by the right-hand side i (on which the componentwise relative error depends), and the type of error information as described below. There currently are up to three pieces of information returned for each right-hand side. If componentwise accuracy is not requested (PARAMS(3) = 0.0), then ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most the first (:,N_ERR_BNDS) entries are returned. The first index in ERR_BNDS_COMP(i,:) corresponds to the ith right-hand side. The second index in ERR_BNDS_COMP(:,err) contains the following three fields:

  • err = 1 "Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * dlamch('Epsilon').

  • err = 2 "Guaranteed" error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n) * dlamch('Epsilon'). This error bound should only be trusted if the previous boolean is true.

  • err = 3 Reciprocal condition number: Estimated componentwise reciprocal condition number. Compared with the threshold sqrt(n) * dlamch('Epsilon') to determine if the error estimate is "guaranteed". These reciprocal condition numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current right-hand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1. See Lapack Working Note 165 for further details and extra cautions.

 

nparams

NPARAMS is INTEGER Specifies the number of parameters set in PARAMS. If .LE. 0, the PARAMS array is never referenced and default values are used.

 

params

PARAMS is DOUBLE PRECISION array, dimension (NPARAMS) Specifies algorithm parameters. If an entry is .LT. 0.0, then that entry will be filled with default value used for that parameter. Only positions up to NPARAMS are accessed; defaults are used for higher-numbered parameters.

  • PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative refinement or not. Default: 1.0D+0

    • = 0.0 : No refinement is performed, and no error bounds are computed.

    • = 1.0 : Use the extra-precise refinement algorithm. (other values are reserved for future use)

  • PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual computations allowed for refinement. Default: 10 Aggressive: Set to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy.

  • PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code will attempt to find a solution with small componentwise relative error in the double-precision algorithm. Positive is true, 0.0 is false. Default: 1.0 (attempt componentwise convergence)

 

work

WORK is DOUBLE PRECISION array, dimension (4*N)

 

iwork

IWORK is INTEGER array, dimension (N)

 

Returns

INFO is INTEGER

  • = 0: Successful exit. The solution to every right-hand side is guaranteed.

  • < 0: If INFO = -i, the i-th argument had an illegal value

  • > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned.

  • = N+J: The solution corresponding to the Jth right-hand side is not guaranteed. The solutions corresponding to other right- hand sides K with K > J may not be guaranteed as well, but only the first such right-hand side is reported. If a small componentwise error is not requested (PARAMS(3) = 0.0) then the Jth right-hand side is the first with a normwise error bound that is not guaranteed (the smallest J such that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) the Jth right-hand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0). See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information about all of the right-hand sides check ERR_BNDS_NORM or ERR_BNDS_COMP.


ncm_lapack_dsyevr ()

gint
ncm_lapack_dsyevr (gchar jobz,
                   gchar range,
                   gchar uplo,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gdouble vl,
                   gdouble vu,
                   gint il,
                   gint iu,
                   gdouble abstol,
                   gint *m,
                   gdouble *w,
                   gdouble *z,
                   gint ldz,
                   gint *isuppz,
                   NcmLapackWS *ws);

FIXME

Parameters

jobz

FIXME

 

range

FIXME

 

uplo

FIXME

 

n

FIXME

 

a

FIXME

 

lda

FIXME

 

vl

FIXME

 

vu

FIXME

 

il

FIXME

 

iu

FIXME

 

abstol

FIXME

 

m

FIXME

 

w

FIXME

 

z

FIXME

 

ldz

FIXME

 

isuppz

FIXME

 

ws

a NcmLapackWS

 

Returns

FIXME


ncm_lapack_dsyevd ()

gint
ncm_lapack_dsyevd (gchar jobz,
                   gchar uplo,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gdouble *w,
                   NcmLapackWS *ws);

FIXME

Parameters

jobz

FIXME

 

uplo

FIXME

 

n

FIXME

 

a

FIXME

 

lda

FIXME

 

w

FIXME

 

ws

a NcmLapackWS

 

Returns

FIXME


ncm_lapack_dgeev ()

gint
ncm_lapack_dgeev (gchar jobvl,
                  gchar jobvr,
                  gint n,
                  gdouble *a,
                  gint lda,
                  gdouble *wr,
                  gdouble *wi,
                  gdouble *vl,
                  gint ldvl,
                  gdouble *vr,
                  gint ldvr,
                  gdouble *work,
                  gint lwork);

This function computes the eigensystem for a real matrix a = A.

Calling this function with lwork == -1 computed the ideal lwork in work [0].

Parameters

jobvl

n left eigenvectors of a are not computed, 'V' left eigenvectors of a are computed

 

jobvr

n right eigenvectors of a are not computed, 'V' right eigenvectors of a are computed

 

n

The order of the matrix a , n >= 0

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1, n )

 

wr

contain the real part of the computed eigenvalues

 

wi

contain the imaginary part of the computed eigenvalues

 

vl

if jobvl = 'V', the left eigenvectors $u(j)$ are stored one after another in the rows of vl , in the same order as their eigenvalues

 

ldvl

the leading dimension of the array vl

 

vr

if jobvr = 'V', the left eigenvectors $v(j)$ are stored one after another in the rows of vr , in the same order as their eigenvalues

 

ldvr

the leading dimension of the array vr

 

work

work area, must have lwork allocated doubles

 

lwork

work area size

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dgeevx ()

gint
ncm_lapack_dgeevx (gchar balanc,
                   gchar jobvl,
                   gchar jobvr,
                   gchar sense,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gdouble *wr,
                   gdouble *wi,
                   gdouble *vl,
                   gint ldvl,
                   gdouble *vr,
                   gint ldvr,
                   gint *ilo,
                   gint *ihi,
                   gdouble *scale,
                   gdouble *abnrm,
                   gdouble *rconde,
                   gdouble *rcondv,
                   gdouble *work,
                   gint lwork,
                   gint *iwork);

This function computes the eigensystem for a real matrix a = A.

Calling this function with lwork == -1 computed the ideal lwork in work [0].

Parameters

balanc

FIXME

 

jobvl

n left eigenvectors of a are not computed, 'V' left eigenvectors of a are computed

 

jobvr

n right eigenvectors of a are not computed, 'V' right eigenvectors of a are computed

 

sense

FIXME

 

n

The order of the matrix a , n >= 0

 

a

array of doubles with dimension (n , lda )

 

lda

The leading dimension of the array a , lda >= max (1, n )

 

wr

contain the real part of the computed eigenvalues

 

wi

contain the imaginary part of the computed eigenvalues

 

vl

if jobvl = 'V', the left eigenvectors $u(j)$ are stored one after another in the rows of vl , in the same order as their eigenvalues

 

ldvl

the leading dimension of the array vl

 

vr

if jobvr = 'V', the left eigenvectors $v(j)$ are stored one after another in the rows of vr , in the same order as their eigenvalues

 

ldvr

the leading dimension of the array vr

 

ilo

FIXME

 

ihi

FIXME

 

scale

FIXME

 

abnrm

FIXME

 

rconde

FIXME

 

rcondv

FIXME

 

work

work area, must have lwork allocated doubles

 

lwork

work area size

 

iwork

FIXME

 

Returns

i = 0: successful exit

< 0: -i, the i-th argument had an illegal value

> 0: the (i,i) element of the factor U or L is zero, and the inverse could not be computed.


ncm_lapack_dgeqrf ()

gint
ncm_lapack_dgeqrf (gint m,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gdouble *tau,
                   NcmLapackWS *ws);

DGEQRF computes a QR factorization of a real M-by-N matrix A: A = Q * R.

Parameters

m

M is INTEGER The number of rows of the matrix A. M >= 0.

 

n

N is INTEGER The number of columns of the matrix A. N >= 0.

 

a

A is DOUBLE PRECISION array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).

 

lda

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).

 

tau

TAU is DOUBLE PRECISION array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).

 

ws

a NcmLapackWS

 

Returns

= 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value


ncm_lapack_dgerqf ()

gint
ncm_lapack_dgerqf (gint m,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gdouble *tau,
                   NcmLapackWS *ws);

DGERQF computes a RQ factorization of a real M-by-N matrix A: A = R * Q.

Parameters

m

M is INTEGER The number of rows of the matrix A. M >= 0.

 

n

N is INTEGER The number of columns of the matrix A. N >= 0.

 

a

A is DOUBLE PRECISION array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).

 

lda

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).

 

tau

TAU is DOUBLE PRECISION array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).

 

ws

a NcmLapackWS

 

Returns

= 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value


ncm_lapack_dgeqlf ()

gint
ncm_lapack_dgeqlf (gint m,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gdouble *tau,
                   NcmLapackWS *ws);

DGEQLF computes a QL factorization of a real M-by-N matrix A: A = Q * L.

Parameters

m

M is INTEGER The number of rows of the matrix A. M >= 0.

 

n

N is INTEGER The number of columns of the matrix A. N >= 0.

 

a

A is DOUBLE PRECISION array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).

 

lda

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).

 

tau

TAU is DOUBLE PRECISION array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).

 

ws

a NcmLapackWS

 

Returns

= 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value


ncm_lapack_dgelqf ()

gint
ncm_lapack_dgelqf (gint m,
                   gint n,
                   gdouble *a,
                   gint lda,
                   gdouble *tau,
                   NcmLapackWS *ws);

DGELQF computes a LQ factorization of a real M-by-N matrix A: A = L * Q.

Parameters

m

M is INTEGER The number of rows of the matrix A. M >= 0.

 

n

N is INTEGER The number of columns of the matrix A. N >= 0.

 

a

A is DOUBLE PRECISION array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).

 

lda

LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).

 

tau

TAU is DOUBLE PRECISION array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).

 

ws

a NcmLapackWS

 

Returns

= 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value


ncm_lapack_dggglm_alloc ()

GArray *
ncm_lapack_dggglm_alloc (NcmMatrix *L,
                         NcmMatrix *X,
                         NcmVector *p,
                         NcmVector *d,
                         NcmVector *y);

Calculates and allocs memory to solve the system determined by the parameters.

This function is expect the matrix X and L to be row-major.

Parameters

L

a NcmMatrix

 

X

a NcmMatrix

 

p

a NcmVector

 

d

a NcmVector

 

y

a NcmVector

 

Returns

the newly allocated workspace.

[transfer full][array][element-type double]


ncm_lapack_dggglm_run ()

gint
ncm_lapack_dggglm_run (GArray *ws,
                       NcmMatrix *L,
                       NcmMatrix *X,
                       NcmVector *p,
                       NcmVector *d,
                       NcmVector *y);

Runs the dggglm function using the workspace ws .

This function is expect the matrix X and L to be row-major.

Parameters

ws

a workspace.

[in][array][element-type double]

L

a NcmMatrix

 

X

a NcmMatrix

 

p

a NcmVector

 

d

a NcmVector

 

y

a NcmVector

 

NCM_LAPACK_CHECK_INFO()

#define NCM_LAPACK_CHECK_INFO(func,info) G_STMT_START { if ((info) != 0) g_error ("# NcmLapack[%s] error %4d", func, (info)); } G_STMT_END 

Types and Values