f08aa solves linear least squares problems of the form
where is an by real matrix of full rank, using a or factorization of .
- Type: System..::..StringOn entry: if , the linear system involves .If , the linear system involves .Constraint: or .
- Type: System..::..Int32On entry: , the number of rows of the matrix .Constraint: .
- Type: System..::..Int32On entry: , the number of columns of the matrix .Constraint: .
- Type: System..::..Int32On entry: , the number of right-hand sides, i.e., the number of columns of the matrices and .Constraint: .
- 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 .
- 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.
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 .
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
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.
See Section 4.5 of Anderson et al. (1999) for details of error bounds.
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.
This example solves the linear least squares problem
The square root of the residual sum of squares is also output.