DADiSP Worksheet Functions > Function Categories > Matrix Math and Special Matrices > CROSSPROD

 

CROSSPROD

Purpose:

Computes the matrix cross product.

Syntax:

CROSSPROD(A)

CROSSPROD(A, B)

A

-

A matrix.

B

-

A matrix

Returns:

A matrix, the cross product.

Example:

W1: {{1, 3, 4},

     {5, 7, 9}, 

     {8, 9, 12}} 

 

W2: {{1, 3, 2},

     {2, 4, 5}, 

     {1, 2, 0}} 

 

crossprod(W1,W2) == {{19, 39, 27},

                     {26, 55, 41},

                     {34, 72, 53}} 

 

W1' *^ W2        == {{19, 39, 27},

                     {26, 55, 41},

                     {34, 72, 53}} 

 

(W2' *^ W1)'     == {{19, 39, 27},

                     {26, 55, 41},

                     {34, 72, 53}} 

Example:

W1: 1..10

W2: {sum(w1 * w1)}

W3: crossprod(w1)

 

W2 == W3 == 385, the sum of squares of the series in W1.

Remarks:

crossprod(a, b) is equivalent to a' *^ b or (b' *^ a)', however, CROSSPROD is optimized for speed.

 

For complex matrices, the conjugate (Hermitian) transpose is computed, i.e crossprod(a, b) == a~^ *^ b.

 

The matrix cross product is a common calculation when computing least squares curve fitting. See LINFIT for a least squares implementation that uses multiple calculation methods.

 

See DADiSP/MatrixXL to significantly optimize CROSSPROD.

See Also:

*^ (Matrix Multiply)

\^ (Matrix Solve)

DADiSP/MatrixXL

INNERPROD

INTERPOSE

INVERSE

LINFIT

MDIV

OUTERPROD

REDUCE

TRANSPOSE

TRANSPOSECONJ