COVARIANCE - matrix covariance calculations

This procedure calculates the column covariance estimator of the specified matrix.

Usage

The COVARAINCE stored procedure has the following syntax:
COVARAINCE(inputMatrix,outputMatrix)
Parameters
inputMatrix
The name of the input matrix.
Type: NVARCHAR(ANY)
outputMatrix
The name of the output matrix.
Type: NVARCHAR(ANY)
Returns
BOOLEAN TRUE always.

Details

The procedure calculates the column covariance estimator of the specified matrix, by centering each column and performing X^T X multiplication, divided by (n-1), where n is the number of rows of the provided matrix.

Examples

CALL nzm..create_ones_matrix('A', 5, 5);
CALL nzm..set_value('A', 1, 2, 2);
CALL nzm..set_value('A', 1, 3, 3);
CALL nzm..covariance('A', 'ACOVARIANCE');
CALL nzm..PRINT('A');
CALL nzm..PRINT('ACOVARIANCE');
CALL nzm..DELETE_MATRIX('A' );
CALL nzm..DELETE_MATRIX('ACOVARIANCE');

 CREATE_ONES_MATRIX
--------------------
 t
(1 row)

 SET_VALUE
-----------
 t
(1 row)

 SET_VALUE
-----------
 t
(1 row)

 COVARIANCE
------------
 t
(1 row)

                                     PRINT
---------------------------------------------------------------------------------------
--matrix:A --
1, 2, 3, 1, 1
1, 1, 1, 1, 1
1, 1, 1, 1, 1
1, 1, 1, 1, 1
1, 1, 1, 1, 1
(1 row)

                                                PRINT
---------------------------------------------------------------------------------------------------------
 -- matrix: ACOVARIANCE --
0, 0, 0, 0, 0
0, 0.2, 0.4, 0, 0
0, 0.4, 0.8, 0, 0
0, 0, 0, 0, 0
0, 0, 0, 0, 0
(1 row)

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

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