GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
chol.cc File Reference
#include "CmplxCHOL.h"
#include "dbleCHOL.h"
#include "fCmplxCHOL.h"
#include "floatCHOL.h"
#include "SparseCmplxCHOL.h"
#include "SparsedbleCHOL.h"
#include "oct-spparms.h"
#include "sparse-util.h"
#include "ov-re-sparse.h"
#include "ov-cx-sparse.h"
#include "defun-dld.h"
#include "error.h"
#include "gripes.h"
#include "oct-obj.h"
#include "utils.h"
Include dependency graph for chol.cc:

Go to the source code of this file.

Functions

 DEFUN_DLD (chol, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{R} =} chol (@var{A})\n\ @deftypefnx {Loadable Function} {[@var{R}, @var{p}] =} chol (@var{A})\n\ @deftypefnx {Loadable Function} {[@var{R}, @var{p}, @var{Q}] =} chol (@var{S})\n\ @deftypefnx {Loadable Function} {[@var{R}, @var{p}, @var{Q}] =} chol (@var{S}, \"vector\")\n\ @deftypefnx {Loadable Function} {[@var{L}, @dots{}] =} chol (@dots{}, \"lower\")\n\ @deftypefnx {Loadable Function} {[@var{L}, @dots{}] =} chol (@dots{}, \"upper\")\n\ @cindex Cholesky factorization\n\ Compute the Cholesky@tie{}factor, @var{R}, of the symmetric positive definite\n\ matrix @var{A}, where\n\ @tex\n\ $ R^T R = A $.\n\ @end tex\n\ @ifnottex\n\ \n\ @example\n\ @var{R}' * @var{R} = @var{A}.\n\ @end example\n\ \n\ @end ifnottex\n\ \n\ Called with one output argument @code{chol} fails if @var{A} or @var{S} is\n\ not positive definite. With two or more output arguments @var{p} flags\n\ whether the matrix was positive definite and @code{chol} does not fail. A\n\ zero value indicated that the matrix was positive definite and the @var{R}\n\ gives the factorization, and @var{p} will have a positive value otherwise.\n\ \n\ If called with 3 outputs then a sparsity preserving row/column permutation\n\ is applied to @var{A} prior to the factorization. That is @var{R}\n\ is the factorization of @code{@var{A}(@var{Q},@var{Q})} such that\n\ @tex\n\ $ R^T R = Q^T A Q$.\n\ @end tex\n\ @ifnottex\n\ \n\ @example\n\ @var{R}' * @var{R} = @var{Q}' * @var{A} * @var{Q}.\n\ @end example\n\ \n\ @end ifnottex\n\ \n\ The sparsity preserving permutation is generally returned as a matrix.\n\ However, given the flag @qcode{\"vector\"}, @var{Q} will be returned as a\n\ vector such that\n\ @tex\n\ $ R^T R = A (Q, Q)$.\n\ @end tex\n\ @ifnottex\n\ \n\ @example\n\ @var{R}' * @var{R} = @var{A}(@var{Q}, @var{Q}).\n\ @end example\n\ \n\ @end ifnottex\n\ \n\ Called with either a sparse or full matrix and using the @qcode{\"lower\"}\n\ flag, @code{chol} returns the lower triangular factorization such that\n\ @tex\n\ $ L L^T = A $.\n\ @end tex\n\ @ifnottex\n\ \n\ @example\n\ @var{L} * @var{L}' = @var{A}.\n\ @end example\n\ \n\ @end ifnottex\n\ \n\ For full matrices, if the @qcode{\"lower\"} flag is set only the lower\n\ triangular part of the matrix is used for the factorization, otherwise the\n\ upper triangular part is used.\n\ \n\ In general the lower triangular factorization is significantly faster for\n\ sparse matrices.\n\ @seealso{hess, lu, qr, qz, schur, svd, cholinv, chol2inv, cholupdate, cholinsert, choldelete, cholshift}\n\ @end deftypefn")
 DEFUN_DLD (cholinv, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} cholinv (@var{A})\n\ Use the Cholesky@tie{}factorization to compute the inverse of the\n\ symmetric positive definite matrix @var{A}.\n\ @seealso{chol, chol2inv, inv}\n\ @end deftypefn")
 DEFUN_DLD (chol2inv, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} chol2inv (@var{U})\n\ Invert a symmetric, positive definite square matrix from its Cholesky\n\ decomposition, @var{U}. Note that @var{U} should be an upper-triangular\n\ matrix with positive diagonal elements. @code{chol2inv (@var{U})}\n\ provides @code{inv (@var{U}'*@var{U})} but it is much faster than\n\ using @code{inv}.\n\ @seealso{chol, cholinv, inv}\n\ @end deftypefn")
 DEFUN_DLD (cholupdate, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{R1}, @var{info}] =} cholupdate (@var{R}, @var{u}, @var{op})\n\ Update or downdate a Cholesky@tie{}factorization. Given an upper triangular\n\ matrix @var{R} and a column vector @var{u}, attempt to determine another\n\ upper triangular matrix @var{R1} such that\n\ \n\ @itemize @bullet\n\ @item\n\ @var{R1}'*@var{R1} = @var{R}'*@var{R} + @var{u}*@var{u}'\n\ if @var{op} is @qcode{\"+\"}\n\ \n\ @item\n\ @var{R1}'*@var{R1} = @var{R}'*@var{R} - @var{u}*@var{u}'\n\ if @var{op} is @qcode{\"-\"}\n\ @end itemize\n\ \n\ If @var{op} is @qcode{\"-\"}, @var{info} is set to\n\ \n\ @itemize\n\ @item 0 if the downdate was successful,\n\ \n\ @item 1 if @var{R}'*@var{R} - @var{u}*@var{u}' is not positive definite,\n\ \n\ @item 2 if @var{R} is singular.\n\ @end itemize\n\ \n\ If @var{info} is not present, an error message is printed in cases 1 and 2.\n\ @seealso{chol, cholinsert, choldelete, cholshift}\n\ @end deftypefn")
 DEFUN_DLD (cholinsert, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{R1} =} cholinsert (@var{R}, @var{j}, @var{u})\n\ @deftypefnx {Loadable Function} {[@var{R1}, @var{info}] =} cholinsert (@var{R}, @var{j}, @var{u})\n\ Given a Cholesky@tie{}factorization of a real symmetric or complex Hermitian\n\ positive definite matrix @w{@var{A} = @var{R}'*@var{R}}, @var{R}@tie{}upper\n\ triangular, return the Cholesky@tie{}factorization of\n\ @var{A1}, where @w{A1(p,p) = A}, @w{A1(:,j) = A1(j,:)' = u} and\n\ @w{p = [1:j-1,j+1:n+1]}. @w{u(j)} should be positive.\n\ On return, @var{info} is set to\n\ \n\ @itemize\n\ @item 0 if the insertion was successful,\n\ \n\ @item 1 if @var{A1} is not positive definite,\n\ \n\ @item 2 if @var{R} is singular.\n\ @end itemize\n\ \n\ If @var{info} is not present, an error message is printed in cases 1 and 2.\n\ @seealso{chol, cholupdate, choldelete, cholshift}\n\ @end deftypefn")
 DEFUN_DLD (choldelete, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{R1} =} choldelete (@var{R}, @var{j})\n\ Given a Cholesky@tie{}factorization of a real symmetric or complex Hermitian\n\ positive definite matrix @w{@var{A} = @var{R}'*@var{R}}, @var{R}@tie{}upper\n\ triangular, return the Cholesky@tie{}factorization of @w{A(p,p)}, where\n\ @w{p = [1:j-1,j+1:n+1]}.\n\ @seealso{chol, cholupdate, cholinsert, cholshift}\n\ @end deftypefn")
 DEFUN_DLD (cholshift, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{R1} =} cholshift (@var{R}, @var{i}, @var{j})\n\ Given a Cholesky@tie{}factorization of a real symmetric or complex Hermitian\n\ positive definite matrix @w{@var{A} = @var{R}'*@var{R}}, @var{R}@tie{}upper\n\ triangular, return the Cholesky@tie{}factorization of\n\ @w{@var{A}(p,p)}, where @w{p} is the permutation @*\n\ @code{p = [1:i-1, shift(i:j, 1), j+1:n]} if @w{@var{i} < @var{j}} @*\n\ or @*\n\ @code{p = [1:j-1, shift(j:i,-1), i+1:n]} if @w{@var{j} < @var{i}}. @*\n\ \n\ @seealso{chol, cholupdate, cholinsert, choldelete}\n\ @end deftypefn")
template<class CHOLT >
static octave_value get_chol_l (const CHOLT &fact)
template<class CHOLT >
static octave_value get_chol_r (const CHOLT &fact)

Function Documentation

DEFUN_DLD ( chol  ,
args  ,
nargout   
)
DEFUN_DLD ( cholinv  ,
args   
)
DEFUN_DLD ( chol2inv  ,
args   
)
DEFUN_DLD ( cholupdate  ,
args  ,
nargout   
)
DEFUN_DLD ( cholinsert  ,
args  ,
nargout   
)
DEFUN_DLD ( choldelete  ,
args   
)
DEFUN_DLD ( cholshift  ,
args   
)
template<class CHOLT >
static octave_value get_chol_l ( const CHOLT &  fact)
static

Definition at line 57 of file chol.cc.

References MatrixType::Lower, and octave_value().

Referenced by DEFUN_DLD().

template<class CHOLT >
static octave_value get_chol_r ( const CHOLT &  fact)
static

Definition at line 49 of file chol.cc.

References octave_value(), and MatrixType::Upper.

Referenced by DEFUN_DLD().