LINEAR_COMBO - linear combination of matrix components

This procedure implements linear combination of matrix components, computing matC:=aVal*matA^transposeA + bVal*matB^transposeB + cVal. Here, matA and matB are input matrices, matC is an output matrix, aVal, bVal, and cVal are coefficients, and transposeA and transposeB are boolean parameters indicating whether matA and matB should be transposed during the operation.

Usage

The LINEAR_COMBINATION stored procedure has the following syntax:
LINEAR_COMBINATION(matrixA,transposeA,aValue,matrixB,transposeB,bValue,cValue,matrixC)
Parameters
matrixA
The name of the input matrix A.
Type: NVARCHAR(ANY)
tranposeA
Specifies whether matrix A must be transposed.
Type: BOOLEAN
aValue
The value of the factor a.
Type: DOUBLE
matrixB
The name of the input matrix B.
Type: NVARCHAR(ANY)
tranposeB
Specifies whether matrix B must be transposed.
Type: BOOLEAN
bValue
The value of the factor b.
Type: DOUBLE
cValue
The value of the factor c.
Type: DOUBLE
matrixC
The name of the output matrix C.
Type: NVARCHAR(ANY)
Returns
BOOLEAN TRUE always.

Examples

CALL nzm..create_ones_matrix('A', 4, 4); 
CALL nzm..set_value('A', 1, 2, 2);
CALL nzm..set_value('A', 1, 3, 3);
CALL nzm..set_value('A', 1, 4, 4);
CALL nzm..create_identity_matrix('B', 4); 
CALL nzm..set_value('B', 4, 1, 10);
CALL nzm..linear_combination('A', FALSE, 1.5, 'B', FALSE, 1, 1, 'AB');
CALL nzm..linear_combination('A', TRUE, 1.5, 'B', FALSE, 1, 1, 'AtB');
CALL nzm..linear_combination('A', FALSE, 1.5, 'B', TRUE, 1, 1, 'ABt');
CALL nzm..linear_combination('A', TRUE, 1.5, 'B', TRUE, 1, 1, 'AtBt');
CALL nzm..print('A');
CALL nzm..print('B');
CALL nzm..print('AB');
CALL nzm..print('AtB');
CALL nzm..print('ABt');
CALL nzm..print('AtBt');
CALL nzm..delete_matrix('A');
CALL nzm..delete_matrix('B');
CALL nzm..delete_matrix('AB');
CALL nzm..delete_matrix('AtB');
CALL nzm..delete_matrix('ABt');
CALL nzm..delete_matrix('AtBt');

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

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

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

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

 CREATE_IDENTITY_MATRIX
------------------------
 t
(1 row)

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

 LINEAR_COMBINATION
--------------------
 t
(1 row)

 LINEAR_COMBINATION
--------------------
 t
(1 row)

 LINEAR_COMBINATION
--------------------
 t
(1 row)

 LINEAR_COMBINATION
--------------------
 t
(1 row)

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

                             PRINT
--------------------------------------------------------------
 -- matrix: B --
 1, 0, 0, 0
 0, 1, 0, 0
 0, 0, 1, 0
 10, 0, 0, 1
(1 row)

                             PRINT
---------------------------------------------------------------
 -- matrix: AB--
 3.5, 4,5. 5, 7
 2.5, 3.5, 2.5, 2.5
 2.5, 2.5, 3.5, 2.5
 12.5, 2.5, 2.5, 3.5
(1 row)

                             PRINT
---------------------------------------------------------------
 -- matrix: AtB --
 3.5, 2.5, 2.5, 2.5
 4, 3.5, 2.5, 2.5
 5.5, 2.5, 3.5, 2.5
 17, 2.5, 2.5, 3.5
(1 row)

                             PRINT
---------------------------------------------------------------
-- matrix: ABt --
 3.5, 4, 5.5, 17
 2.5, 3.5, 2.5, 2.5
 2.5, 2.5, 3.5, 2.5
 2.5, 2.5, 2.5, 3.5
(1 row)

                            PRINT
---------------------------------------------------------------
-- matrix: AtBt --
 3.5, 2.5, 2.5, 12.5
 4, 3.5, 2.5, 2.5
 5.5, 2.5, 3.5, 2.5
 7, 2.5, 2.5, 3.5
(1 row)

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

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

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

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

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

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