#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"
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 'vector', @var{Q} will be returned as a vector\n\ 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 'lower' flag,\n\ @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 'lower' flag is set only the lower triangular part\n\ of the matrix is used for the factorization, otherwise the upper triangular\n\ part is used.\n\ \n\ In general the lower triangular factorization is significantly faster for\n\ sparse matrices.\n\ @seealso{cholinv, chol2inv}\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, cholinsert, choldelete}\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 (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\ @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}\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}\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\ @itemize @bullet\n\ @item\n\ @var{R1}'*@var{R1} = @var{R}'*@var{R} + @var{u}*@var{u}'\n\ if @var{op} is \"+\"\n\ \n\ @item\n\ @var{R1}'*@var{R1} = @var{R}'*@var{R} - @var{u}*@var{u}'\n\ if @var{op} is \"-\"\n\ @end itemize\n\ \n\ If @var{op} is \"-\", @var{info} is set to\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, qrupdate}\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) |
DEFUN_DLD | ( | chol | , | |
args | , | |||
nargout | ||||
) |
Definition at line 63 of file chol.cc.
References arg(), octave_value::columns(), octave_value::complex_matrix_value(), empty_arg(), error(), error_state, octave_value::float_complex_matrix_value(), octave_value::float_matrix_value(), get_chol_l(), get_chol_r(), gripe_wrong_type_arg(), octave_value::is_complex_type(), octave_value::is_real_type(), octave_value::is_single_type(), octave_value::is_sparse_type(), SparseComplexCHOL::L(), SparseCHOL::L(), octave_value::matrix_value(), octave_value(), SparseComplexCHOL::P(), SparseCHOL::P(), SparseComplexCHOL::perm(), SparseCHOL::perm(), print_usage(), SparseComplexCHOL::Q(), SparseCHOL::Q(), SparseComplexCHOL::R(), SparseCHOL::R(), octave_value::rows(), octave_value::sparse_complex_matrix_value(), octave_value::sparse_matrix_value(), ComplexMatrix::transpose(), Matrix::transpose(), FloatComplexMatrix::transpose(), and FloatMatrix::transpose().
DEFUN_DLD | ( | cholshift | , | |
args | ||||
) |
Definition at line 1236 of file chol.cc.
References octave_value::columns(), octave_value::complex_matrix_value(), error(), octave_value::float_complex_matrix_value(), octave_value::float_matrix_value(), get_chol_r(), octave_value::is_numeric_type(), octave_value::is_real_scalar(), octave_value::is_real_type(), octave_value::is_single_type(), octave_value::matrix_value(), print_usage(), octave_value::rows(), octave_value::scalar_value(), ComplexCHOL::set(), CHOL::set(), FloatComplexCHOL::set(), FloatCHOL::set(), ComplexCHOL::shift_sym(), CHOL::shift_sym(), FloatComplexCHOL::shift_sym(), and FloatCHOL::shift_sym().
DEFUN_DLD | ( | cholinv | , | |
args | ||||
) |
Definition at line 385 of file chol.cc.
References arg(), octave_value::columns(), octave_value::complex_matrix_value(), error(), error_state, octave_value::float_complex_matrix_value(), octave_value::float_matrix_value(), gripe_wrong_type_arg(), ComplexCHOL::inverse(), CHOL::inverse(), FloatComplexCHOL::inverse(), FloatCHOL::inverse(), SparseComplexCHOL::inverse(), SparseCHOL::inverse(), octave_value::is_complex_type(), octave_value::is_real_type(), octave_value::is_single_type(), octave_value::is_sparse_type(), octave_value::matrix_value(), print_usage(), octave_value::rows(), octave_value::sparse_complex_matrix_value(), and octave_value::sparse_matrix_value().
DEFUN_DLD | ( | cholinsert | , | |
args | , | |||
nargout | ||||
) |
Definition at line 844 of file chol.cc.
References octave_value::column_vector_value(), octave_value::columns(), octave_value::complex_column_vector_value(), octave_value::complex_matrix_value(), error(), octave_value::float_column_vector_value(), octave_value::float_complex_column_vector_value(), octave_value::float_complex_matrix_value(), octave_value::float_matrix_value(), get_chol_r(), ComplexCHOL::insert_sym(), CHOL::insert_sym(), FloatComplexCHOL::insert_sym(), FloatCHOL::insert_sym(), octave_value::is_numeric_type(), octave_value::is_real_scalar(), octave_value::is_real_type(), octave_value::is_single_type(), octave_value::matrix_value(), print_usage(), octave_value::rows(), octave_value::scalar_value(), ComplexCHOL::set(), CHOL::set(), FloatComplexCHOL::set(), and FloatCHOL::set().
DEFUN_DLD | ( | choldelete | , | |
args | ||||
) |
Definition at line 1103 of file chol.cc.
References octave_value::columns(), octave_value::complex_matrix_value(), ComplexCHOL::delete_sym(), CHOL::delete_sym(), FloatComplexCHOL::delete_sym(), FloatCHOL::delete_sym(), error(), octave_value::float_complex_matrix_value(), octave_value::float_matrix_value(), get_chol_r(), octave_value::is_numeric_type(), octave_value::is_real_scalar(), octave_value::is_real_type(), octave_value::is_single_type(), octave_value::matrix_value(), print_usage(), octave_value::rows(), octave_value::scalar_value(), ComplexCHOL::set(), CHOL::set(), FloatComplexCHOL::set(), and FloatCHOL::set().
DEFUN_DLD | ( | chol2inv | , | |
args | ||||
) |
Definition at line 532 of file chol.cc.
References arg(), chol2inv(), octave_value::columns(), octave_value::complex_matrix_value(), error_state, octave_value::float_complex_matrix_value(), octave_value::float_matrix_value(), gripe_wrong_type_arg(), octave_value::is_complex_type(), octave_value::is_real_type(), octave_value::is_single_type(), octave_value::is_sparse_type(), octave_value::matrix_value(), print_usage(), octave_value::rows(), octave_value::sparse_complex_matrix_value(), and octave_value::sparse_matrix_value().
DEFUN_DLD | ( | cholupdate | , | |
args | , | |||
nargout | ||||
) |
Definition at line 624 of file chol.cc.
References octave_value::column_vector_value(), octave_value::columns(), octave_value::complex_column_vector_value(), octave_value::complex_matrix_value(), ComplexCHOL::downdate(), CHOL::downdate(), FloatComplexCHOL::downdate(), FloatCHOL::downdate(), error(), octave_value::float_column_vector_value(), octave_value::float_complex_column_vector_value(), octave_value::float_complex_matrix_value(), octave_value::float_matrix_value(), get_chol_r(), octave_value::is_numeric_type(), octave_value::is_real_type(), octave_value::is_single_type(), octave_value::matrix_value(), print_usage(), octave_value::rows(), ComplexCHOL::set(), CHOL::set(), FloatComplexCHOL::set(), FloatCHOL::set(), ComplexCHOL::update(), CHOL::update(), FloatComplexCHOL::update(), and FloatCHOL::update().
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().
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().