mattimes(X;Y)
Returns the element-wise product (Hadamard product) of the two given matrices. (Available as of prod-9)
Function type
Vector only
Syntax
mattimes(X;Y)
Input
| Argument | Type | Description |
|---|---|---|
X |
integer or decimal or matrix model | A scalar value or the name of a column The column specified by this parameter may contain matrix models generated by the 1010data Matrix Functions. |
Y |
integer or decimal or matrix model | A scalar value or the name of a column The column specified by this parameter may contain matrix models generated by the 1010data Matrix Functions. |
X or Y may be a scalar or scalar column, but
not both.Return Value
Returns a matrix model that is the element-wise product (Hadamard product) of the matrices
specified by X and Y.
If X and Y do not have the same dimensions, an error is
returned.
Example
Consider the following example:
<table cols="name, data_1, data_2, data_3, data_4" title="mattimes example"> John,8,0,5,1; John,2,0,1,1; Mary,3,1,2,2; Mary,4,1,2,2; John,5,2,3,1; John,6,2,3,1; Mary,7,3,4,2; Mary,1,3,0,2 </table> <willbe name="matrix_0" value="g_matrix(name;;;data_1 data_2 data_3 data_4;0)"/> <willbe name="matrix_1" value="g_matrix(name;;;data_1 data_2 data_3 data_4;1)"/> <willbe name="mat1_times_mat0" value="mattimes(matrix_1;matrix_0)"/>

For every row, the matrix in mat1_times_mat0 will be the element-wise
multiplication of the matrices in matrix_0 from
matrix_1.
For example, clicking on the > character in the first row of the
matrix_0 column displays the matrix model for those rows where
name is John.

Clicking on the > character in the first row of the
matrix_1 column displays the transpose of that matrix.

Finally, clicking on the > character in the first row of the
mat1_times_mat0 column displays the element-wise matrix multiplication of
matrix_0 from matrix_1.

