# Operator ( .* )

#### static member ( .* ): Tensor<'T> * Tensor<'T> -> Tensor<'T>

Computes the (batched) matrix product, (batched) matrix-vector product or scalar product.

##### Declaration

`static member ( .* ): a:Tensor<'T> * b:Tensor<'T> -> Tensor<'T>`

##### Parameters

Type | Name | Description |
---|---|---|

Tensor<'T> | a | The tensor on the left side of this binary operation. |

Tensor<'T> | b | The tensor on the right side of this binary operation. |

##### Returns

Type | Description |
---|---|

Tensor<'T> | A new tensor containing the result of this operation. |

##### Remarks

If `a`

and `b`

are vectors of the same length, then the scalar
product is computed. The result is a scalar.

If `a`

is a matrix and `b`

is a vector of compatible shape, then
the matrix-vector product is computed. The result is a vector.

If both `a`

and `b`

are matrices of compatibles shapes, then
the matrix product is computed. The result is a matrix.

If `a`

is a tensor of shape `[b_1; ...; b_n; i; j]`

and `b`

is a tensor of shape `[b_1; ...; b_n; j]`

, then the batched matrix-vector product is computed resulting in
a tensor of shape `[b_1; ...; b_n; i]`

. Broadcasting rules apply for the batch dimensions.

If `a`

is a tensor of shape `[b_1; ...; b_n; i; j]`

and `b`

is a tensor of shape `[b_1; ...; b_n; j; k]`

, then the batched matrix product is computed resulting in
a tensor of shape `[b_1; ...; b_n; i; k]`

. Broadcasting rules apply for the batch dimensions.

##### Examples

```
// Scalar product
let a = HostTensor.ofList [5.0; 6.0; 7.0]
let b = HostTensor.ofList [2.0; 3.0; 4.0]
let c = a .* b // c = [56.0]
// Matrix-vector product
let a = HostTensor.ofList2D [[5.0; 6.0; 7.0]
[8.0; 9.0; 0.0]]
let b = HostTensor.ofList [2.0; 3.0; 4.0]
let c = a .* b // c = [56.0; 43.0]
// Matrix product
let a = HostTensor.ofList2D [[5.0; 6.0; 7.0]
[8.0; 9.0; 0.0]]
let b = HostTensor.ofList2D [[2.0; 1.0]
[3.0; 1.0]
[4.0; 1.0]]
let c = a .* b // c = [[56.0; 18.0]
// [43.0; 17.0]]
```