]> Creatis software - CreaPhase.git/blob - octave_packages/communications-1.1.1/@galois/lu.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / communications-1.1.1 / @galois / lu.m
1 ## Copyright (C) 2011 David Bateman
2 ##
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
6 ## version.
7 ##
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 ## details.
12 ##
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
15
16 ## -*- texinfo -*-
17 ## @deftypefn {Loadable Function} {[@var{l}, @var{u}, @var{p}] =} lu (@var{a})
18 ## @cindex LU decomposition of Galois matrix
19 ## Compute the LU decomposition of @var{a} in a Galois Field. The result is
20 ## returned in a permuted form, according to the optional return value
21 ## @var{p}.  For example, given the matrix
22 ## @code{a = gf([1, 2; 3, 4],3)},
23 ## 
24 ## @example
25 ## [l, u, p] = lu (a)
26 ## @end example
27 ## 
28 ## @noindent
29 ## returns
30 ## 
31 ## @example
32 ## l =
33 ## GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
34 ## 
35 ## Array elements = 
36 ## 
37 ##   1  0
38 ##   6  1
39 ## 
40 ## u =
41 ## GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
42 ## 
43 ## Array elements = 
44 ## 
45 ##   3  4
46 ##   0  7
47 ## 
48 ## p =
49 ## 
50 ##   0  1
51 ##   1  0
52 ## @end example
53 ## 
54 ## Such that @code{@var{p} * @var{a} = @var{l} * @var{u}}. If the argument
55 ## @var{p} is not included then the permutations are applied to @var{l}
56 ## so that @code{@var{a} = @var{l} * @var{u}}. @var{l} is then a pseudo-
57 ## lower triangular matrix. The matrix @var{a} can be rectangular.
58 ## @end deftypefn
59
60 function varargout = lu (varargin)
61   varargout = cell (1, max(1, nargout));
62   [varargout{:}] = glu (varargin{:});
63 endfunction