@@ -332,7 +332,6 @@ function fill!(a::Array{T}, x) where T<:Union{Integer,AbstractFloat}
332332 return a
333333end
334334
335-
336335"""
337336 fill(x, dims)
338337
@@ -1020,7 +1019,6 @@ function _prepend!(a, ::IteratorSize, iter)
10201019 a
10211020end
10221021
1023-
10241022"""
10251023 resize!(a::Vector, n::Integer) -> Vector
10261024
@@ -1539,7 +1537,6 @@ function reverse!(v::AbstractVector, s=first(linearindices(v)), n=last(linearind
15391537 return v
15401538end
15411539
1542-
15431540# concatenations of homogeneous combinations of vectors, horizontal and vertical
15441541
15451542vcat () = Array {Any,1} (0 )
@@ -1584,7 +1581,6 @@ end
15841581
15851582cat (n:: Integer , x:: Integer... ) = reshape ([x... ], (ntuple (x-> 1 , n- 1 )... , length (x)))
15861583
1587-
15881584# # find ##
15891585
15901586"""
@@ -2054,8 +2050,9 @@ end
20542050 findmax(itr) -> (x, index)
20552051
20562052Returns the maximum element of the collection `itr` and its index. If there are multiple
2057- maximal elements, then the first one will be returned. `NaN` values are ignored, unless
2058- all elements are `NaN`. Other than the treatment of `NaN`, the result is in line with `max`.
2053+ maximal elements, then the first one will be returned.
2054+ If any data element is `NaN`, this element is returned.
2055+ The result is in line with `max`.
20592056
20602057The collection must not be empty.
20612058
@@ -2068,7 +2065,7 @@ julia> findmax([1,7,7,6])
20682065(7, 2)
20692066
20702067julia> findmax([1,7,7,NaN])
2071- (7.0, 2 )
2068+ (NaN, 4 )
20722069```
20732070"""
20742071function findmax (a)
@@ -2079,10 +2076,10 @@ function findmax(a)
20792076 mi = i = 1
20802077 m, s = next (a, s)
20812078 while ! done (a, s)
2079+ m != m && break
20822080 ai, s = next (a, s)
20832081 i += 1
2084- ai != ai && continue # assume x != x => x is a NaN
2085- if m != m || isless (m, ai)
2082+ if ai != ai || isless (m, ai)
20862083 m = ai
20872084 mi = i
20882085 end
@@ -2094,8 +2091,9 @@ end
20942091 findmin(itr) -> (x, index)
20952092
20962093Returns the minimum element of the collection `itr` and its index. If there are multiple
2097- minimal elements, then the first one will be returned. `NaN` values are ignored, unless
2098- all elements are `NaN`. Other than the treatment of `NaN`, the result is in line with `min`.
2094+ minimal elements, then the first one will be returned.
2095+ If any data element is `NaN`, this element is returned.
2096+ The result is in line with `min`.
20992097
21002098The collection must not be empty.
21012099
@@ -2108,7 +2106,7 @@ julia> findmin([7,1,1,6])
21082106(1, 2)
21092107
21102108julia> findmin([7,1,1,NaN])
2111- (1.0, 2 )
2109+ (NaN, 4 )
21122110```
21132111"""
21142112function findmin (a)
@@ -2119,10 +2117,10 @@ function findmin(a)
21192117 mi = i = 1
21202118 m, s = next (a, s)
21212119 while ! done (a, s)
2120+ m != m && break
21222121 ai, s = next (a, s)
21232122 i += 1
2124- ai != ai && continue
2125- if m != m || isless (ai, m)
2123+ if ai != ai || isless (ai, m)
21262124 m = ai
21272125 mi = i
21282126 end
@@ -2134,8 +2132,7 @@ end
21342132 indmax(itr) -> Integer
21352133
21362134Returns the index of the maximum element in a collection. If there are multiple maximal
2137- elements, then the first one will be returned. `NaN` values are ignored, unless all
2138- elements are `NaN`.
2135+ elements, then the first one will be returned.
21392136
21402137The collection must not be empty.
21412138
@@ -2148,7 +2145,7 @@ julia> indmax([1,7,7,6])
214821452
21492146
21502147julia> indmax([1,7,7,NaN])
2151- 2
2148+ 4
21522149```
21532150"""
21542151indmax (a) = findmax (a)[2 ]
@@ -2157,8 +2154,7 @@ indmax(a) = findmax(a)[2]
21572154 indmin(itr) -> Integer
21582155
21592156Returns the index of the minimum element in a collection. If there are multiple minimal
2160- elements, then the first one will be returned. `NaN` values are ignored, unless all
2161- elements are `NaN`.
2157+ elements, then the first one will be returned.
21622158
21632159The collection must not be empty.
21642160
@@ -2171,7 +2167,7 @@ julia> indmin([7,1,1,6])
217121672
21722168
21732169julia> indmin([7,1,1,NaN])
2174- 2
2170+ 4
21752171```
21762172"""
21772173indmin (a) = findmin (a)[2 ]
0 commit comments