SOLVE_LINEAR_LEAST_SQUARES

This procedure finds the linear least squares solution X to the matrix equation A X = B.

Usage

The SOLVE_LINEAR_LEAST_SQUARES stored procedure has the following syntax:
SOLVE_LINEAR_LEAST_SQUARES(matrixA,matrixB,matrixX)
Parameters
matrixA
The name of input matrix A.
Type: NVARCHAR(ANY)
matrixB
The name of input matrix B.
Type: NVARCHAR(ANY)
matrixX
The name of output matrix X.
Type: NVARCHAR(ANY)
Returns
BOOLEAN TRUE always.

Details

This procedure assumes that matrix A has full rank.

Examples

CALL nzm..shape('1,2,3,4,5,0,6,7,8',3,3,'A');
CALL nzm..shape('10,500,10,-900',3,3,'B');
CALL nzm..solve_linear_least_squares('A','B','X');
CALL nzm..print('X');
CALL nzm..delete_matrix('A');
CALL nzm..delete_matrix('B');
CALL nzm..delete_matrix('X');

 SHAPE
-------
 t
(1 row)

 SHAPE
-------
 t
(1 row)

 SOLVE_LINEAR_LEAST_SQUARES
----------------------------
 t
(1 row)

                                       PRINT
----------------------------------------------------------------------------------------
 -- matrix: X --
 141.66666666667, -1118.3333333333, -91.666666666666 
 -293.33333333333, 896.66666666667, 173.33333333333
 151.66666666667, -58.333333333333, -81.666666666667 
(1 row)

 DELETE_MATRIX
---------------
 t
(1 row)

 DELETE_MATRIX
---------------
 t
(1 row)

 DELETE_MATRIX
---------------
 t
(1 row)