You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
byrow is fine tuned for a set of functions and operations (see its docstring for more details). For generic functions, byrow assumes the passed function accepts the row as a vector of values, and x->x .* 1 falls in this category, see ?byrow(x->x .* 1)
For user defined functions which return a single value, byrow treats each row as a vector of values, thus the user defined function must accept a vector and returns a single value.
So in the case of the function byrow(x->x .* 1), I understand that the single value is a vector. That is, that the vector, resulting from function, is intended as a single value.
This explains the result of applying the sum function.
In fact sum ([[1,2,3]]) = [1,2,3]. But so, I can't explain to myself why byrow (x-> sum(x)) seems to work instead.
While the situation of x-> sum.(x) is really different.
But so, I can't explain to myself why byrow (x-> sum(x)) seems to work instead.
This is something that I should add to the documentation. "byrow with a generic function and a single column acts like fun.(col)." docstrings fixed in master.
I don't explain the reason for the following differences
The text was updated successfully, but these errors were encountered: