Reputation: 10996
I just downloaded Julia 1.0 and been trying to play with it. One annoying thing is that most of the examples that I found online deal with version 0.6 and it seems it is a big change between the versions.
So I am trying to compute the mean along a particular dimension of a matrix. I do the following:
a = rand(10, 5)
Now I can do
mean(a)
but not:
mean(a, 1)
Looking at the question here: Mean Row of Matrix, it seems that this was working in the older versions. What is the Julia 1.0 way of doing this?
Upvotes: 6
Views: 2569
Reputation: 10984
The second argument to mean
(and several other similar functions) became a keyword argument in Julia v0.7 and above. You should use
mean(a, dims = 1)
See also: https://discourse.julialang.org/t/psa-use-julia-0-7-if-you-are-upgrading/13321
Upvotes: 7