f08aa solves linear least squares problems of the form
where is an by real matrix of full rank, using a or factorization of .
Syntax
C# |
---|
public static void f08aa( string trans, int m, int n, int nrhs, double[,] a, double[,] b, out int info ) |
Visual Basic |
---|
Public Shared Sub f08aa ( _ trans As String, _ m As Integer, _ n As Integer, _ nrhs As Integer, _ a As Double(,), _ b As Double(,), _ <OutAttribute> ByRef info As Integer _ ) |
Visual C++ |
---|
public: static void f08aa( String^ trans, int m, int n, int nrhs, array<double,2>^ a, array<double,2>^ b, [OutAttribute] int% info ) |
F# |
---|
static member f08aa : trans : string * m : int * n : int * nrhs : int * a : float[,] * b : float[,] * info : int byref -> unit |
Parameters
- trans
- Type: System..::..StringOn entry: if , the linear system involves .If , the linear system involves .Constraint: or .
- m
- Type: System..::..Int32On entry: , the number of rows of the matrix .Constraint: .
- n
- Type: System..::..Int32On entry: , the number of columns of the matrix .Constraint: .
- nrhs
- Type: System..::..Int32On entry: , the number of right-hand sides, i.e., the number of columns of the matrices and .Constraint: .
- a
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, dim2]Note: dim1 must satisfy the constraint:Note: the second dimension of the array a must be at least .On entry: the by matrix .
- b
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, dim2]Note: dim1 must satisfy the constraint:Note: the second dimension of the array b must be at least .On entry: the matrix of right-hand side vectors, stored in columns; b is by if , or by if .On exit: b is overwritten by the solution vectors, , stored in columns:
- if and , or and , elements to in each column of b contain the least squares solution vectors; the residual sum of squares for the solution is given by the sum of squares of the modulus of elements to in that column;
- otherwise, elements to in each column of b contain the minimum norm solution vectors.
- info
- Type: System..::..Int32%On exit: unless the method detects an error (see [Error Indicators and Warnings]).
Description
The following options are provided:
1. | If and : find the least squares solution of an overdetermined system, i.e., solve the least squares problem
|
||
2. | If and : find the minimum norm solution of an underdetermined system . | ||
3. | If and : find the minimum norm solution of an undetermined system . | ||
4. | If and : find the least squares solution of an overdetermined system, i.e., solve the least squares problem
|
Several right-hand side vectors and solution vectors can be handled in a single call; they are stored as the columns of the by right-hand side matrix and the by solution matrix .
References
Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Error Indicators and Warnings
Some error messages may refer to parameters that are dropped from this interface
(LDA, LDB) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
- If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
- If , diagonal element of the triangular factor of is zero, so that does not have full rank; the least squares solution could not be computed.
Accuracy
See Section 4.5 of Anderson et al. (1999) for details of error bounds.
Parallelism and Performance
None.
Further Comments
The total number of floating-point operations required to factorize is approximately if and otherwise. Following the factorization the solution for a single vector requires operations.
The complex analogue of this method is f08an.
Example
This example solves the linear least squares problem
where
The square root of the residual sum of squares is also output.
Example program (C#): f08aae.cs