g_prodm(G;S;X)
Returns the element-wise product (Hadamard product) of matrix values within a given group. (Available as of prod-9)
Function type
Vector only
Syntax
g_prodm(G;S;X)
Input
Argument | Type | Description |
---|---|---|
G |
any | A space- or comma-separated list of column names Rows are in the same group
if their values for all of the columns listed in If If any of the columns listed in |
S |
integer | The name of a column in which every row evaluates to a 1 or 0, which determines
whether or not that row is selected to be included in the calculation If
If any of the values in
|
X |
matrix model | A column name The column specified by this parameter must contain matrix models generated by the 1010data Matrix Functions. |
Return Value
For every row in each group defined by G
(and for those rows where
S
=1, if specified), g_prodm
returns a matrix model consisting of the element-wise product (Hadamard product) of all of
the matrices within the given group.
If X
contains any N/A or scalar values, an error is returned.
Example
Consider the following example:
<table cols="name, data_1, data_2, data_3, data_4" title="g_prodm 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 </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="mat0_prodm" value="g_prodm(name;;matrix_0)"/> <willbe name="mat1_prodm" value="g_prodm(name;;matrix_1)"/>
For every row, the matrix in mat0_prodm
will be the element-wise matrix
product of the matrices in matrix_0
for a particular group.
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
mat0_prodm
column displays the matrix model consisting of the
element-wise matrix multiplication of the matrices in matrix_0
for those
rows where name
is John.
Clicking on the >
character in the first row of the
matrix_1
column displays the transpose of the matrix in the
matrix_0
column.
Finally, clicking on the >
character in the first row of the
mat1_prodm
column displays the matrix model consisting of the
element-wise matrix multiplication of the matrices in matrix_1
for those
rows where name
is John.