prodr#
Purpose#
Computes the products of all elements in each row of a matrix, or array.
Format#
- y = prodr(x)#
- Parameters:
x (NxK matrix) – data
- Returns:
y (Kx1 matrix) – contains the products of all elements in each row of x.
Examples#
x = { 1 2 3,
4 5 6,
7 8 9 };
y = prodr(x);
The code above assigns y to be equal to:
6
y = 120
504
Remarks#
prodr()
will run faster than prodc()
, so if you can arrange your data for a row-wise multiplication it may speed up your program.
To find the products of all of the elements in a matrix, use the vecr()
function before applying prodr()
.