LA_LEAST_SQUARE_EQUALITY
Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also
The LA_LEAST_SQUARE_EQUALITY function is used to solve the linear least-squares problem:
Minimizex ||Ax - c||2 with constraint Bx = d
where A is an n-column by m-row array, B is an n-column by p-row array, c is an m-element input vector, and d is an p-element input vector with p ≤ n ≤ m+p. If B has
full row rank p and the array
has full column rank n, then a unique solution exists.
LA_ LEAST_SQUARE_EQUALITY is based on the following LAPACK routines:
|
Output Type
|
LAPACK Routine
|
|---|---|
| Float |
|
| Double |
|
| Complex |
|
| Double complex |
|
For details see Anderson et al., LAPACK Users' Guide, 3rd ed., SIAM, 1999.
Syntax
Result = LA_LEAST_SQUARE_EQUALITY( A, B, C, D [, /DOUBLE] [, RESIDUAL=variable] )
Return Value
The result (x) is an n-element vector.
Arguments
A
The n-by-m array used in the least-squares minimization.
B
The n-by-p array used in the equality constraint.
C
An m-element input vector containing the right-hand side of the least-squares system.
D
A p-element input vector containing the right-hand side of the equality constraint.
Keywords
DOUBLE
Set this keyword to use double-precision for computations and to return a double-precision (real or complex) result. Set DOUBLE = 0 to use single-precision for computations and to return a single-precision (real or complex) result. The default is /DOUBLE if A is double precision, otherwise the default is DOUBLE = 0.
RESIDUAL
Set this keyword to a named variable in which to return a scalar giving the residual sum-of-squares for Result. If n = m + p then RESIDUAL will be zero.
Examples
Given the following system of equations:
with constraints,
find the solution using the following code:
IDL prints:
Version History
See Also
LA_GM_LINEAR_MODEL, LA_LEAST_SQUARES