I am not sure if I am using the macro @. well. I thought I can avoid putting . (elementwise calculation) for + , -, / and so on by using the macro. For my project, I used it several times, but sometimes it doesn’t work. I would like to know what I am missing.
For instance, I have a function with a multi-dimensional array input :
** for i in 1:length(x)**
** if x[i] < 0 **
** x[i] = 0**
** end**
** end**
** return(x)**
**end**
and all other function calls inside max_op are dotted as well. @. is useful when you want to broadcast all the function calls in the expression you apply it to. A typical case where you don’t want to use @. is when you a matrix multiplication A * B: @. A * B would turn it into an element-wise product, if possible