@@ -33,7 +33,7 @@ pow(x::Number,y::Number) = pow(float(x),float(y))
33
33
NaNMath.sum(A)
34
34
35
35
##### Args:
36
- * `A`: A one dimensional array of floating point numbers
36
+ * `A`: An array of floating point numbers
37
37
38
38
##### Returns:
39
39
* Returns the sum of all elements in the array, ignoring NaN's.
@@ -44,8 +44,8 @@ using NaNMath as nm
44
44
nm.sum([1., 2., NaN]) # result: 3.0
45
45
```
46
46
"""
47
- function sum {T<:AbstractFloat} (x:: Vector {T} )
48
- if size (x)[ 1 ] == 0
47
+ function sum {T<:AbstractFloat} (x:: AbstractArray {T} )
48
+ if length (x) == 0
49
49
result = zero (eltype (x))
50
50
else
51
51
result = convert (eltype (x), NaN )
70
70
NaNMath.maximum(A)
71
71
72
72
##### Args:
73
- * `A`: A one dimensional array of floating point numbers
73
+ * `A`: An array of floating point numbers
74
74
75
75
##### Returns:
76
76
* Returns the maximum of all elements in the array, ignoring NaN's.
@@ -81,7 +81,7 @@ using NaNMath as nm
81
81
nm.maximum([1., 2., NaN]) # result: 2.0
82
82
```
83
83
"""
84
- function maximum {T<:AbstractFloat} (x:: Vector {T} )
84
+ function maximum {T<:AbstractFloat} (x:: AbstractArray {T} )
85
85
result = convert (eltype (x), NaN )
86
86
for i in x
87
87
if ! isnan (i)
97
97
NaNMath.minimum(A)
98
98
99
99
##### Args:
100
- * `A`: A one dimensional array of floating point numbers
100
+ * `A`: An array of floating point numbers
101
101
102
102
##### Returns:
103
103
* Returns the minimum of all elements in the array, ignoring NaN's.
@@ -108,7 +108,7 @@ using NaNMath as nm
108
108
nm.minimum([1., 2., NaN]) # result: 1.0
109
109
```
110
110
"""
111
- function minimum {T<:AbstractFloat} (x:: Vector {T} )
111
+ function minimum {T<:AbstractFloat} (x:: AbstractArray {T} )
112
112
result = convert (eltype (x), NaN )
113
113
for i in x
114
114
if ! isnan (i)
124
124
NaNMath.extrema(A)
125
125
126
126
##### Args:
127
- * `A`: A one dimensional array of floating point numbers
127
+ * `A`: An array of floating point numbers
128
128
129
129
##### Returns:
130
130
* Returns the minimum and maximum of all elements in the array, ignoring NaN's.
@@ -135,7 +135,7 @@ using NaNMath as nm
135
135
nm.extrema([1., 2., NaN]) # result: 1.0, 2.0
136
136
```
137
137
"""
138
- function extrema {T<:AbstractFloat} (x:: Vector {T} )
138
+ function extrema {T<:AbstractFloat} (x:: AbstractArray {T} )
139
139
resultmin, resultmax = convert (eltype (x), NaN ), convert (eltype (x), NaN )
140
140
for i in x
141
141
if ! isnan (i)
153
153
NaNMath.mean(A)
154
154
155
155
##### Args:
156
- * `A`: A one dimensional array of floating point numbers
156
+ * `A`: An array of floating point numbers
157
157
158
158
##### Returns:
159
159
* Returns the arithmetic mean of all elements in the array, ignoring NaN's.
@@ -164,15 +164,15 @@ using NaNMath as nm
164
164
nm.mean([1., 2., NaN]) # result: 1.5
165
165
```
166
166
"""
167
- function mean {T<:AbstractFloat} (x:: Vector {T} )
167
+ function mean {T<:AbstractFloat} (x:: AbstractArray {T} )
168
168
return mean_count (x)[1 ]
169
169
end
170
170
171
171
"""
172
172
Returns a tuple of the arithmetic mean of all elements in the array, ignoring NaN's,
173
173
and the number of non-NaN values in the array.
174
174
"""
175
- function mean_count {T<:AbstractFloat} (x:: Vector {T} )
175
+ function mean_count {T<:AbstractFloat} (x:: AbstractArray {T} )
176
176
sum = convert (eltype (x), NaN )
177
177
count = 0
178
178
for i in x
0 commit comments