From 35191ad5bd90a6068a90016cfda542fe467ecf28 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Wed, 14 Sep 2022 12:37:40 +0400 Subject: [PATCH] Improve argmin/argmax docstring (#46737) The current phrasing "Return a value `x` in the domain of `f`" is a bit misleading, as the domain of `f` may be much larger than the argument `domain`. It's better to be clear that the value returned will be an element of the `domain` that is provided. --- base/reduce.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/reduce.jl b/base/reduce.jl index 64ea4293c9893..a7f821a73be92 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -989,7 +989,7 @@ _findmin(a, ::Colon) = findmin(identity, a) """ argmax(f, domain) -Return a value `x` in the domain of `f` for which `f(x)` is maximised. +Return a value `x` from `domain` for which `f(x)` is maximised. If there are multiple maximal values for `f(x)` then the first one will be found. `domain` must be a non-empty iterable. @@ -1041,7 +1041,7 @@ argmax(itr) = findmax(itr)[2] """ argmin(f, domain) -Return a value `x` in the domain of `f` for which `f(x)` is minimised. +Return a value `x` from `domain` for which `f(x)` is minimised. If there are multiple minimal values for `f(x)` then the first one will be found. `domain` must be a non-empty iterable.