ludcomp
Contents: Description, Arguments, Usage, Examples, Related Functions Supported Under Version: >1.69 Current Davinci Version: 2.27 64-bit Safe: No
Description Returns LU decomposition of a square matrix
Arguments and Return Values Arguments: A square two-dimensional numeric array, and an optional second input specifying whether to return a structure with more information Return Value: The matrices L and U combined into one array, or, if s=1, a structure with LU and other fields
Usage Syntax: ludcomp(object = VAR) The function minvert uses this same LU decomposition routine (plus some additional steps) to invert a matrix. The input matrix must be two-dimensional and square (dimensions [n, n, 1]). Note that LU as calculated by this function is the LU decomposition of a row permutation of the input, not necessarily of the original input. The LU matrix from ludcomp() is always of type double.
Examples dv> ludcomp(?) ludcomp() - LU decomposition of a square matrix ludcomp(obj=VAR, [s=0|1]) This function returns the LU decomposition of a row permutation of the input matrix, with L and U combined into one matrix. The values on the diagonal represent the corresponding values of U. It is assumed that the values along the diagonal of L are all 1. If given a nonzero second input (which can be passed by value, or passed by reference as s), the function will return a structure with the fields lu (the decomposed matrix), d (an integer with a value of +1 or -1, which can be used along with lu to find the input matrix's determinant), and indx (an array of integers indicating the row permutations used by the algorithm). Valid inputs for ludcomp, given a square matrix a: dv> ludcomp(a) dv> ludcomp(a, 0) dv> ludcomp(a, s=0) dv> ludcomp(a, 1) dv> ludcomp(a, s=1) dv> a = cat(1//2//3, 1//4//9, 1//8//27, axis=y) 3x3x1 array of int, bsq format [36 bytes] 1 2 3 1 4 9 1 8 27 dv> ludcomp(a) 3x3x1 array of double, bsq format [72 bytes] 1.0000000 2.0000000 3.0000000 1.0000000 6.0000000 24.000000 1.0000000 0.33333333 -2.0000000 dv> ludcomp(a, 0) 3x3x1 array of double, bsq format [72 bytes] 1.0000000 2.0000000 3.0000000 1.0000000 6.0000000 24.000000 1.0000000 0.33333333 -2.0000000 dv> ludcomp(a, s=0) 3x3x1 array of double, bsq format [72 bytes] 1.0000000 2.0000000 3.0000000 1.0000000 6.0000000 24.000000 1.0000000 0.33333333 -2.0000000 dv> b = ludcomp(a, s=1) struct, 3 elements lu: 3x3x1 array of double, bsq format [72 bytes] d: -1 indx: 3x1x1 array of int, bsq format [12 bytes] dv> b.lu 3x3x1 array of double, bsq format [72 bytes] 1.0000000 2.0000000 3.0000000 1.0000000 6.0000000 24.000000 1.0000000 0.33333333 -2.0000000 dv> b.d -1 dv> b.indx 3x1x1 array of int, bsq format [12 bytes] 1 3 3 |
DavinciWiki Mini-Nav Bar Contents
Contact Developers
All other topics
Recent Core Changes Modified On: 12-04-2010 |