library.linsys Submodule

Module Summary

Interfaces for the NAG Mark 27.0 linsys Chapter.

linsys - Simultaneous Linear Equations

This module is concerned with the solution of the matrix equation , where may be a single vector or a matrix of multiple right-hand sides. The matrix may be real, complex, symmetric, Hermitian, positive definite, positive definite Toeplitz or banded. It may also be rectangular, in which case a least squares solution is obtained.

Much of the functionality of this module has been superseded by functions from submodule lapacklin and submodule lapackeig (LAPACK routines) as those modules have grown and have included driver and expert driver functions.

For a general introduction to sparse systems of equations, see the F11 Introduction, which provides functions for large sparse systems. Some functions for sparse problems are also included in this module; they are described in Sparse Matrix Functions.

Functionality Index

Black Box functions,

complex general band matrix: complex_band_solve()

complex general matrix: complex_square_solve()

complex general tridiagonal matrix: complex_tridiag_solve()

complex Hermitian matrix

packed matrix format: complex_herm_packed_solve()

standard matrix format: complex_herm_solve()

complex Hermitian positive definite band matrix: complex_posdef_band_solve()

complex Hermitian positive definite matrix

packed matrix format: complex_posdef_packed_solve()

standard matrix format: complex_posdef_solve()

complex Hermitian positive definite tridiagonal matrix: complex_posdef_tridiag_solve()

complex symmetric matrix

packed matrix format: complex_symm_packed_solve()

standard matrix format: complex_symm_solve()

real general band matrix: real_band_solve()

real general matrix

multiple right-hand sides, standard precision: real_square_solve()

real general tridiagonal matrix: real_tridiag_solve()

real symmetric matrix

packed matrix format: real_symm_packed_solve()

standard matrix format: real_symm_solve()

real symmetric positive definite band matrix: real_posdef_band_solve()

real symmetric positive definite matrix

multiple right-hand sides, standard precision: real_posdef_solve()

packed matrix format: real_posdef_packed_solve()

real symmetric positive definite Toeplitz matrix

general right-hand side: real_toeplitz_solve()

Yule–Walker equations: real_toeplitz_yule()

real symmetric positive definite tridiagonal matrix: real_posdef_tridiag_solve()

General Purpose functions,

real almost block-diagonal matrix: real_blkdiag_fac_solve()

real band symmetric positive definite matrix, variable bandwidth: real_posdef_vband_solve()

real sparse matrix

direct method: real_sparse_fac_solve()

iterative method: real_gen_sparse_lsqsol()

real symmetric positive definite Toeplitz matrix

general right-hand side, update solution: real_toeplitz_update()

Yule–Walker equations, update solution: real_toeplitz_yule_update()

real tridiagonal matrix: real_tridiag_fac_solve()

Least squares and Homogeneous Equations

real by matrix

, rank or minimal solution: real_gen_solve()

rank , iterative refinement: real_gen_lsqsol()

real sparse matrix: real_gen_sparse_lsqsol()

Service Functions

complex rectangular matrix

norm and condition number estimation: complex_gen_norm_rcomm()

real matrix

covariance matrix for linear least squares problems: real_gen_lsq_covmat()

real rectangular matrix

norm and condition number estimation: real_gen_norm_rcomm()

For full information please refer to the NAG Library document

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04intro.html

naginterfaces.library.linsys.complex_band_solve(n, kl, ku, ab, b)[source]

Computes the solution, estimated condition number and error-bound to a complex banded system of linear equations.

For full information please refer to the NAG Library document for f04cb

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04cbf.html

Parameters
n : int
The number of linear equations , i.e., the order of the matrix .
kl : int
The number of subdiagonals , within the band of .
ku : int
The number of superdiagonals , within the band of .
ab : complex, array-like, shape

The by matrix .

See Further Comments for further details.

b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
ab : complex, ndarray, shape
If no exception is raised, this argument is overwritten by details of the factorization.
ipiv : int, ndarray, shape
If no exception is raised, the pivot indices that define the permutation matrix ; at the th step row of the matrix was interchanged with row . indicates a row interchange was not required.
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no exception is raised, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, , and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
Diagonal element of the upper triangular factor is zero. The factorization has been completed, but the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_gen_norm_rcomm(irevcm, x, y, estnrm, seed, comm)[source]

Norm estimation (for use in condition estimation), complex rectangular matrix.

For full information please refer to the NAG Library document for f04zd

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04zdf.html

Parameters
irevcm : int

On initial entry: must be set to .

On intermediate entry: must be unchanged.

x : complex, ndarray, shape , modified in place

On initial entry: need not be set.

On intermediate exit: if , contains the current matrix .

On intermediate entry: if , must contain .

On final exit: the array is undefined.

y : complex, ndarray, shape , modified in place

On initial entry: need not be set.

On intermediate exit: if , contains the current matrix .

On intermediate entry: if , must contain .

On final exit: the array is undefined.

estnrm : float

On initial entry: need not be set.

On intermediate entry: must not be changed.

seed : int

The seed used for random number generation.

If , is not used.

comm : dict, communication object, modified in place

Communication structure.

On initial entry: need not be set.

Returns
irevcm : int

On intermediate exit: or , and contains the matrix and contains the matrix . The calling program must

  • if , evaluate and store the result in

    or

    if , evaluate and store the result in , where is the complex conjugate transpose;

  • call complex_gen_norm_rcomm once again, with all the arguments unchanged.

On final exit: .

estnrm : float
On final exit: an estimate (a lower bound) for .
Raises
NagValueError
(errno )

On entry, and .

Constraint: if , .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: , or .

(errno )

On initial entry, .

Constraint: .

(errno )
Internal error; please contact NAG.
naginterfaces.library.linsys.complex_herm_packed_solve(uplo, n, ap, b)[source]

Computes the solution, estimated condition number and error-bound to a complex Hermitian system of linear equations, packed storage.

For full information please refer to the NAG Library document for f04cj

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04cjf.html

Parameters
uplo : str, length 1

If , the upper triangle of the matrix is stored.

If , the lower triangle of the matrix is stored.

n : int
The number of linear equations , i.e., the order of the matrix .
ap : complex, array-like, shape
The by Hermitian matrix , packed column-wise in a linear array. The th column of the matrix is stored in the array as follows:
b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
ap : complex, ndarray, shape
If no exception is raised, the block diagonal matrix and the multipliers used to obtain the factor or from the factorization or as computed by lapacklin.zhptrf, stored as a packed triangular matrix in the same storage format as .
ipiv : int, ndarray, shape

If no exception is raised, details of the interchanges and the block structure of , as determined by lapacklin.zhptrf.

  • If , then rows and columns and were interchanged, and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block.
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no constraints are violated, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, or : .
(errno )
Diagonal block of the block diagonal matrix is zero. The factorization has been completed, but the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_herm_solve(uplo, n, a, b)[source]

Computes the solution and error-bound to a complex Hermitian system of linear equations.

For full information please refer to the NAG Library document for f04ch

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04chf.html

Parameters
uplo : str, length 1

If , the upper triangle of the matrix is stored.

If , the lower triangle of the matrix is stored.

n : int
The number of linear equations , i.e., the order of the matrix .
a : complex, array-like, shape

The by Hermitian matrix .

If , the leading by upper triangular part of the array contains the upper triangular part of the matrix , and the strictly lower triangular part of is not referenced.

If , the leading by lower triangular part of the array contains the lower triangular part of the matrix , and the strictly upper triangular part of is not referenced.

b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
a : complex, ndarray, shape
If no exception is raised, the block diagonal matrix and the multipliers used to obtain the factor or from the factorization or as computed by lapacklin.zhetrf.
ipiv : int, ndarray, shape

If no exception is raised, details of the interchanges and the block structure of , as determined by lapacklin.zhetrf.

  • If , then rows and columns and were interchanged, and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block.
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no constraints are violated, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, not one of ‘U’ or ‘u’ or ‘L’ or ‘l’: .
(errno )
Diagonal block of the block diagonal matrix is zero. The factorization has been completed, but the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_posdef_band_solve(uplo, kd, ab, b)[source]

Computes the solution, estimated condition number and error-bound to a complex Hermitian positive definite banded system of linear equations.

For full information please refer to the NAG Library document for f04cf

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04cff.html

Parameters
uplo : str, length 1

If , the upper triangle of the matrix is stored.

If , the lower triangle of the matrix is stored.

kd : int
The number of superdiagonals (and the number of subdiagonals) of the band matrix .
ab : complex, array-like, shape

The by Hermitian band matrix . The upper or lower triangular part of the Hermitian matrix is stored in the first rows of the array. The th column of is stored in the th column of the array as follows:

See Further Comments below for further details.

b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
ab : complex, ndarray, shape
If the function exits successfully or = + 1, the factor or from the Cholesky factorization or , in the same storage format as .
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If the function exits successfully or = + 1, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, not one of ‘U’ or ‘u’ or ‘L’ or ‘l’: .
(errno )
The principal minor of order of the matrix is not positive definite. The factorization has not been completed and the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_posdef_packed_solve(uplo, ap, b)[source]

Computes the solution, estimated condition number and error-bound to a complex Hermitian positive definite system of linear equations, packed storage.

For full information please refer to the NAG Library document for f04ce

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04cef.html

Parameters
uplo : str, length 1

If , the upper triangle of the matrix is stored.

If , the lower triangle of the matrix is stored.

ap : complex, array-like, shape
The by Hermitian matrix . The upper or lower triangular part of the Hermitian matrix is packed column-wise in a linear array. The th column of is stored in the array as follows:
b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
ap : complex, ndarray, shape
If the function exits successfully or = + 1, the factor or from the Cholesky factorization or , in the same storage format as .
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If the function exits successfully or = + 1, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, or : .
(errno )
The principal minor of order of the matrix is not positive definite. The factorization has not been completed and the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_posdef_solve(uplo, a, b)[source]

Computes the solution, estimated condition number and error-bound to a complex Hermitian positive definite system of linear equations.

For full information please refer to the NAG Library document for f04cd

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04cdf.html

Parameters
uplo : str, length 1

If , the upper triangle of the matrix is stored.

If , the lower triangle of the matrix is stored.

a : complex, array-like, shape

The by Hermitian matrix .

If , the leading by upper triangular part of contains the upper triangular part of the matrix , and the strictly lower triangular part of is not referenced.

If , the leading by lower triangular part of contains the lower triangular part of the matrix , and the strictly upper triangular part of is not referenced.

b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
a : complex, ndarray, shape
If the function exits successfully or = + 1, the factor or from the Cholesky factorization or .
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If the function exits successfully or = + 1, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, not one of ‘U’ or ‘u’ or ‘L’ or ‘l’: .
(errno )
The principal minor of order of the matrix is not positive definite. The factorization has not been completed and the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_posdef_tridiag_solve(d, e, b)[source]

Computes the solution, estimated condition number and error-bound to a complex Hermitian positive definite tridiagonal system of linear equations.

For full information please refer to the NAG Library document for f04cg

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04cgf.html

Parameters
d : float, array-like, shape
Must contain the diagonal elements of the tridiagonal matrix .
e : complex, array-like, shape
Must contain the subdiagonal elements of the tridiagonal matrix .
b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
d : float, ndarray, shape
If the function exits successfully or = + 1, is overwritten by the diagonal elements of the diagonal matrix from the factorization of .
e : complex, ndarray, shape
If the function exits successfully or = + 1, is overwritten by the subdiagonal elements of the unit lower bidiagonal matrix from the factorization of . ( can also be regarded as the conjugate of the superdiagonal of the unit upper bidiagonal factor from the factorization of .)
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If the function exits successfully or = + 1, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
The principal minor of order of the matrix is not positive definite. The factorization has not been completed and the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_square_solve(n, a, b)[source]

Computes the solution, estimated condition number and error-bound to a complex system of linear equations.

For full information please refer to the NAG Library document for f04ca

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04caf.html

Parameters
n : int
The number of linear equations , i.e., the order of the matrix .
a : complex, array-like, shape
The by coefficient matrix .
b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
a : complex, ndarray, shape
If no exception is raised, the factors and from the factorization . The unit diagonal elements of are not stored.
ipiv : int, ndarray, shape
If no exception is raised, the pivot indices that define the permutation matrix ; at the th step row of the matrix was interchanged with row . indicates a row interchange was not required.
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no constraints are violated, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
Diagonal element of the upper triangular factor is zero. The factorization has been completed, but the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_symm_packed_solve(uplo, n, ap, b)[source]

Computes the solution, estimated condition number and error-bound to a complex symmetric system of linear equations, packed storage.

For full information please refer to the NAG Library document for f04dj

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04djf.html

Parameters
uplo : str, length 1

If , the upper triangle of the matrix is stored.

If , the lower triangle of the matrix is stored.

n : int
The number of linear equations , i.e., the order of the matrix .
ap : complex, array-like, shape
The by symmetric matrix , packed column-wise in a linear array. The th column of the matrix is stored in the array as follows:
b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
ap : complex, ndarray, shape
If no exception is raised, the block diagonal matrix and the multipliers used to obtain the factor or from the factorization or as computed by lapacklin.zsptrf, stored as a packed triangular matrix in the same storage format as .
ipiv : int, ndarray, shape

If no constraints are violated, details of the interchanges and the block structure of , as determined by lapacklin.zsptrf.

  • If , then rows and columns and were interchanged, and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block.
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no constraints are violated, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, or : .
(errno )
Diagonal block of the block diagonal matrix is zero. The factorization has been completed, but the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_symm_solve(uplo, n, a, b)[source]

Computes the solution, estimated condition number and error-bound to a complex symmetric system of linear equations.

For full information please refer to the NAG Library document for f04dh

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04dhf.html

Parameters
uplo : str, length 1

If , the upper triangle of the matrix is stored.

If , the lower triangle of the matrix is stored.

n : int
The number of linear equations , i.e., the order of the matrix .
a : complex, array-like, shape

The by complex symmetric matrix .

If , the leading by upper triangular part of the array contains the upper triangular part of the matrix , and the strictly lower triangular part of is not referenced.

If , the leading by lower triangular part of the array contains the lower triangular part of the matrix , and the strictly upper triangular part of is not referenced.

b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
a : complex, ndarray, shape
If no exception is raised, the block diagonal matrix and the multipliers used to obtain the factor or from the factorization or as computed by lapacklin.zsytrf.
ipiv : int, ndarray, shape

If no exception is raised, details of the interchanges and the block structure of , as determined by lapacklin.zsytrf.

  • If , then rows and columns and were interchanged, and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block;
  • if and , then rows and columns and were interchanged and is a by diagonal block.
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no constraints are violated, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, not one of ‘U’ or ‘u’ or ‘L’ or ‘l’: .
(errno )
Diagonal block of the block diagonal matrix is zero. The factorization has been completed, but the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.complex_tridiag_solve(n, dl, d, du, b)[source]

Computes the solution, estimated condition number and error-bound to a complex tridiagonal system of linear equations.

For full information please refer to the NAG Library document for f04cc

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04ccf.html

Parameters
n : int
The number of linear equations , i.e., the order of the matrix .
dl : complex, array-like, shape
Must contain the subdiagonal elements of the matrix .
d : complex, array-like, shape
Must contain the diagonal elements of the matrix .
du : complex, array-like, shape
Must contain the superdiagonal elements of the matrix
b : complex, array-like, shape
The by matrix of right-hand sides .
Returns
dl : complex, ndarray, shape
If no exception is raised, is overwritten by the multipliers that define the matrix from the factorization of .
d : complex, ndarray, shape
If no exception is raised, is overwritten by the diagonal elements of the upper triangular matrix from the factorization of .
du : complex, ndarray, shape
If no exception is raised, is overwritten by the elements of the first superdiagonal of .
du2 : complex, ndarray, shape
If no exception is raised, returns the elements of the second superdiagonal of .
ipiv : int, ndarray, shape
If no exception is raised, the pivot indices that define the permutation matrix ; at the th step row of the matrix was interchanged with row . will always be either or ; indicates a row interchange was not required.
b : complex, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no constraints are violated, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
Diagonal element of the upper triangular factor is zero. The factorization has been completed, but the solution could not be computed.
Warns
NagAlgorithmicWarning
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.real_band_solve(n, kl, ku, ab, b)[source]

Computes the solution, estimated condition number and error-bound to a real banded system of linear equations.

For full information please refer to the NAG Library document for f04bb

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04bbf.html

Parameters
n : int
The number of linear equations , i.e., the order of the matrix .
kl : int
The number of subdiagonals , within the band of .
ku : int
The number of superdiagonals , within the band of .
ab : float, array-like, shape

The by matrix .

See Further Comments for further details.

b : float, array-like, shape
The by matrix of right-hand sides .
Returns
ab : float, ndarray, shape
If no exception is raised, this argument is overwritten by details of the factorization.
ipiv : int, ndarray, shape
If no exception is raised, the pivot indices that define the permutation matrix ; at the th step row of the matrix was interchanged with row . indicates a row interchange was not required.
b : float, ndarray, shape
If the function exits successfully or = + 1, the by solution matrix .
rcond : float
If no constraints are violated, an estimate of the reciprocal of the condition number of the matrix , computed as .
errbnd : float
If the function exits successfully or = + 1, an estimate of the forward error bound for a computed solution , such that , where is a column of the computed solution returned in the array and is the corresponding column of the exact solution . If is less than machine precision, is returned as unity.
Raises
NagValueError
(errno )

On entry, , and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )
Diagonal element of the upper triangular factor is zero. The factorization has been completed, but the solution could not be computed.
(errno )
A solution has been computed, but is less than machine precision so that the matrix is numerically singular.
naginterfaces.library.linsys.real_blkdiag_fac_solve(trans, blkstr, a, pivot, b)[source]

Solution of real almost block diagonal simultaneous linear equations (coefficient matrix already factorized by matop.real_gen_blkdiag_lu).

For full information please refer to the NAG Library document for f04lh

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04lhf.html

Parameters
trans : str, length 1

Specifies the equations to be solved.

Solve .

Solve .
blkstr : int, array-like, shape
Information which describes the block structure of , as supplied to real_blkdiag_fac_solve.
a : float, array-like, shape
The elements in the factorization of , as returned by real_blkdiag_fac_solve.
pivot : int, array-like, shape
Details of the interchanges in the factorization, as returned by real_blkdiag_fac_solve.
b : float, array-like, shape
The by right-hand side matrix .
Returns
b : float, ndarray, shape
This argument is overwritten by the by solution matrix .
Raises
NagValueError
(errno )
On entry, is too small. . Minimum possible dimension: .
(errno )
On entry, the following equality does not hold: .
(errno )
On entry, the following equality does not hold: .
(errno )

On entry, , , and .

Constraint: .

(errno )
On entry, the following inequality was not satisfied for: . .
(errno )

On entry, , , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )
On entry, or : .
Notes
No equivalent traditional C interface for this routine exists in the NAG Library.
naginterfaces.library.linsys.real_gen_lsq_covmat(job, sigma, a, svd, irank, sv)[source]

Covariance matrix for linear least squares problems, real equations in unknowns.

For full information please refer to the NAG Library document for f04ya

https://www.nag.com/numeric/nl/nagdoc_27/flhtml/f04/f04yaf.html

Parameters
job : int

Specifies which elements of are required.

The upper triangular part of is required.

The diagonal elements of are required.

The elements of column of are required.
sigma : float
The standard error of the residual vector.
a : float, array-like, shape

Note: the required extent for this argument in dimension 1 is determined as follows: if : ; if : ; otherwise: .

If , must contain the upper triangular matrix of the factorization of , or of the Cholesky factorization of ; elements of the array below the diagonal need not be set.

If , must contain the first rows of the matrix , where is the rank of and is the right-hand orthogonal matrix of the singular value decomposition of .

Thus the th row must contain the th right-hand singular vector of .

svd : bool
Must be if the least squares solution was obtained from a singular value decomposition of . must be if the least squares solution was obtained from either a factorization of or a Cholesky factorization of . In the latter case the rank of is assumed to be and so is applicable only to full rank problems with .
irank : int

If , must specify the rank of the matrix .

If , is not referenced and the rank of is assumed to be .

sv : float, array-like, shape

If , must contain the first singular values of .

If , is not referenced.

Returns
a : float, ndarray, shape

If , is unchanged.

If , contains the upper triangle of the symmetric matrix .

If , elements of the array below the diagonal are used as workspace.

If , they are unchanged.

cj : float, ndarray, shape

If ,