Operators > Matrix Operators > Using the Vectorize Operator
Using the Vectorize Operator
You can use the vectorize operator when a function or operator has a special meaning for arrays that you want to override. For example, consider the following expression:
The vectorized product returns an array of the same size as A and B in which each element contains the product of the paired elements of A and B.
The nonvectorized product performs a standard matrix multiplication.
Vectorizing Functions
Many functions and operators automatically vectorize their operations when you apply them to arrays and evaluate them. When you enclose a function that requires an array for an argument, such as dft, and you attempt to calculate the expression element-by-element, you get an error.
Vectorizing Nested Arrays
The vectorize operator only descends one level down in an array. Each nested array in a vectorized expression is treated as a regular array, since these are the elements of the top-level array.
Vectorizing Scalars
When you use the vectorize operator over a scalar, nothing happens, so this operator can be used for cosmetic display purposes such as indicating a vector.
Was this helpful?