# 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]

complex_band_solve computes the solution to a complex system of linear equations , where is an by band matrix, with subdiagonals and superdiagonals, and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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, 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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_gen_norm_rcomm(irevcm, x, y, estnrm, seed, comm)[source]

complex_gen_norm_rcomm estimates the -norm of a complex rectangular matrix without accessing the matrix explicitly. It uses reverse communication for evaluating matrix products. The function may be used for estimating condition numbers of square matrices.

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

1. if , evaluate and store the result in

or

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

2. 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 )
References

Higham, N J, 1988, FORTRAN codes for estimating the one-norm of a real or complex matrix, with applications to condition estimation, ACM Trans. Math. Software (14), 381–396

Higham, N J and Tisseur, F, 2000, A block algorithm for matrix -norm estimation, with an application to -norm pseudospectra, SIAM J. Matrix. Anal. Appl. (21), 1185–1201

naginterfaces.library.linsys.complex_herm_packed_solve(uplo, n, ap, b)[source]

complex_herm_packed_solve computes the solution to a complex system of linear equations , where is an by complex Hermitian matrix, stored in packed format and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_herm_solve(uplo, n, a, b)[source]

complex_herm_solve computes the solution to a complex system of linear equations , where is an by Hermitian matrix and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_posdef_band_solve(uplo, kd, ab, b)[source]

complex_posdef_band_solve computes the solution to a complex system of linear equations , where is an by Hermitian positive definite band matrix of band width , and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_posdef_packed_solve(uplo, ap, b)[source]

complex_posdef_packed_solve computes the solution to a complex system of linear equations , where is an by Hermitian positive definite matrix, stored in packed format, and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_posdef_solve(uplo, a, b)[source]

complex_posdef_solve computes the solution to a complex system of linear equations , where is an by Hermitian positive definite matrix and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_posdef_tridiag_solve(d, e, b)[source]

complex_posdef_tridiag_solve computes the solution to a complex system of linear equations , where is an by Hermitian positive definite tridiagonal matrix and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_square_solve(n, a, b)[source]

complex_square_solve computes the solution to a complex system of linear equations , where is an by matrix and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_symm_packed_solve(uplo, n, ap, b)[source]

complex_symm_packed_solve computes the solution to a complex system of linear equations , where is an by complex symmetric matrix, stored in packed format and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_symm_solve(uplo, n, a, b)[source]

complex_symm_solve computes the solution to a complex system of linear equations , where is an by complex symmetric matrix and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.complex_tridiag_solve(n, dl, d, du, b)[source]

complex_tridiag_solve computes the solution to a complex system of linear equations , where is an by tridiagonal matrix and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

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

real_band_solve computes the solution to a real system of linear equations , where is an by band matrix, with subdiagonals and superdiagonals, and and are by matrices. An estimate of the condition number of and an error bound for the computed solution are also returned.

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, 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.
References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia

naginterfaces.library.linsys.real_blkdiag_fac_solve(trans, blkstr, a, pivot, b)[source]

real_blkdiag_fac_solve calculates the approximate solution of a set of real linear equations with multiple right-hand sides, or , where is an almost block-diagonal matrix which has been 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
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