Computes the matrix inner (or "dot") product.
INNERPROD(a, b,"op1", "op2")
a |
- |
A rectangular array. |
b |
- |
A rectangular array with as many rows as a has columns. |
"op1" |
- |
A string. The first binary operator. |
"op2" |
- |
A string. The second binary operator. |
An array where entry of the result is computed from a row of a and a column of b.
a = {{0, 1, 2},
{3, 4, 5}}
b = {{4, 0},
{3, 2},
{0, 1}}
innerprod(a, b, '+', '*')
returns an array with the values:
{{ 3, 4},
{24, 13}}
innerprod(a, b, '+', '-')
returns an array with the values:
{{ 4, 0},
{-5, -9}}
If W1 and W2 contain conforming matrices, this expression results in their "matrix product." That is:
innerprod(W1, W2, "+", "*") is numerically equivalent to W1 *^ W2.
For an entry in the i^{th} row and the j^{th} column in the output array, the value is equivalent to:
reduce(transpose(row(a, i)) op2 col(b, j), op1)
The number of columns in a must be equal to the number of rows in b. The number of rows in the output array is equal to the number of rows in a, and the number of columns in the output array is equal to the number of columns in b.
Binary operators include the arithmetic and logical operators. The "Exclusive OR" operator is represented by the string "XOR".