[arrayfire] 83/408: Changed af_print macro, added documentation

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:23 UTC 2015


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

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

commit c62a250f1d77ad3a792bccd16db67c3e4402d90d
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Thu Jul 2 14:44:32 2015 -0400

    Changed af_print macro, added documentation
---
 include/af/util.h | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/include/af/util.h b/include/af/util.h
index 92ca840..e929464 100644
--- a/include/af/util.h
+++ b/include/af/util.h
@@ -43,9 +43,40 @@ namespace af
     AFAPI array exampleFunction(const array& in, const af_someenum_t param);
 }
 
-#define af_print(exp) af::print(#exp, exp);
-
-#define af_print_p(exp, p) af::print(#exp, exp, p);
+/**
+    Macro to print an array along with the variable name
+
+    \param[in] exp the array to be printed
+
+    An additional integer argument can be given to specify the precision to be
+    printed.
+
+    \code
+    af::array myarray = randu(3, 3);
+    int myprecision = 2;
+
+    af_print(myarray);                  // Defaults precision to 4 decimal places
+    // A [3 3 1 1]
+    //     0.0010   311.3614     1.6264
+    //    60.3298   497.9737   359.5948
+    //   165.4467   113.7310     5.2294
+
+    af_print(myarray, myprecision);     // Uses myprecision decimal places
+    // A [3 3 1 1]
+    //     0.00   311.36     1.63
+    //    60.33   497.97   359.59
+    //   165.45   113.73     5.23
+
+    af_print(myarray, 6);
+    // A [3 3 1 1]
+    //     0.001029   311.361402     1.626432
+    //    60.329828   497.973728   359.594787
+    //   165.446732   113.730984     5.229350
+    \endcode
+
+    \ingroup print_func_print
+*/
+#define af_print(exp, ...) af::print(#exp, __VA_ARGS__);
 
 #endif //__cplusplus
 

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



More information about the debian-science-commits mailing list