Outer product of two vectors: the matrix of fun(x[i], y[j]). Equivalent to R's outer(). fun is "*" (default), "+", "-", "/", "^" or a function of two numbers, given as the third argument or as the option fun (giving both is a RangeError).
fun(x[i], y[j])
outer()
fun
"*"
"+"
"-"
"/"
"^"
Optional
outer([1, 2], [1, 2, 3]); // [[1, 2, 3], [2, 4, 6]]outer([1, 2], [1, 2, 3], "+"); // [[2, 3, 4], [3, 4, 5]] Copy
outer([1, 2], [1, 2, 3]); // [[1, 2, 3], [2, 4, 6]]outer([1, 2], [1, 2, 3], "+"); // [[2, 3, 4], [3, 4, 5]]
Outer product of two vectors, with the operation in the options: outer(x, y, { fun: "+" }).
outer(x, y, { fun: "+" })
outer([1, 2], [1, 2, 3], { fun: "+" }); // [[2, 3, 4], [3, 4, 5]] Copy
outer([1, 2], [1, 2, 3], { fun: "+" }); // [[2, 3, 4], [3, 4, 5]]
Outer product of two vectors: the matrix of
fun(x[i], y[j]). Equivalent to R'souter().funis"*"(default),"+","-","/","^"or a function of two numbers, given as the third argument or as the optionfun(giving both is a RangeError).