txt: ## dist_zef-FRITH-Math-Libgsl-LinearAlgebra.md
  ## Chunk 3 of 3
   right element of $A is used to store the matrix 1-norm, used later by cholesky-band-rcond() to calculate the reciprocal condition number. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### cholesky-band-solve(Math::Libgsl::Matrix $LLT where \*.matrix.size1 == $LLT.matrix.size2, Math::Libgsl::Vector $b where \*.vector.size == $LLT.matrix.size1 --> Math::Libgsl::Vector)
  
  This function is available only from the C library v2.6. This function solves the symmetric banded system Ax = b using the Cholesky decomposition of A held in the matrix $LLT which must have been previously computed by cholesky-band-decomp. The function returns the Math::Libgsl::Vector solution $x. In case of error a failure object is returned.
  
  ### cholesky-band-svx(Math::Libgsl::Matrix $LLT where \*.matrix.size1 == $LLT.matrix.size2, Math::Libgsl::Vector $x where \*.vector.size == $LLT.matrix.size1 --> Int)
  
  This function is available only from the C library v2.6. This function solves the symmetric banded system Ax = b using the Cholesky decomposition of A held in the matrix $LLT which must have been previously computed by cholesky-band-decomp. On input $x should contain the right-hand side b, which is replaced by the solution on output. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### cholesky-band-invert(Math::Libgsl::Matrix $LLT where \*.matrix.size1 == $LLT.matrix.size2 --> Math::Libgsl::Matrix)
  
  This function is available only from the C library v2.6. This function computes the inverse of a symmetric banded matrix from its Cholesky decomposition $LLT, which must have been previously computed by cholesky-band-decomp. The function returns the inverse matrix as a Math::Libgsl::Matrix solution object. In case of error a failure object is returned.
  
  ### cholesky-band-unpack(Math::Libgsl::Matrix $LLT where \*.matrix.size1 == $LLT.matrix.size2 --> Math::Libgsl::Matrix)
  
  This function is available only from the C library v2.6. This function unpacks the lower triangular Cholesky factor from $LLT, which returns as a Math::Libgsl::Matrix object. In case of error a failure object is returned.
  
  ### cholesky-band-rcond(Math::Libgsl::Matrix $LLT where \*.matrix.size1 == $LLT.matrix.size2 --> Num)
  
  This function is available only from the C library v2.6. This function estimates the reciprocal condition number (using the 1-norm) of the symmetric banded positive definite matrix A, using its Cholesky decomposition provided in $LLT. The reciprocal condition number estimate, defined as 1/(||A||₁ · ||A⁻¹||₁), is returned.
  
  ### ldlt-band-decomp(Math::Libgsl::Matrix $A where \*.matrix.size1 == $A.matrix.size2 --> Int)
  
  This function is available only from the C library v2.6. This function factorizes the symmetric, non-singular square matrix $A into the decomposition A = LDT(L). The input matrix $A is given in symmetric banded format, and has dimensions N-by-(p + 1), where p is the lower bandwidth of the matrix. On output, the entries of $A are replaced by the entries of the matrices D and L in the same format. If the matrix is singular then the decomposition will fail, returning the error code GSL\_EDOM . This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### ldlt-band-solve(Math::Libgsl::Matrix $LDLT where \*.matrix.size1 == $LDLT.matrix.size2, Math::Libgsl::Vector $b where \*.vector.size == $LDLT.matrix.size1 --> Math::Libgsl::Vector)
  
  This function is available only from the C library v2.6. This function solves the symmetric banded system Ax = b using the LDT(L) decomposition of A held in the matrix $LDLT which must have been previously computed by ldlt-band-decomp. The function returns the Math::Libgsl::Vector solution $x. In case of error a failure object is returned.
  
  ### ldlt-band-svx(Math::Libgsl::Matrix $LDLT where \*.matrix.size1 == $LDLT.matrix.size2, Math::Libgsl::Vector $x where \*.vector.size == $LDLT.matrix.size1 --> Int)
  
  This function is available only from the C library v2.6. This function solves the symmetric banded system Ax = b using the LDT(L) decomposition of A held in the matrix $LDLT which must have been previously computed by ldlt-band-decomp. On input $x should contain the right-hand side b, which is replaced by the solution on output. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### ldlt-band-unpack(Math::Libgsl::Matrix $LDLT where \*.matrix.size1 == $LDLT.matrix.size2 --> List)
  
  This function is available only from the C library v2.6. This function unpacks the unit lower triangular factor L from $LDLT. This function returns a Math::Libgsl::Matrix object, which holds the lower triangular portion of the matrix L, and a Math::Libgsl::Vector object, which contains the diagonal matrix D. In case of error a failure object is returned.
  
  ### ldlt-band-rcond(Math::Libgsl::Matrix $LDLT where \*.matrix.size1 == $LDLT.matrix.size2 --> Num)
  
  This function is available only from the C library v2.6. This function estimates the reciprocal condition number (using the 1-norm) of the symmetric banded nonsingular matrix A, using its LDT(L) decomposition provided in $LDLT. The reciprocal condition number estimate, defined as 1/(||A||₁ · ||A⁻¹||₁), is returned.
  
  ### balance-matrix(Math::Libgsl::Matrix $A --> Math::Libgsl::Vector)
  
  This function replaces the matrix $A with its balanced counterpart and returns the diagonal elements of the similarity transformation as a Math::Libgsl::Vector object. In case of error a failure object is returned.
  
  ## Complex
  
  ### LU-cdecomp(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2 --> List)
  
  This function factorizes the matrix A into the LU decomposition PA = LU. The factorization is done in place, so on output the diagonal and upper triangular (or trapezoidal) part of the input matrix A contain the matrix U. The lower triangular (or trapezoidal) part of the input matrix (excluding the diagonal) contains L. The diagonal elements of L are unity, and are not stored. The return value is a List: the sign of the permutation and a permutation object, which encodes the permutation matrix P. In case of error a failure object is returned.
  
  ### LU-csolve(Math::Libgsl::Matrix::Complex64 $LU where \*.matrix.size1 == $LU.matrix.size2, Math::Libgsl::Permutation $p where \*.size == $LU.matrix.size1, Math::Libgsl::Vector::Complex64 $b where \*.vector.size == $LU.matrix.size1 --> Math::Libgsl::Vector::Complex64)
  
  This function solves the square system Ax = b using the LU decomposition of A into (LU, p) given by the output of LU-decomp. In case of error a failure object is returned.
  
  ### LU-csvx(Math::Libgsl::Matrix::Complex64 $LU where \*.matrix.size1 == $LU.matrix.size2, Math::Libgsl::Permutation $p where \*.size == $LU.matrix.size1, Math::Libgsl::Vector::Complex64 $x where \*.vector.size == $LU.matrix.size1 --> Int)
  
  This function solves the square system Ax = b in-place using the precomputed LU decomposition of A into (LU, p). On input $x should contain the right-hand side b, which is replaced by the solution on output. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### LU-crefine(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2, Math::Libgsl::Matrix::Complex64 $LU where { $LU.matrix.size1 == $LU.matrix.size2 && $A.matrix.size1 == $LU.matrix.size2 }, Math::Libgsl::Permutation $p where \*.size == $LU.matrix.size1, Math::Libgsl::Vector::Complex64 $b where \*.vector.size == $LU.matrix.size1, Math::Libgsl::Vector::Complex64 $x where \*.vector.size == $LU.matrix.size1 --> Int)
  
  This function applies an iterative improvement to x, the solution of Ax = b, from the precomputed LU decomposition of A into (LU, p). This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### LU-cinvert(Math::Libgsl::Matrix::Complex64 $LU, Math::Libgsl::Permutation $p where \*.size == $LU.matrix.size1 --> Math::Libgsl::Matrix::Complex64)
  
  This function computes the inverse of a matrix A from its LU decomposition (LU, p), returning the matrix inverse. In case of error a failure object is returned.
  
  ### LU-cdet(Math::Libgsl::Matrix::Complex64 $LU, Int $signum where \* ~~ -1|1 --> Complex)
  
  This function computes the determinant of a matrix A from its LU decomposition, $LU, and the sign of the permutation, $signum. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### LU-clndet(Math::Libgsl::Matrix::Complex64 $LU --> Num)
  
  This function computes the determinant the logarithm of the absolute value of the determinant of a matrix A, ln |det(A)|, from its LU decomposition, $LU. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### LU-csgndet(Math::Libgsl::Matrix::Complex64 $LU, Int $signum where \* ~~ -1|1 --> Complex)
  
  This function computes the sign or phase factor of the determinant of a matrix A, det(A)/|det(A)| from its LU decomposition, $LU. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### cholesky-cdecomp(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2 --> Int)
  
  This function factorizes the symmetric, positive-definite square matrix $A into the Cholesky decomposition A = LT(L). On input, the values from the diagonal and lower-triangular part of the matrix $A are used (the upper triangular part is ignored). On output the diagonal and lower triangular part of the input matrix $A contain the matrix L, while the upper triangular part contains the original matrix. If the matrix is not positive-definite then the decomposition will fail, returning the error code GSL\_EDOM. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### cholesky-csolve(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2, Math::Libgsl::Vector::Complex64 $b where \*.vector.size == $A.matrix.size1 --> Math::Libgsl::Vector::Complex64)
  
  These functions solve the system Ax = b using the Cholesky decomposition of $A which must have been previously computed by cholesky-cdecomp. The function returns the Math::Libgsl::Vector::Complex64 $x. In case of error a failure object is returned.
  
  ### cholesky-csvx(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2, Math::Libgsl::Vector::Complex64 $x where \*.vector.size == $A.matrix.size1 --> Int)
  
  This function solves the system Ax = b in-place using the Cholesky decomposition of $A which must have been previously computed by cholesky-cdecomp. On input $x should contain the right-hand side b, which is replaced by the solution on output. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### cholesky-cinvert(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2 --> Int)
  
  These functions compute the inverse of a matrix from its Cholesky decomposition $A, which must have been previously computed by cholesky-cdecomp. On output, the inverse is stored in-place in $A. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### hermtd-cdecomp(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2 --> Math::Libgsl::Vector::Complex64)
  
  This function factorizes the hermitian matrix $A into the symmetric tridiagonal decomposition UTT(U). On output the diagonal and subdiagonal part of the input matrix $A contain the tridiagonal matrix T. The remaining lower triangular part of the input matrix contains the Householder vectors which, together with the Householder coefficients tau returned as a Math::Libgsl::Vector::Complex64 object, encode the orthogonal matrix U. The upper triangular part of $A and the imaginary parts of the diagonal are not referenced. In case of error a failure object is returned.
  
  ### hermtd-cunpack(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2, Math::Libgsl::Vector::Complex64 $tau where \*.vector.size == $A.matrix.size1 - 1 --> List)
  
  This function unpacks the encoded symmetric tridiagonal decomposition ($A, $tau) obtained from hermtd-cdecomp. The function returns a List: the unitary matrix $U as a Math::Libgsl::Matrix::Complex64, the real vector of diagonal elements $diag as a Math::Libgsl::Vector, and the real vector of subdiagonal elements $subdiag as a Math::Libgsl::Vector. In case of error a failure object is returned.
  
  ### hermtd-cunpack-T(Math::Libgsl::Matrix::Complex64 $A where \*.matrix.size1 == $A.matrix.size2 --> List)
  
  This function unpacks the diagonal and subdiagonal of the encoded symmetric tridiagonal decomposition ($A, $tau) obtained from hermtd-cdecomp. The function returns a List of two real Math::Libgsl::Vector: $diag and $subdiag. In case of error a failure object is returned.
  
  ### householder-ctransform(Math::Libgsl::Vector::Complex64 $w --> Complex)
  
  This function prepares a Householder transformation H = I − τvT(v) which can be used to zero all the elements of the input vector $w except the first. On output the Householder vector v is stored in $w and the scalar τ is returned. The householder vector v is normalized so that v[0] = 1, however this 1 is not stored in the output vector. Instead, $w[0] is set to the first element of the transformed vector, so that if u = Hw, w[0] = u[0] on output and the remainder of u is zero. This function returns a Complex: $τ.
  
  ### householder-chm(Complex $tau, Math::Libgsl::Vector::Complex64 $v, Math::Libgsl::Matrix::Complex64 $A --> Int)
  
  This function applies the Householder matrix H defined by the scalar $tau and the vector $v to the left-hand side of the matrix $A. On output the result HA is stored in $A. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### householder-cmh(Complex $tau, Math::Libgsl::Vector::Complex64 $v, Math::Libgsl::Matrix::Complex64 $A --> Int)
  
  This function applies the Householder matrix H defined by the scalar $tau and the vector $v to the right-hand side of the matrix $A. On output the result AH is stored in $A. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### householder-chv(Complex $tau, Math::Libgsl::Vector::Complex64 $v, Math::Libgsl::Vector::Complex64 $w --> Int)
  
  This function applies the Householder transformation H defined by the scalar $tau and the vector $v to the vector $w. On output the result Hw is stored in w. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### tri-cinvert(Int $Uplo, Int $Diag, Math::Libgsl::Matrix::Complex64 $A --> Int)
  
  This function is available only from the C library v2.6. This function computes the in-place inverse of the triangular matrix $T, stored in the lower triangle when $Uplo = CblasLower and upper triangle when $Uplo = CblasUpper. The parameter $Diag = CblasUnit, CblasNonUnit specifies whether the matrix is unit triangular. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### tri-cLHL(Math::Libgsl::Matrix::Complex64 $L --> Int)
  
  This function is available only from the C library v2.6. This function computes the product LT(L) in-place and stores it in the lower triangle of $L on output. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  ### tri-cUL(Math::Libgsl::Matrix::Complex64 $LU --> Int)
  
  This function is available only from the C library v2.6. This function compute the product $UL where U is upper triangular and L is unit lower triangular, stored in $LU, as computed by LU-cdecomp. This function returns GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.
  
  # C Library Documentation
  
  For more details on libgsl see <https://www.gnu.org/software/gsl/>. The excellent C Library manual is available here <https://www.gnu.org/software/gsl/doc/html/index.html>, or here <https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf> in PDF format.
  
  # Prerequisites
  
  This module requires the libgsl library to be installed. Please follow the instructions below based on your platform:
  
  ## Debian Linux and Ubuntu 20.04+
  
  ```
  sudo apt install libgsl23 libgsl-dev libgslcblas0
  
  ```
  
  That command will install libgslcblas0 as well, since it's used by the GSL.
  
  ## Ubuntu 18.04
  
  libgsl23 and libgslcblas0 have a missing symbol on Ubuntu 18.04. I solved the issue installing the Debian Buster version of those three libraries:
  
  * <http://http.us.debian.org/debian/pool/main/g/gsl/libgslcblas0_2.5+dfsg-6_amd64.deb>
  * <http://http.us.debian.org/debian/pool/main/g/gsl/libgsl23_2.5+dfsg-6_amd64.deb>
  * <http://http.us.debian.org/debian/pool/main/g/gsl/libgsl-dev_2.5+dfsg-6_amd64.deb>
  
  # Installation
  
  To install it using zef (a module management tool):
  
  ```
  $ zef install Math::Libgsl::LinearAlgebra
  
  ```
  
  # AUTHOR
  
  Fernando Santagata [nando.santagata@gmail.com](mailto:nando.santagata@gmail.com)
  
  # COPYRIGHT AND LICENSE
  
  Copyright 2020 Fernando Santagata
  
  This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
  