These functions apply a function to each element of the tensor on which the
method is called (self). These methods are much faster than using a for
loop in Lua
. The results is stored in self
(if the function returns
something). A similar function exists in the lab
package, but where a new tensor containing the result is returned instead.