@@ -324,6 +324,7 @@ join (fromIntegral -> n) arr1 arr2 = op2 arr1 arr2 (\p a b -> af_join p n a b)
324
324
-- | Join many Arrays together along a specified dimension
325
325
--
326
326
-- *FIX ME*
327
+ --
327
328
-- >>> joinMany 0 [1,2,3]
328
329
-- ArrayFire Array
329
330
-- [3 1 1 1]
@@ -370,6 +371,7 @@ tile _ _ = error "impossible"
370
371
-- | Reorders an Array according to newly specified dimensions
371
372
--
372
373
-- *FIX ME*
374
+ --
373
375
-- >>> reorder @Double (scalar 22.0) [5,5]
374
376
-- ArrayFire Array
375
377
-- [5 5 1 1]
@@ -511,23 +513,59 @@ upper a (fromIntegral . fromEnum -> b) =
511
513
--
512
514
select
513
515
:: Array CBool
516
+ -- ^ is the conditional array
514
517
-> Array a
518
+ -- ^ is the array containing elements from the true part of the condition
515
519
-> Array a
520
+ -- ^ is the array containing elements from the false part of the condition
516
521
-> Array a
522
+ -- ^ is the output containing elements of a when cond is true else elements from b
517
523
select a b c = op3 a b c af_select
518
524
525
+ -- | Selects elements from two arrays based on the values of a binary conditional array.
526
+ --
527
+ -- <http://arrayfire.org/docs/group__data__func__select.htm#gab6886120d0bac4717276910e468bbe88>
528
+ --
529
+ -- >>> cond = vector @CBool 5 [1,0,1,0,1]
530
+ -- >>> arr1 = vector @Double 5 (repeat 1)
531
+ -- >>> x = 99
532
+ -- >>> selectScalarR cond x arr1
533
+ -- ArrayFire Array
534
+ -- [5 1 1 1]
535
+ -- 1.0000 99.0000 1.0000 99.0000 1.0000
536
+ --
519
537
selectScalarR
520
- :: Array a
538
+ :: Array CBool
539
+ -- ^ is the conditional array
521
540
-> Array a
541
+ -- ^ is the array containing elements from the true part of the condition
522
542
-> Double
543
+ -- ^ is a scalar assigned to out when cond is false
523
544
-> Array a
545
+ -- ^ the output containing elements of a when cond is true else elements from b
524
546
selectScalarR a b c = op2 a b (\ p w x -> af_select_scalar_r p w x c)
525
547
548
+ -- | Selects elements from two arrays based on the values of a binary conditional array.
549
+ --
550
+ -- [ArrayFire Docs](http://arrayfire.org/docs/group__data__func__select.htm#ga0ccdc05779f88cab5095bce987c2da9d)
551
+ --
552
+ -- >>> cond = vector @CBool 5 [1,0,1,0,1]
553
+ -- >>> arr1 = vector @Double 5 (repeat 1)
554
+ -- >>> x = 99
555
+ -- >>> selectScalarL cond x arr1
556
+ -- ArrayFire Array
557
+ -- [5 1 1 1]
558
+ -- 99.0000 1.0000 99.0000 1.0000 99.0000
559
+ --
526
560
selectScalarL
527
- :: Array a
561
+ :: Array CBool
562
+ -- ^ the conditional array
528
563
-> Double
564
+ -- ^ a scalar assigned to out when cond is true
529
565
-> Array a
566
+ -- ^ the array containing elements from the false part of the condition
530
567
-> Array a
568
+ -- ^ is the output containing elements of a when cond is true else elements from b
531
569
selectScalarL a n b = op2 a b (\ p w x -> af_select_scalar_l p w n x)
532
570
533
571
-- af_err af_replace(af_array a, const af_array cond, const af_array b);
0 commit comments