Programmer Guide/Command Reference/EVAL/rleqs: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:rleqs, cleqs}}
{{DISPLAYTITLE:rleqs, cleqs}}
These functions implements an interface for the LAPACK functions DGESV, ZGESV, DGELS and ZGELS.
These functions implements an interface for the [http://www.netlib.org/lapack LAPACK] functions DGESV, ZGESV, DGELS and ZGELS.
;Usage: <code>rleqs(<var>A</var>, <var>B</var> {, <var>alg</var>})</code>:
;Usage:  
:{|class="keinrahmen"
|<code>rleqs(<var>A</var>, <var>B</var> {, <var>alg</var>})</code>  
|... uses functions DGESV and DGELS;
|arguments ''A'', ''B'' and result ''X'' are real
|-
|<code>cleqs(<var>A</var>, <var>B</var> {, <var>alg</var>})</code>
|... uses functions ZGESV and ZGELS;
|arguments ''A'', ''B'' and result ''X'' are complex
|}
:;<var>A</var>: left side MxN matrix ''x''
:;<var>A</var>: left side MxN matrix ''x''
:;<var>B</var>: right side vector or MxL matrix (for multiple solutions)
:;<var>B</var>: right side vector with M elements (one solution) or MxNHRS matrix (multiple solutions)
:;<var>alg</var>: select a LAPACK algorithm to be used  
:;<var>alg</var>: select a LAPACK algorithm to be used  
::{class="keinrahmen"
:::{|class="keinrahmen"
|''alg''='''0''' || use DGESV if M=N and DGELS otherwise
|''alg''='''0''' ||... ||use DGESV if M=N and DGELS otherwise
|-
|-
|''alg''='''1''' || use always DGESV, M must be equal to N
|''alg''='''1''' ||... ||use always DGESV, M must be equal to N
|-
|-
|''alg''='''2''' || use always DGELS
|''alg''='''2''' ||... || use always DGELS
|}
|}
;Description:
;Description:  
:;<var>m</var>: the regression (polynom) order; m>0 (default=1)
:The function DGESV (ZGESV) solves a linear equation system.
;Result: Approximate the function ''y'' using polynominal regression. The result is the vector ''r'' with the ''m''+1 coefficients of the regression polynom.
::*<code>''A''[M x M] * ''X''[M x NRHS] = ''B''[M x NRHS]</code>
::<code>''y''<sub>REG</sub>[i] = ''r''[0] + ''r''[1]*''x''[i] {+ ''r''[2]*''x''[i]^2 + .. + ''r''[''m'']*''x''[i]^''m''}</code>
:The function DGELS (ZGELS) can be used to find the least squares solution of an overdetermined system (M&ge;N) or the minimum norm solution of an underdetermined system (M<N).
 
::*<code>'''M&ge;N:''' minimize || ''B[M x NRHS] - ''A''[M x N] * ''X''[M x NRHS] ||</code>
Note: The function <code>cleqs(<var>A</var>, <var>B</var> {, <var>alg</var>})</code> has the same arguments and result as <code>rleqs</code>, but the vectors/matrices ''A'', ''B'' and ''X'' are [[Programmer_Guide/Command_Reference/EVAL/complex arithmetic|complex]].
::*<code>'''M<N:''' ''A''[M x M] * ''X''[M x NRHS] = ''B''[M x NRHS]</code>
 
:A detailed description of the LAPACK functions can be found at [http://www.netlib.org/lapack www.netlib.org].
 
;Result: The result ''X'' has the same type as the argument ''B'' and contains one solution per column.
;See also: [[Programmer_Guide/Command_Reference/EVAL/rpoly|rpoly]], [[Programmer_Guide/Command_Reference/EVAL/interp|interp]], [[Programmer_Guide/Command_Reference/EVAL/rleqs|rleqs, cleqs]]
;See also: [[../rpolyreg|rpolyreg]], [[../complex arithmetic|complex arithmetic]], [[../svd|svd]]


[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
[[../#Functions|<function list>]]

Latest revision as of 19:08, 21 April 2011

These functions implements an interface for the LAPACK functions DGESV, ZGESV, DGELS and ZGELS.

Usage
rleqs(A, B {, alg}) ... uses functions DGESV and DGELS; arguments A, B and result X are real
cleqs(A, B {, alg}) ... uses functions ZGESV and ZGELS; arguments A, B and result X are complex
A
left side MxN matrix x
B
right side vector with M elements (one solution) or MxNHRS matrix (multiple solutions)
alg
select a LAPACK algorithm to be used
alg=0 ... use DGESV if M=N and DGELS otherwise
alg=1 ... use always DGESV, M must be equal to N
alg=2 ... use always DGELS
Description
The function DGESV (ZGESV) solves a linear equation system.
  • A[M x M] * X[M x NRHS] = B[M x NRHS]
The function DGELS (ZGELS) can be used to find the least squares solution of an overdetermined system (M≥N) or the minimum norm solution of an underdetermined system (M<N).
  • M≥N: minimize || B[M x NRHS] - A[M x N] * X[M x NRHS] ||
  • M<N: A[M x M] * X[M x NRHS] = B[M x NRHS]
A detailed description of the LAPACK functions can be found at www.netlib.org.
Result
The result X has the same type as the argument B and contains one solution per column.
See also
rpolyreg, complex arithmetic, svd

<function list>

Navigation menu

Personal tools