File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -141,21 +141,21 @@ Returns the largest element of a tuple
141141
142142
143143"""
144- indmin (t::Tuple)
144+ argmin (t::Tuple)
145145
146146Returns the index of the minimum element in a tuple. If there are multiple
147147minimal elements, then the first one will be returned.
148148"""
149- indmin (t:: Tuple ) = findmin (t)[2 ]
149+ argmin (t:: Tuple ) = findmin (t)[2 ]
150150
151151
152152"""
153- indmax (t::Tuple)
153+ argmax (t::Tuple)
154154
155155Returns the index of the maximum element in a tuple. If there are multiple
156156minimal elements, then the first one will be returned.
157157"""
158- indmax (t:: Tuple ) = findmax (t)[2 ]
158+ argmax (t:: Tuple ) = findmax (t)[2 ]
159159
160160"""
161161 findmin(t::Tuple)
Original file line number Diff line number Diff line change 11if VERSION < v " 0.7.0-DEV.2005"
22 const Test = Base. Test
33end
4+ if VERSION >= v " 0.7.0-DEV.3406"
5+ using Random
6+ end
7+ if VERSION < v " 0.7.0-DEV.3516"
8+ const argmin = Base. indmin
9+ const argmax = Base. indmax
10+ end
411
512using Test
613using TupleTools
@@ -35,10 +42,12 @@ i = rand(1:n)
3542@test @inferred (TupleTools. findmax (t)) == findmax (t)
3643@test @inferred (TupleTools. minimum (t)) == minimum (t)
3744@test @inferred (TupleTools. maximum (t)) == maximum (t)
38- @test @inferred (TupleTools. indmin (t)) == indmin (t)
39- @test @inferred (TupleTools. indmax (t)) == indmax (t)
45+ @test @inferred (TupleTools. argmin (t)) == argmin (t)
46+ @test @inferred (TupleTools. argmax (t)) == argmax (t)
4047
4148@test @inferred (TupleTools. sort (t; rev = true )) == (sort (p; rev = true )... ,)
4249@test @inferred (TupleTools. sortperm (t)) == (sortperm (p)... ,)
4350@test @inferred (TupleTools. invperm (t)) == (ip... ,)
51+ @test @inferred (TupleTools. isperm (t)) == true
52+ @test @inferred (TupleTools. isperm ((1 ,2 ,1 ))) == false
4453@test @inferred (TupleTools. permute (t, t)) == (p[p]. .. ,)
You can’t perform that action at this time.
0 commit comments