Element-wise operations in Gaea
11/12/2018
Element-wise operations, or Hadamard product as the element-wise multiplication is known amongst mathematicians, are the operations of addition, substraction, multiplication, and division applied element-wise to all possible combinations of scalar, vector and matrix. In Gaea these operations are available with the operators .+ , .- , .* , and ./ respectively.
For example addition of a scalar with a vector gives
(.+ 3 #(1 2 3)) ;; returns #(4 5 6)
or element-wise matrix multiplication gives
(.* #2A((1 2) (3 4)) #2A((1 0) (0 1))) ;; returns #2A((1 0) (0 4))
These element-wise operations are quite often useful, e.g., for the scaling of matrices, or in general the preparation of a matrix for further data analysis.
Category: