Difference between revisions of "ApCoCoA-1:Num.LeastSquaresQR"

From ApCoCoAWiki
Line 10: Line 10:
 
Calculates the least squares solution to the general problem Ax=b, when there is no exact solution. The matrix Mat must have the same number of rows as Vec.
 
Calculates the least squares solution to the general problem Ax=b, when there is no exact solution. The matrix Mat must have the same number of rows as Vec.
 
The QR decompostion of Mat is used to find the solution.  
 
The QR decompostion of Mat is used to find the solution.  
 +
 +
<itemize>
 +
<item>@param <em>Mat</em> Matrix A</item>
 +
<item>@param <em>Vec</em> Vector B in matrix form.</item>
 +
<item>@return The least squares soltion to Ax=b.</item>
 +
</itemize>
  
 
<example>
 
<example>

Revision as of 16:35, 22 April 2009

Numerical.LeastSquaresQR

Calculates the least squares solution to the general problem Ax=b

Syntax

Num.LeastSquaresQR(Mat:Matrix, Vec:Matrix):Matrix;

Description

Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use

it/them. Please also note that you will have to use an ApCoCoAServer with enabled BLAS/LAPACK support.

Calculates the least squares solution to the general problem Ax=b, when there is no exact solution. The matrix Mat must have the same number of rows as Vec.

The QR decompostion of Mat is used to find the solution.

  • @param Mat Matrix A

  • @param Vec Vector B in matrix form.

  • @return The least squares soltion to Ax=b.

Example

Dec(Num.LeastSquaresQR([[1,1],[0,1],[1,1]],[[0],[1],[0]]),2);
-- CoCoAServer: computing Cpu Time = 0
-------------------------------
Mat([
  ["-0.99"],
  ["1"]
])
-------------------------------

See also

Introduction to CoCoAServer