@@ -37,14 +37,10 @@ import ArrayFire.Internal.Types
3737
3838-- | Calculates 'mean' of 'Array' along user-specified dimension.
3939--
40- -- @
41- -- >>> print $ mean 0 ( vector @Int 10 [1..] )
42- -- @
43- -- @
40+ -- >>> mean 0 ( vector @Int 10 [1..] )
4441-- ArrayFire Array
4542-- [1 1 1 1]
4643-- 5.5000
47- -- @
4844mean
4945 :: AFType a
5046 => Array a
@@ -59,14 +55,10 @@ mean a n =
5955
6056-- | Calculates 'meanWeighted' of 'Array' along user-specified dimension.
6157--
62- -- @
63- -- >>> print $ meanWeighted (vector @Double 10 [1..10]) (vector @Double 10 [1..10]) 0
64- -- @
65- -- @
58+ -- >>> meanWeighted (vector @Double 10 [1..10]) (vector @Double 10 [1..10]) 0
6659-- ArrayFire Array
6760-- [1 1 1 1]
6861-- 7.0000
69- -- @
7062meanWeighted
7163 :: AFType a
7264 => Array a
@@ -83,14 +75,10 @@ meanWeighted x y (fromIntegral -> n) =
8375
8476-- | Calculates 'variance' of 'Array' along user-specified dimension.
8577--
86- -- @
87- -- >>> print $ var (vector @Double 8 [1..8]) False 0
88- -- @
89- -- @
78+ -- >>> var (vector @Double 8 [1..8]) False 0
9079-- ArrayFire Array
9180-- [1 1 1 1]
9281-- 6.0
93- -- @
9482var
9583 :: AFType a
9684 => Array a
@@ -107,14 +95,10 @@ var arr (fromIntegral . fromEnum -> b) d =
10795
10896-- | Calculates 'varWeighted' of 'Array' along user-specified dimension.
10997--
110- -- @
111- -- >>> print $ varWeighted 0 ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] )
112- -- @
113- -- @
98+ -- >>> varWeighted 0 ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] )
11499-- ArrayFire Array
115100-- [1 1 1 1]
116101-- 5.5000
117- -- @
118102varWeighted
119103 :: AFType a
120104 => Array a
@@ -131,14 +115,10 @@ varWeighted x y (fromIntegral -> n) =
131115
132116-- | Calculates 'stdev' of 'Array' along user-specified dimension.
133117--
134- -- @
135118-- >>> stdev (vector @Double 10 (cycle [1,-1])) 0
136- -- @
137- -- @
138119-- ArrayFire Array
139120-- [1 1 1 1]
140121-- 1.0
141- -- @
142122stdev
143123 :: AFType a
144124 => Array a
@@ -153,14 +133,10 @@ stdev a n =
153133
154134-- | Calculates 'covariance' two 'Array's with a bias specifier.
155135--
156- -- @
157- -- >>> print $ cov (vector @Double 10 (repeat 1)) (vector @Double 10 (repeat 1)) False
158- -- @
159- -- @
136+ -- >>> cov (vector @Double 10 (repeat 1)) (vector @Double 10 (repeat 1)) False
160137-- ArrayFire Array
161138-- [1 1 1 1]
162139-- 0.0
163- -- @
164140cov
165141 :: AFType a
166142 => Array a
@@ -177,14 +153,10 @@ cov x y (fromIntegral . fromEnum -> n) =
177153
178154-- | Calculates 'median' of 'Array' along user-specified dimension.
179155--
180- -- @
181156-- >>> print $ median ( vector @Int 10 [1..] ) 0
182- -- @
183- -- @
184157-- ArrayFire Array
185158-- [1 1 1 1]
186159-- 5.5000
187- -- @
188160median
189161 :: AFType a
190162 => Array a
@@ -199,12 +171,8 @@ median a n =
199171
200172-- | Calculates 'mean' of all elements in an 'Array'
201173--
202- -- @
203- -- >>> print $ fst (meanAll (matrix @Double (2,2) (repeat 10)))
204- -- @
205- -- @
206- -- >>> 10.0
207- -- @
174+ -- >>> fst (meanAll (matrix @Double (2,2) (repeat 10)))
175+ -- 10.0
208176meanAll
209177 :: AFType a
210178 => Array a
@@ -215,12 +183,8 @@ meanAll = (`infoFromArray2` af_mean_all)
215183
216184-- | Calculates weighted mean of all elements in an 'Array'
217185--
218- -- @
219186-- >>> print $ fst (meanAllWeighted (matrix @Double (2,2) (repeat 10)) (matrix @Double (2,2) (repeat 0)))
220- -- @
221- -- @
222187-- 10
223- -- @
224188meanAllWeighted
225189 :: AFType a
226190 => Array a
@@ -234,12 +198,8 @@ meanAllWeighted a b =
234198
235199-- | Calculates variance of all elements in an 'Array'
236200--
237- -- @
238- -- >>> print $ fst (varAll (vector @Double 10 (repeat 10)) False)
239- -- @
240- -- @
201+ -- >>> fst (varAll (vector @Double 10 (repeat 10)) False)
241202-- 0
242- -- @
243203varAll
244204 :: AFType a
245205 => Array a
@@ -254,12 +214,8 @@ varAll a (fromIntegral . fromEnum -> b) =
254214
255215-- | Calculates weighted variance of all elements in an 'Array'
256216--
257- -- @
258- -- >>> print $ varAllWeighted ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] )
259- -- @
260- -- @
217+ -- >>> varAllWeighted ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] )
261218-- 0
262- -- @
263219varAllWeighted
264220 :: AFType a
265221 => Array a
@@ -273,12 +229,8 @@ varAllWeighted a b =
273229
274230-- | Calculates standard deviation of all elements in an 'Array'
275231--
276- -- @
277- -- >>> print $ fst (stdevAll (vector @Double 10 (repeat 10)))
278- -- @
279- -- @
232+ -- >>> fst (stdevAll (vector @Double 10 (repeat 10)))
280233-- 10
281- -- @
282234stdevAll
283235 :: AFType a
284236 => Array a
@@ -289,12 +241,8 @@ stdevAll = (`infoFromArray2` af_stdev_all)
289241
290242-- | Calculates median of all elements in an 'Array'
291243--
292- -- @
293- -- >>> print $ fst (medianAll (vector @Double 10 (repeat 10)))
294- -- @
295- -- @
244+ -- >>> fst (medianAll (vector @Double 10 (repeat 10)))
296245-- 10
297- -- @
298246medianAll
299247 :: (AFType a , Fractional a )
300248 => Array a
@@ -306,12 +254,8 @@ medianAll = (`infoFromArray2` af_median_all)
306254-- | This algorithm returns Pearson product-moment correlation coefficient.
307255-- <https://en.wikipedia.org/wiki/Pearson_correlation_coefficient>
308256--
309- -- @
310- -- >>> print $ fst (corrCoef ( vector @Int 10 [1..] ) ( vector @Int 10 [10,9..] ))
311- -- @
312- -- @
257+ -- >>> fst (corrCoef ( vector @Int 10 [1..] ) ( vector @Int 10 [10,9..] ))
313258-- -1
314- -- @
315259corrCoef
316260 :: AFType a
317261 => Array a
@@ -325,21 +269,17 @@ corrCoef a b =
325269
326270-- | This function returns the top k values along a given dimension of the input array.
327271--
328- -- @
329272-- >>> let (vals,indexes) = 'topk' ( 'vector' \@'Double' 10 [1..] ) 3 'TopKDefault'
330- -- >>> print vals
331273-- >>> print indexes
332- -- @
333- -- @
274+ --
334275-- ArrayFire 'Array'
335276-- [3 1 1 1]
336277-- 10.0000 9.0000 8.0000
337- -- @
338- -- @
278+ --
279+ -- >>> print vals
339280-- ArrayFire 'Array'
340281-- [3 1 1 1]
341282-- 9 8 7
342- -- @
343283--
344284-- The indices along with their values are returned. If the input is a multi-dimensional array, the indices will be the index of the value in that dimension. Order of duplicate values are not preserved. This function is optimized for small values of k.
345285-- This function performs the operation across all dimensions of the input array.
0 commit comments