[python-arrayfire] 09/250: TEST: Added simple test for algorithms

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:25 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit 5acbfe1f7feec103d71874141e74c9964d4b28c4
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Fri Jun 19 16:11:55 2015 -0400

    TEST: Added simple test for algorithms
    
    - Makes sure function everything runs
---
 tests/simple_algorithm.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/tests/simple_algorithm.py b/tests/simple_algorithm.py
new file mode 100644
index 0000000..7a16049
--- /dev/null
+++ b/tests/simple_algorithm.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+import arrayfire as af
+
+a = af.randu(3, 3)
+
+print(af.sum(a), af.product(a), af.min(a), af.max(a), af.count(a), af.any_true(a), af.all_true(a))
+
+af.print_array(af.sum(a, 0))
+af.print_array(af.sum(a, 1))
+
+af.print_array(af.product(a, 0))
+af.print_array(af.product(a, 1))
+
+af.print_array(af.min(a, 0))
+af.print_array(af.min(a, 1))
+
+af.print_array(af.max(a, 0))
+af.print_array(af.max(a, 1))
+
+af.print_array(af.count(a, 0))
+af.print_array(af.count(a, 1))
+
+af.print_array(af.any_true(a, 0))
+af.print_array(af.any_true(a, 1))
+
+af.print_array(af.all_true(a, 0))
+af.print_array(af.all_true(a, 1))
+
+af.print_array(af.accum(a, 0))
+af.print_array(af.accum(a, 1))
+
+af.print_array(af.sort(a, is_ascending=True))
+af.print_array(af.sort(a, is_ascending=False))
+
+val,idx = af.sort_index(a, is_ascending=True)
+af.print_array(val)
+af.print_array(idx)
+val,idx = af.sort_index(a, is_ascending=False)
+af.print_array(val)
+af.print_array(idx)
+
+b = af.randu(3,3)
+keys,vals = af.sort_by_key(a, b, is_ascending=True)
+af.print_array(keys)
+af.print_array(vals)
+keys,vals = af.sort_by_key(a, b, is_ascending=False)
+af.print_array(keys)
+af.print_array(vals)
+
+c = af.randu(5,1)
+d = af.randu(5,1)
+cc = af.set_unique(c, is_sorted=False)
+dd = af.set_unique(af.sort(d), is_sorted=True)
+af.print_array(cc)
+af.print_array(dd)
+
+af.print_array(af.set_union(cc, dd, is_unique=True))
+af.print_array(af.set_union(cc, dd, is_unique=False))
+
+af.print_array(af.set_intersect(cc, cc, is_unique=True))
+af.print_array(af.set_intersect(cc, cc, is_unique=False))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list