This is an old version, view current version.

5.4 Elementwise functions

Elementwise functions apply a function to each element of a vector or matrix, returning a result of the same shape as the argument. There are many functions that are vectorized in addition to the ad hoc cases listed in this section; see section function vectorization for the general cases.

vector operator.*(vector x, vector y)
The elementwise product of y and x

row_vector operator.*(row_vector x, row_vector y)
The elementwise product of y and x

matrix operator.*(matrix x, matrix y)
The elementwise product of y and x

vector operator./(vector x, vector y)
The elementwise quotient of y and x

vector operator./(vector x, real y)
The elementwise quotient of y and x

vector operator./(real x, vector y)
The elementwise quotient of y and x

row_vector operator./(row_vector x, row_vector y)
The elementwise quotient of y and x

row_vector operator./(row_vector x, real y)
The elementwise quotient of y and x

row_vector operator./(real x, row_vector y)
The elementwise quotient of y and x

matrix operator./(matrix x, matrix y)
The elementwise quotient of y and x

matrix operator./(matrix x, real y)
The elementwise quotient of y and x

matrix operator./(real x, matrix y)
The elementwise quotient of y and x

vector operator.^(vector x, vector y)
The elementwise power of y and x

vector operator.^(vector x, real y)
The elementwise power of y and x

vector operator.^(real x, vector y)
The elementwise power of y and x

row_vector operator.^(row_vector x, row_vector y)
The elementwise power of y and x

row_vector operator.^(row_vector x, real y)
The elementwise power of y and x

row_vector operator.^(real x, row_vector y)
The elementwise power of y and x

matrix operator.^(matrix x, matrix y)
The elementwise power of y and x

matrix operator.^(matrix x, real y)
The elementwise power of y and x

matrix operator.^(real x, matrix y)
The elementwise power of y and x