Skip to content
Snippets Groups Projects
Commit f0ecff62 authored by liam's avatar liam
Browse files

Port qr to defun-gsl iospec.

git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3104 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent c0e5aced
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; description: Definition of GSLL system ; description: Definition of GSLL system
; date: ; date:
; author: Liam Healy ; author: Liam Healy
; modified: Sat Jul 1 2006 - 22:50 ; modified: Mon Jul 3 2006 - 09:32
;******************************************************** ;********************************************************
;;; $Id: $ ;;; $Id: $
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
(:file "blas2") (:file "blas2")
(:file "blas3" :depends-on (blas2)) (:file "blas3" :depends-on (blas2))
(:file "lu") (:file "lu")
;;(:file "qr") (:file "qr")
;;(:file "qrpt") ;;(:file "qrpt")
;;(:file "svd") ;;(:file "svd")
;;(:file "cholesky") ;;(:file "cholesky")
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; description: QR decomposition ; description: QR decomposition
; date: Fri Apr 28 2006 - 16:53 ; date: Fri Apr 28 2006 - 16:53
; author: Liam Healy ; author: Liam Healy
; modified: Sat Apr 29 2006 - 18:00 ; modified: Mon Jul 3 2006 - 09:32
;******************************************************** ;********************************************************
;;; $Id: $ ;;; $Id: $
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
;;; columns of @math{Q} form an orthonormal basis for the range of @math{A}, ;;; columns of @math{Q} form an orthonormal basis for the range of @math{A},
;;; @math{ran(A)}, when @math{A} has full column rank. ;;; @math{ran(A)}, when @math{A} has full column rank.
(defun-gsl QR-decomp ((A gsl-matrix-c) (tau gsl-vector-c)) (defun-gsl QR-decomp (A tau)
"gsl_linalg_QR_decomp" "gsl_linalg_QR_decomp"
((A gsl-matrix-c) (tau gsl-vector-c))
:documentation "Factorize the @math{M}-by-@math{N} matrix @var{A} into :documentation "Factorize the @math{M}-by-@math{N} matrix @var{A} into
the @math{QR} decomposition @math{A = Q R}. On output the diagonal and the @math{QR} decomposition @math{A = Q R}. On output the diagonal and
upper triangular part of the input matrix contain the matrix upper triangular part of the input matrix contain the matrix
...@@ -39,32 +40,29 @@ ...@@ -39,32 +40,29 @@
The algorithm used to perform the decomposition is Householder QR (Golub The algorithm used to perform the decomposition is Householder QR (Golub
& Van Loan, @cite{Matrix Computations}, Algorithm 5.2.1)." & Van Loan, @cite{Matrix Computations}, Algorithm 5.2.1)."
:invalidate (A) :invalidate (A tau))
:return-input (A tau))
(defun-gsl QR-solve (defun-gsl QR-solve (QR tau b x)
((QR gsl-matrix-c) (tau gsl-vector-c) (b gsl-vector-c) (x gsl-vector-c)) "gsl_linalg_QR_solve"
"gsl_linalg_QR_solve" ((QR gsl-matrix-c) (tau gsl-vector-c) (b gsl-vector-c) (x gsl-vector-c))
:documentation "Solve the square system @math{A x = b} using the @math{QR} :documentation "Solve the square system @math{A x = b} using the @math{QR}
decomposition of @math{A} into (@var{QR}, @var{tau}) given by decomposition of @math{A} into (@var{QR}, @var{tau}) given by
QR-decomp. The least-squares solution for rectangular systems can QR-decomp. The least-squares solution for rectangular systems can
be found using QR-lssolve." be found using QR-lssolve."
:invalidate (x) :invalidate (x))
:return-input (x))
(defun-gsl QR-svx ((QR gsl-matrix-c) (tau gsl-vector-c) (x gsl-vector-c)) (defun-gsl QR-svx (QR tau x)
"gsl_linalg_QR_svx" "gsl_linalg_QR_svx" ((QR gsl-matrix-c) (tau gsl-vector-c) (x gsl-vector-c))
:documentation "Solves the square system @math{A x = b} in-place using the :documentation "Solves the square system @math{A x = b} in-place using the
@math{QR} decomposition of @math{A} into (@var{QR},@var{tau}) given by @math{QR} decomposition of @math{A} into (@var{QR},@var{tau}) given by
QR-decomp. On input @var{x} should contain the QR-decomp. On input @var{x} should contain the
right-hand side @math{b}, which is replaced by the solution on output." right-hand side @math{b}, which is replaced by the solution on output."
:invalidate (x) :invalidate (x))
:return-input (x))
(defun-gsl QR-lssolve (defun-gsl QR-lssolve (QR tau b x residual)
((QR gsl-matrix-c) (tau gsl-vector-c) (b gsl-vector-c) (x gsl-vector-c)
(residual gsl-vector-c))
"gsl_linalg_QR_lssolve" "gsl_linalg_QR_lssolve"
((QR gsl-matrix-c) (tau gsl-vector-c) (b gsl-vector-c) (x gsl-vector-c)
(residual gsl-vector-c))
:documentation "The least squares solution to the overdetermined :documentation "The least squares solution to the overdetermined
system @math{A x = b} where the matrix @var{A} has more rows than system @math{A x = b} where the matrix @var{A} has more rows than
columns. The least squares solution minimizes the Euclidean norm of the columns. The least squares solution minimizes the Euclidean norm of the
...@@ -72,87 +70,78 @@ ...@@ -72,87 +70,78 @@
of @math{A} into (@var{QR}, @var{tau}) given by of @math{A} into (@var{QR}, @var{tau}) given by
@code{gsl_linalg_QR_decomp}. The solution is returned in @var{x}. The @code{gsl_linalg_QR_decomp}. The solution is returned in @var{x}. The
residual is computed as a by-product and stored in @var{residual}." residual is computed as a by-product and stored in @var{residual}."
:invalidate (x) :invalidate (x))
:return-input (x))
(defun-gsl QR-QTvec ((QR gsl-matrix-c) (tau gsl-vector-c) (v gsl-vector-c)) (defun-gsl QR-QTvec (QR tau v)
"gsl_linalg_QR_QTvec" "gsl_linalg_QR_QTvec" ((QR gsl-matrix-c) (tau gsl-vector-c) (v gsl-vector-c))
:documentation "Apply the matrix @math{Q^T} encoded in the decomposition :documentation "Apply the matrix @math{Q^T} encoded in the decomposition
(@var{QR},@var{tau}) to the vector @var{v}, storing the result @math{Q^T (@var{QR},@var{tau}) to the vector @var{v}, storing the result @math{Q^T
v} in @var{v}. The matrix multiplication is carried out directly using v} in @var{v}. The matrix multiplication is carried out directly using
the encoding of the Householder vectors without needing to form the full the encoding of the Householder vectors without needing to form the full
matrix @math{Q^T}." matrix @math{Q^T}."
:invalidate (v) :invalidate (v))
:return-input (v))
(defun-gsl QR-Qvec ((QR gsl-matrix-c) (tau gsl-vector-c) (v gsl-vector-c)) (defun-gsl QR-Qvec (QR tau v)
"gsl_linalg_QR_Qvec" "gsl_linalg_QR_Qvec" ((QR gsl-matrix-c) (tau gsl-vector-c) (v gsl-vector-c))
:documentation "Apply the matrix @math{Q} encoded in the decomposition :documentation "Apply the matrix @math{Q} encoded in the decomposition
(@var{QR},@var{tau}) to the vector @var{v}, storing the result @math{Q (@var{QR},@var{tau}) to the vector @var{v}, storing the result @math{Q
v} in @var{v}. The matrix multiplication is carried out directly using v} in @var{v}. The matrix multiplication is carried out directly using
the encoding of the Householder vectors without needing to form the full the encoding of the Householder vectors without needing to form the full
matrix @math{Q}." matrix @math{Q}."
:invalidate (v) :invalidate (v))
:return-input (v))
(defun-gsl QR-Rsolve ((QR gsl-matrix-c) (b gsl-vector-c) (x gsl-vector-c)) (defun-gsl QR-Rsolve (QR b x)
"gsl_linalg_QR_Rsolve" "gsl_linalg_QR_Rsolve" ((QR gsl-matrix-c) (b gsl-vector-c) (x gsl-vector-c))
:documentation "Solve the triangular system @math{R x = b} for :documentation "Solve the triangular system @math{R x = b} for
@var{x}. It may be useful if the product @math{b' = Q^T b} has already @var{x}. It may be useful if the product @math{b' = Q^T b} has already
been computed using QR-QTvec}." been computed using QR-QTvec}."
:invalidate (x) :invalidate (x))
:return-input (x))
(defun-gsl QR-Rsvx ((QR gsl-matrix-c) (x gsl-vector-c)) (defun-gsl QR-Rsvx (QR x)
"gsl_linalg_QR_Rsvx" "gsl_linalg_QR_Rsvx" ((QR gsl-matrix-c) (x gsl-vector-c))
:documentation "Solve the triangular system @math{R x = b} for @var{x} :documentation "Solve the triangular system @math{R x = b} for @var{x}
in-place. On input @var{x} should contain the right-hand side @math{b} in-place. On input @var{x} should contain the right-hand side @math{b}
and is replaced by the solution on output. This function may be useful if and is replaced by the solution on output. This function may be useful if
the product @math{b' = Q^T b} has already been computed using the product @math{b' = Q^T b} has already been computed using
QR-QTvec}." QR-QTvec}."
:invalidate (x) :invalidate (x))
:return-input (x))
(defun-gsl QR-unpack (defun-gsl QR-unpack (QR tau Q R)
((QR gsl-matrix-c) (tau gsl-vector-c) (Q gsl-matrix-c) (R gsl-matrix-c))
"gsl_linalg_QR_unpack" "gsl_linalg_QR_unpack"
((QR gsl-matrix-c) (tau gsl-vector-c) (Q gsl-matrix-c) (R gsl-matrix-c))
:documentation "Unpack the encoded @math{QR} decomposition :documentation "Unpack the encoded @math{QR} decomposition
(@var{QR},@var{tau}) into the matrices @var{Q} and @var{R}, where (@var{QR},@var{tau}) into the matrices @var{Q} and @var{R}, where
@var{Q} is @math{M}-by-@math{M} and @var{R} is @math{M}-by-@math{N}." @var{Q} is @math{M}-by-@math{M} and @var{R} is @math{M}-by-@math{N}."
:invalidate (Q R) :invalidate (Q R))
:return-input (Q R))
(defun-gsl QR-QRsolve (defun-gsl QR-QRsolve (Q R b x)
((Q gsl-matrix-c) (R gsl-matrix-c) (b gsl-vector-c) (x gsl-vector-c))
"gsl_linalg_QR_QRsolve" "gsl_linalg_QR_QRsolve"
((Q gsl-matrix-c) (R gsl-matrix-c) (b gsl-vector-c) (x gsl-vector-c))
:documentation "Solves the system @math{R x = Q^T b} for @var{x}. It can :documentation "Solves the system @math{R x = Q^T b} for @var{x}. It can
be used when the @math{QR} decomposition of a matrix is available in be used when the @math{QR} decomposition of a matrix is available in
unpacked form as (@var{Q}, @var{R})." unpacked form as (@var{Q}, @var{R})."
:invalidate (x) :invalidate (x))
:return-input (x))
(defun-gsl QR-update (defun-gsl QR-update (Q R w v)
((Q gsl-matrix-c) (R gsl-matrix-c) (w gsl-vector-c) (v gsl-vector-c))
"gsl_linalg_QR_update" "gsl_linalg_QR_update"
((Q gsl-matrix-c) (R gsl-matrix-c) (w gsl-vector-c) (v gsl-vector-c))
:documentation "Perform a rank-1 update @math{w v^T} of the @math{QR} :documentation "Perform a rank-1 update @math{w v^T} of the @math{QR}
decomposition (@var{Q}, @var{R}). The update is given by @math{Q'R' = Q decomposition (@var{Q}, @var{R}). The update is given by @math{Q'R' = Q
R + w v^T} where the output matrices @math{Q'} and @math{R'} are also R + w v^T} where the output matrices @math{Q'} and @math{R'} are also
orthogonal and right triangular. Note that @var{w} is destroyed by the orthogonal and right triangular. Note that @var{w} is destroyed by the
update." update."
:invalidate (w Q R) :invalidate (w Q R)
:return-input (Q R)) :return (Q R))
(defun-gsl R-solve ((R gsl-matrix-c) (b gsl-vector-c) (x gsl-vector-c)) (defun-gsl R-solve (R b x)
"gsl_linalg_R_solve" "gsl_linalg_R_solve" ((R gsl-matrix-c) (b gsl-vector-c) (x gsl-vector-c))
:documentation "Solves the triangular system @math{R x = b} for the :documentation "Solves the triangular system @math{R x = b} for the
@math{N}-by-@math{N} matrix @var{R}." @math{N}-by-@math{N} matrix @var{R}."
:invalidate (x) :invalidate (x))
:return-input (x))
(defun-gsl R-svx ((R gsl-matrix-c) (x gsl-vector-c)) (defun-gsl R-svx (R x)
"gsl_linalg_R_svx" "gsl_linalg_R_svx" ((R gsl-matrix-c) (x gsl-vector-c))
:documentation "Solve the triangular system @math{R x = b} in-place. On :documentation "Solve the triangular system @math{R x = b} in-place. On
input @var{x} should contain the right-hand side @math{b}, which is input @var{x} should contain the right-hand side @math{b}, which is
replaced by the solution on output." replaced by the solution on output."
:invalidate (x) :invalidate (x))
:return-input (x))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment