max.(a,b,c) is correct. Why is it not equal to
max(a,b,c) for the second element?
max() returns the maximum of its arguments. That is,
max(a, b, c) returns whichever of
c is greatest. It then follows that whatever is returned by
max(a, b, c) must be one of
c. In your case, the answer is
b, which is exactly what is returned.
max.(a, b, c) is the elementwise maximum of the three inputs, so it gives a different answer.
But b is neither bigger nor smaller than the vector a.
What sort of vector order is being assumed?
Vectors are compared in lexicographic order, so
b is greatest because the first element of
b is greater than the first elements of
Can anyone refer me to where in the docs it is explained that Lexicographic order is the default for max?
This has nothing to do with
max itself–it just uses the result of the
< function. The lexicographic ordering comes from the definition of
< (which by default falls back to the function
isless) for abstract vectors. I don’t have a link to the relevant part of the documentation handy, but that’s where you’d want to look.
isless(::Tuple, ::Tuple) mentions lexicographic ordering, but the method for vectors does not have a docstring, so I made a tiny PR adding it: