Functions

lu.cc File Reference

#include "CmplxLU.h"
#include "dbleLU.h"
#include "fCmplxLU.h"
#include "floatLU.h"
#include "SparseCmplxLU.h"
#include "SparsedbleLU.h"
#include "defun-dld.h"
#include "error.h"
#include "gripes.h"
#include "oct-obj.h"
#include "utils.h"
#include "ov-re-sparse.h"
#include "ov-cx-sparse.h"
Include dependency graph for lu.cc:

Go to the source code of this file.

Functions

static bool check_lu_dims (const octave_value &l, const octave_value &u, const octave_value &p)
 DEFUN_DLD (luupdate, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{L}, @var{U}] =} luupdate (@var{L}, @var{U}, @var{x}, @var{y})\n\ @deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}] =} luupdate (@var{L}, @var{U}, @var{P}, @var{x}, @var{y})\n\ Given an LU@tie{}factorization of a real or complex matrix\n\ @w{@var{A} = @var{L}*@var{U}}, @var{L}@tie{}lower unit trapezoidal and\n\ @var{U}@tie{}upper trapezoidal, return the LU@tie{}factorization\n\ of @w{@var{A} + @var{x}*@var{y}.'}, where @var{x} and @var{y} are\n\ column vectors (rank-1 update) or matrices with equal number of columns\n\ (rank-k update).\n\ Optionally, row-pivoted updating can be used by supplying\n\ a row permutation (pivoting) matrix @var{P};\n\ in that case, an updated permutation matrix is returned.\n\ Note that if @var{L}, @var{U}, @var{P} is a pivoted LU@tie{}factorization\n\ as obtained by @code{lu}:\n\ \n\ @example\n\ [@var{L}, @var{U}, @var{P}] = lu (@var{A});\n\ @end example\n\ \n\ @noindent\n\ then a factorization of @xcode{@var{A}+@var{x}*@var{y}.'} can be obtained\n\ either as\n\ \n\ @example\n\ [@var{L1}, @var{U1}] = lu (@var{L}, @var{U}, @var{P}*@var{x}, @var{y})\n\ @end example\n\ \n\ @noindent\n\ or\n\ \n\ @example\n\ [@var{L1}, @var{U1}, @var{P1}] = lu (@var{L}, @var{U}, @var{P}, @var{x}, @var{y})\n\ @end example\n\ \n\ The first form uses the unpivoted algorithm, which is faster, but less\n\ stable. The second form uses a slower pivoted algorithm, which is more\n\ stable.\n\ \n\ The matrix case is done as a sequence of rank-1 updates;\n\ thus, for large enough k, it will be both faster and more accurate to\n\ recompute the factorization from scratch.\n\ @seealso{lu, qrupdate, cholupdate}\n\ @end deftypefn")
 DEFUN_DLD (lu, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{L}, @var{U}] =} lu (@var{A})\n\ @deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}] =} lu (@var{A})\n\ @deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} lu (@var{S})\n\ @deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}, @var{Q}, @var{R}] =} lu (@var{S})\n\ @deftypefnx {Loadable Function} {[@dots{}] =} lu (@var{S}, @var{thres})\n\ @deftypefnx {Loadable Function} {@var{y} =} lu (@dots{})\n\ @deftypefnx {Loadable Function} {[@dots{}] =} lu (@dots{}, 'vector')\n\ @cindex LU decomposition\n\ Compute the LU@tie{}decomposition of @var{A}. If @var{A} is full\n\ subroutines from\n\ @sc{lapack} are used and if @var{A} is sparse then @sc{umfpack} is used. The\n\ result is returned in a permuted form, according to the optional return\n\ value @var{P}. For example, given the matrix @code{a = [1, 2; 3, 4]},\n\ \n\ @example\n\ [l, u, p] = lu (@var{a})\n\ @end example\n\ \n\ @noindent\n\ returns\n\ \n\ @example\n\ @group\n\ l =\n\ \n\ 1.00000 0.00000\n\ 0.33333 1.00000\n\ \n\ u =\n\ \n\ 3.00000 4.00000\n\ 0.00000 0.66667\n\ \n\ p =\n\ \n\ 0 1\n\ 1 0\n\ @end group\n\ @end example\n\ \n\ The matrix is not required to be square.\n\ \n\ When called with two or three output arguments and a spare input matrix,\n\ @code{lu} does not attempt to perform sparsity preserving column\n\ permutations. Called with a fourth output argument, the sparsity\n\ preserving column transformation @var{Q} is returned, such that\n\ @code{@var{P} * @var{A} * @var{Q} = @var{L} * @var{U}}.\n\ \n\ Called with a fifth output argument and a sparse input matrix,\n\ @code{lu} attempts to use a scaling factor @var{R} on the input matrix\n\ such that\n\ @code{@var{P} * (@var{R} \\ @var{A}) * @var{Q} = @var{L} * @var{U}}.\n\ This typically leads to a sparser and more stable factorization.\n\ \n\ An additional input argument @var{thres}, that defines the pivoting\n\ threshold can be given. @var{thres} can be a scalar, in which case\n\ it defines the @sc{umfpack} pivoting tolerance for both symmetric and\n\ unsymmetric cases. If @var{thres} is a 2-element vector, then the first\n\ element defines the pivoting tolerance for the unsymmetric @sc{umfpack}\n\ pivoting strategy and the second for the symmetric strategy. By default,\n\ the values defined by @code{spparms} are used ([0.1, 0.001]).\n\ \n\ Given the string argument 'vector', @code{lu} returns the values of @var{P}\n\ and @var{Q} as vector values, such that for full matrix, @code{@var{A}\n\ (@var{P},:) = @var{L} * @var{U}}, and @code{@var{R}(@var{P},:) * @var{A}\n\ (:, @var{Q}) = @var{L} * @var{U}}.\n\ \n\ With two output arguments, returns the permuted forms of the upper and\n\ lower triangular matrices, such that @code{@var{A} = @var{L} * @var{U}}.\n\ With one output argument @var{y}, then the matrix returned by the @sc{lapack}\n\ routines is returned. If the input matrix is sparse then the matrix @var{L}\n\ is embedded into @var{U} to give a return value similar to the full case.\n\ For both full and sparse matrices, @code{lu} loses the permutation\n\ information.\n\ @end deftypefn")
template<class MT >
static octave_value get_lu_l (const base_lu< MT > &fact)
template<class MT >
static octave_value get_lu_u (const base_lu< MT > &fact)

Function Documentation

static bool check_lu_dims ( const octave_value l,
const octave_value u,
const octave_value p 
) [static]
DEFUN_DLD ( luupdate  ,
args   
)
DEFUN_DLD ( lu  ,
args  ,
nargout   
)
template<class MT >
static octave_value get_lu_l ( const base_lu< MT > &  fact  )  [static]

Definition at line 44 of file lu.cc.

References base_lu< lu_type >::L(), and MatrixType::Lower.

Referenced by DEFUN_DLD().

template<class MT >
static octave_value get_lu_u ( const base_lu< MT > &  fact  )  [static]

Definition at line 55 of file lu.cc.

References base_lu< lu_type >::regular(), base_lu< lu_type >::U(), and MatrixType::Upper.

Referenced by DEFUN_DLD().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines