Julia: external product feature

The Rfunction outerstructurally allows you to take the external product of two vectors xand y, providing a number of options for the actual function applied to each combination. For example, it outer(x,y,'-')creates a matrix of an “external product” for elementary differences between xand y. Does Julia have something like that?

+4
source share
1 answer

Translation is a Julia operation that occurs when added .. When two containers are the same size, this is an elementary operation. Example: x.*yis elementary if size(x)==size(y). However, when the figures do not match, the transfer does take effect. If one of them is a row vector, and one of them is a column vector, then the result will be 2D c out[i,j], corresponding to the iith row of the column vector with the row vector j. This means that it x .* yis a peculiar way of writing an external work if one row and the other is a column vector.

In general, what the broadcast does:

, , Julia broadcast(), singleton ,

( Julia)

, x .- y' - , .

+6

Source: https://habr.com/ru/post/1679462/


All Articles