[arrayfire] 19/248: backend-independent wrapper for arrayfire funtions

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:53:50 UTC 2015


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

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit ceabe02f4c98f5ae3c6d4a719415ea6d61e8a730
Author: pradeep <pradeep at arrayfire.com>
Date:   Fri Aug 28 16:50:37 2015 -0400

    backend-independent wrapper for arrayfire funtions
    
    Added heterogenous wrapper for functions from following headers:
    * array
    * blas
    * data
    * device
    * features
    * graphics
    * index
    * lapack
    * signal
    * statistics
    * util
---
 src/api/hapi/array.cpp          |  96 ++++++++++++++++++++++++++
 src/api/hapi/blas.cpp           |  36 ++++++++++
 src/api/hapi/data.cpp           | 149 +++++++++++++++++++++++++++++++++++++---
 src/api/hapi/device.cpp         |  99 +++++++++++++++++++++++++-
 src/api/hapi/features.cpp       |  44 ++++++++++++
 src/api/hapi/graphics.cpp       |  68 ++++++++++++++++++
 src/api/hapi/index.cpp          |  49 +++++++++++++
 src/api/hapi/lapack.cpp         |  84 ++++++++++++++++++++++
 src/api/hapi/print.cpp          |  17 -----
 src/api/hapi/signal.cpp         | 117 +++++++++++++++++++++++++++++++
 src/api/hapi/statistics.cpp     |  82 ++++++++++++++++++++++
 src/api/hapi/symbol_manager.hpp |   2 +
 src/api/hapi/util.cpp           |  58 ++++++++++++++++
 13 files changed, 873 insertions(+), 28 deletions(-)

diff --git a/src/api/hapi/array.cpp b/src/api/hapi/array.cpp
new file mode 100644
index 0000000..020a2e3
--- /dev/null
+++ b/src/api/hapi/array.cpp
@@ -0,0 +1,96 @@
+/*******************************************************
+ * Copyright(c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include "symbol_manager.hpp"
+
+af_err af_create_array(af_array *arr, const void * const data, const unsigned ndims, const dim_t * const dims, const af_dtype type)
+{
+    return CALL(arr, data, ndims, dims, type);
+}
+
+af_err af_create_handle(af_array *arr, const unsigned ndims, const dim_t * const dims, const af_dtype type)
+{
+    return CALL(arr, ndims, dims, type);
+}
+
+af_err af_copy_array(af_array *arr, const af_array in)
+{
+    return CALL(arr, in);
+}
+
+af_err af_write_array(af_array arr, const void *data, const size_t bytes, af_source src)
+{
+    return CALL(arr, data, bytes, src);
+}
+
+af_err af_get_data_ptr(void *data, const af_array arr)
+{
+    return CALL(data, arr);
+}
+
+af_err af_release_array(af_array arr)
+{
+    return CALL(arr);
+}
+
+af_err af_retain_array(af_array *out, const af_array in)
+{
+    return CALL(out, in);
+}
+
+af_err af_get_data_ref_count(int *use_count, const af_array in)
+{
+    return CALL(use_count, in);
+}
+
+af_err af_eval(af_array in)
+{
+    return CALL(in);
+}
+
+af_err af_get_elements(dim_t *elems, const af_array arr)
+{
+    return CALL(elems, arr);
+}
+
+af_err af_get_type(af_dtype *type, const af_array arr)
+{
+    return CALL(type, arr);
+}
+
+af_err af_get_dims(dim_t *d0, dim_t *d1, dim_t *d2, dim_t *d3, const af_array arr)
+{
+    return CALL(d0, d1, d2, d3, arr);
+}
+
+af_err af_get_numdims(unsigned *result, const af_array arr)
+{
+    return CALL(result, arr);
+}
+
+#define ARRAY_HAPI_DEF(af_func) \
+af_err af_func(bool *result, const af_array arr)\
+{\
+    return CALL(result, arr);\
+}
+
+ARRAY_HAPI_DEF(af_is_empty)
+ARRAY_HAPI_DEF(af_is_scalar)
+ARRAY_HAPI_DEF(af_is_row)
+ARRAY_HAPI_DEF(af_is_column)
+ARRAY_HAPI_DEF(af_is_vector)
+ARRAY_HAPI_DEF(af_is_complex)
+ARRAY_HAPI_DEF(af_is_real)
+ARRAY_HAPI_DEF(af_is_double)
+ARRAY_HAPI_DEF(af_is_single)
+ARRAY_HAPI_DEF(af_is_realfloating)
+ARRAY_HAPI_DEF(af_is_floating)
+ARRAY_HAPI_DEF(af_is_integer)
+ARRAY_HAPI_DEF(af_is_bool)
diff --git a/src/api/hapi/blas.cpp b/src/api/hapi/blas.cpp
new file mode 100644
index 0000000..8080f05
--- /dev/null
+++ b/src/api/hapi/blas.cpp
@@ -0,0 +1,36 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/blas.h>
+#include "symbol_manager.hpp"
+
+af_err af_matmul( af_array *out ,
+        const af_array lhs, const af_array rhs,
+        const af_mat_prop optLhs, const af_mat_prop optRhs)
+{
+    return CALL(out, lhs, rhs, optLhs, optRhs);
+}
+
+
+af_err af_dot(    af_array *out,
+        const af_array lhs, const af_array rhs,
+        const af_mat_prop optLhs, const af_mat_prop optRhs)
+{
+    return CALL(out, lhs, rhs, optLhs, optRhs);
+}
+
+af_err af_transpose(af_array *out, af_array in, const bool conjugate)
+{
+    return CALL(out, in, conjugate);
+}
+
+af_err af_transpose_inplace(af_array in, const bool conjugate)
+{
+    return CALL(in, conjugate);
+}
diff --git a/src/api/hapi/data.cpp b/src/api/hapi/data.cpp
index 0a53c94..e733f61 100644
--- a/src/api/hapi/data.cpp
+++ b/src/api/hapi/data.cpp
@@ -11,13 +11,6 @@
 #include <af/data.h>
 #include "symbol_manager.hpp"
 
-af_err af_create_array(af_array *result, const void * const data,
-                       const unsigned ndims, const dim_t * const dims,
-                       const af_dtype type)
-{
-    return CALL(result, data, ndims, dims, type);
-}
-
 af_err af_constant(af_array *result, const double value,
                    const unsigned ndims, const dim_t * const dims,
                    const af_dtype type)
@@ -25,7 +18,145 @@ af_err af_constant(af_array *result, const double value,
     return CALL(result, value, ndims, dims, type);
 }
 
-af_err af_release_array(af_array arr)
+
+AFAPI af_err af_constant_complex(af_array *arr, const double real, const double imag,
+        const unsigned ndims, const dim_t * const dims, const af_dtype type)
+{
+    return CALL(arr, real, imag, ndims, dims, type);
+}
+
+
+AFAPI af_err af_constant_long (af_array *arr, const  intl val, const unsigned ndims, const dim_t * const dims)
+{
+    return CALL(arr, val, ndims, dims);
+}
+
+
+AFAPI af_err af_constant_ulong(af_array *arr, const uintl val, const unsigned ndims, const dim_t * const dims)
+{
+    return CALL(arr, val, ndims, dims);
+}
+
+AFAPI af_err af_range(af_array *out, const unsigned ndims, const dim_t * const dims,
+        const int seq_dim, const af_dtype type)
+{
+    return CALL(out, ndims, dims, seq_dim, type);
+}
+
+AFAPI af_err af_iota(af_array *out, const unsigned ndims, const dim_t * const dims,
+        const unsigned t_ndims, const dim_t * const tdims, const af_dtype type)
+{
+    return CALL(out, ndims, dims, t_ndims, tdims, type);
+}
+
+AFAPI af_err af_randu(af_array *out, const unsigned ndims, const dim_t * const dims, const af_dtype type)
+{
+    return CALL(out, ndims, dims, type);
+}
+
+AFAPI af_err af_randn(af_array *out, const unsigned ndims, const dim_t * const dims, const af_dtype type)
+{
+    return CALL(out, ndims, dims, type);
+}
+
+AFAPI af_err af_set_seed(const uintl seed)
+{
+    return CALL(seed);
+}
+
+AFAPI af_err af_get_seed(uintl *seed)
+{
+    return CALL(seed);
+}
+
+AFAPI af_err af_identity(af_array *out, const unsigned ndims, const dim_t * const dims, const af_dtype type)
+{
+    return CALL(out, ndims, dims, type);
+}
+
+AFAPI af_err af_diag_create(af_array *out, const af_array in, const int num)
+{
+    return CALL(out, in, num);
+}
+
+AFAPI af_err af_diag_extract(af_array *out, const af_array in, const int num)
+{
+    return CALL(out, in, num);
+}
+
+AFAPI af_err af_join(af_array *out, const int dim, const af_array first, const af_array second)
+{
+    return CALL(out, dim, first, second);
+}
+
+AFAPI af_err af_join_many(af_array *out, const int dim, const unsigned n_arrays, const af_array *inputs)
+{
+    return CALL(out, dim, n_arrays, inputs);
+}
+
+AFAPI af_err af_tile(af_array *out, const af_array in,
+        const unsigned x, const unsigned y, const unsigned z, const unsigned w)
+{
+    return CALL(out, in, x, y, z, w);
+}
+
+AFAPI af_err af_reorder(af_array *out, const af_array in,
+        const unsigned x, const unsigned y, const unsigned z, const unsigned w)
+{
+    return CALL(out, in, x, y, z, w);
+}
+
+AFAPI af_err af_shift(af_array *out, const af_array in, const int x, const int y, const int z, const int w)
+{
+    return CALL(out, in, x, y, z, w);
+}
+
+AFAPI af_err af_moddims(af_array *out, const af_array in, const unsigned ndims, const dim_t * const dims)
+{
+    return CALL(out, in, ndims, dims);
+}
+
+AFAPI af_err af_flat(af_array *out, const af_array in)
+{
+    return CALL(out, in);
+}
+
+AFAPI af_err af_flip(af_array *out, const af_array in, const unsigned dim)
+{
+    return CALL(out, in, dim);
+}
+
+AFAPI af_err af_lower(af_array *out, const af_array in, bool is_unit_diag)
+{
+    return CALL(out, in, is_unit_diag);
+}
+
+AFAPI af_err af_upper(af_array *out, const af_array in, bool is_unit_diag)
+{
+    return CALL(out, in, is_unit_diag);
+}
+
+AFAPI af_err af_select(af_array *out, const af_array cond, const af_array a, const af_array b)
+{
+    return CALL(out, cond, a, b);
+}
+
+AFAPI af_err af_select_scalar_r(af_array *out, const af_array cond, const af_array a, const double b)
+{
+    return CALL(out, cond, a, b);
+}
+
+AFAPI af_err af_select_scalar_l(af_array *out, const af_array cond, const double a, const af_array b)
+{
+    return CALL(out, cond, a, b);
+}
+
+AFAPI af_err af_replace(af_array a, const af_array cond, const af_array b)
+{
+    return CALL(a, cond, b);
+}
+
+AFAPI af_err af_replace_scalar(af_array a, const af_array cond, const double b)
 {
-    return CALL(arr);
+    return CALL(a, cond, b);
 }
diff --git a/src/api/hapi/device.cpp b/src/api/hapi/device.cpp
index b1b419e..ebaa0d6 100644
--- a/src/api/hapi/device.cpp
+++ b/src/api/hapi/device.cpp
@@ -18,6 +18,101 @@ af_err af_set_backend(const af_backend bknd)
 
 af_err af_info()
 {
-    AFSymbolManager& symbolManager = AFSymbolManager::getInstance();
-    return symbolManager.call("af_info");
+    return CALL_NO_PARAMS();
+}
+
+AFAPI af_err af_init()
+{
+    return CALL_NO_PARAMS();
+}
+
+AFAPI af_err af_device_info(char* d_name, char* d_platform, char *d_toolkit, char* d_compute)
+{
+    return CALL(d_name, d_platform, d_toolkit, d_compute);
+}
+
+AFAPI af_err af_get_device_count(int *num_of_devices)
+{
+    return CALL(num_of_devices);
+}
+
+AFAPI af_err af_get_dbl_support(bool* available, const int device)
+{
+    return CALL(available, device);
+}
+
+AFAPI af_err af_set_device(const int device)
+{
+    return CALL(device);
+}
+
+AFAPI af_err af_get_device(int *device)
+{
+    return CALL(device);
+}
+
+AFAPI af_err af_sync(const int device)
+{
+    return CALL(device);
+}
+
+AFAPI af_err af_alloc_device(void **ptr, const dim_t bytes)
+{
+    return CALL(ptr, bytes);
+}
+
+AFAPI af_err af_alloc_pinned(void **ptr, const dim_t bytes)
+{
+    return CALL(ptr, bytes);
+}
+
+AFAPI af_err af_free_device(void *ptr)
+{
+    return CALL(ptr);
+}
+
+AFAPI af_err af_free_pinned(void *ptr)
+{
+    return CALL(ptr);
+}
+
+AFAPI af_err af_device_array(af_array *arr, const void *data, const unsigned ndims, const dim_t * const dims, const af_dtype type)
+{
+    return CALL(arr, data, ndims, dims, type);
+}
+
+AFAPI af_err af_device_mem_info(size_t *alloc_bytes, size_t *alloc_buffers,
+        size_t *lock_bytes, size_t *lock_buffers)
+{
+    return CALL(alloc_bytes, alloc_buffers, lock_bytes, lock_buffers);
+}
+
+AFAPI af_err af_device_gc()
+{
+    return CALL_NO_PARAMS();
+}
+
+AFAPI af_err af_set_mem_step_size(const size_t step_bytes)
+{
+    return CALL(step_bytes);
+}
+
+AFAPI af_err af_get_mem_step_size(size_t *step_bytes)
+{
+    return CALL(step_bytes);
+}
+
+AFAPI af_err af_lock_device_ptr(const af_array arr)
+{
+    return CALL(arr);
+}
+
+AFAPI af_err af_unlock_device_ptr(const af_array arr)
+{
+    return CALL(arr);
+}
+
+AFAPI af_err af_get_device_ptr(void **ptr, const af_array arr)
+{
+    return CALL(ptr, arr);
 }
diff --git a/src/api/hapi/features.cpp b/src/api/hapi/features.cpp
new file mode 100644
index 0000000..5eac8f7
--- /dev/null
+++ b/src/api/hapi/features.cpp
@@ -0,0 +1,44 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include <af/features.h>
+#include "symbol_manager.hpp"
+
+af_err af_create_features(af_features *feat, dim_t num)
+{
+    return CALL(feat, num);
+}
+
+af_err af_retain_features(af_features *out, const af_features feat)
+{
+    return CALL(out, feat);
+}
+
+af_err af_get_features_num(dim_t *num, const af_features feat)
+{
+    return CALL(num, feat);
+}
+
+#define FEAT_HAPI_DEF(af_func)\
+af_err af_func(af_array *out, const af_features feat)\
+{\
+    return CALL(out, feat);\
+}
+
+FEAT_HAPI_DEF(af_get_features_xpos)
+FEAT_HAPI_DEF(af_get_features_ypos)
+FEAT_HAPI_DEF(af_get_features_score)
+FEAT_HAPI_DEF(af_get_features_orientation)
+FEAT_HAPI_DEF(af_get_features_size)
+
+af_err af_release_features(af_features feat)
+{
+    return CALL(feat);
+}
diff --git a/src/api/hapi/graphics.cpp b/src/api/hapi/graphics.cpp
new file mode 100644
index 0000000..61ed4a9
--- /dev/null
+++ b/src/api/hapi/graphics.cpp
@@ -0,0 +1,68 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include <af/graphics.h>
+#include "symbol_manager.hpp"
+
+
+af_err af_create_window(af_window *out, const int width, const int height, const char* const title)
+{
+    return CALL(out, width, height, title);
+}
+
+af_err af_set_position(const af_window wind, const unsigned x, const unsigned y)
+{
+    return CALL(wind, x, y);
+}
+
+af_err af_set_title(const af_window wind, const char* const title)
+{
+    return CALL(wind, title);
+}
+
+af_err af_set_size(const af_window wind, const unsigned w, const unsigned h)
+{
+    return CALL(wind, w, h);
+}
+
+af_err af_draw_image(const af_window wind, const af_array in, const af_cell* const props)
+{
+    return CALL(wind, in, props);
+}
+
+af_err af_draw_plot(const af_window wind, const af_array X, const af_array Y, const af_cell* const props)
+{
+    return CALL(wind, X, Y, props);
+}
+
+af_err af_draw_hist(const af_window wind, const af_array X, const double minval, const double maxval, const af_cell* const props)
+{
+    return CALL(wind, X, minval, maxval, props);
+}
+
+af_err af_grid(const af_window wind, const int rows, const int cols)
+{
+    return CALL(wind, rows, cols);
+}
+
+af_err af_show(const af_window wind)
+{
+    return CALL(wind);
+}
+
+af_err af_is_window_closed(bool *out, const af_window wind)
+{
+    return CALL(out, wind);
+}
+
+af_err af_destroy_window(const af_window wind)
+{
+    return CALL(wind);
+}
diff --git a/src/api/hapi/index.cpp b/src/api/hapi/index.cpp
new file mode 100644
index 0000000..bdfb3c8
--- /dev/null
+++ b/src/api/hapi/index.cpp
@@ -0,0 +1,49 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include <af/index.h>
+#include "symbol_manager.hpp"
+
+AFAPI af_err af_index(  af_array *out,
+        const af_array in,
+        const unsigned ndims, const af_seq* const index)
+{
+    return CALL(out, in, ndims, index);
+}
+
+AFAPI af_err af_lookup( af_array *out,
+        const af_array in, const af_array indices,
+        const unsigned dim)
+{
+    return CALL(out, in, indices, dim);
+}
+
+AFAPI af_err af_assign_seq( af_array *out,
+        const af_array lhs,
+        const unsigned ndims, const af_seq* const indices,
+        const af_array rhs)
+{
+    return CALL(out, lhs, ndims, indices, rhs);
+}
+
+AFAPI af_err af_index_gen(  af_array *out,
+        const af_array in,
+        const dim_t ndims, const af_index_t* indices)
+{
+    return CALL(out, in, ndims, indices);
+}
+
+AFAPI af_err af_assign_gen( af_array *out,
+        const af_array lhs,
+        const dim_t ndims, const af_index_t* indices,
+        const af_array rhs)
+{
+    return CALL(out, lhs, ndims, indices, rhs);
+}
diff --git a/src/api/hapi/lapack.cpp b/src/api/hapi/lapack.cpp
new file mode 100644
index 0000000..f60009c
--- /dev/null
+++ b/src/api/hapi/lapack.cpp
@@ -0,0 +1,84 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include <af/lapack.h>
+#include "symbol_manager.hpp"
+
+af_err af_svd(af_array *u, af_array *s, af_array *vt, const af_array in)
+{
+    return CALL(u, s, vt, in);
+}
+
+af_err af_svd_inplace(af_array *u, af_array *s, af_array *vt, af_array in)
+{
+    return CALL(u, s, vt, in);
+}
+
+af_err af_lu(af_array *lower, af_array *upper, af_array *pivot, const af_array in)
+{
+    return CALL(lower, upper, pivot, in);
+}
+
+af_err af_lu_inplace(af_array *pivot, af_array in, const bool is_lapack_piv)
+{
+    return CALL(pivot, in, is_lapack_piv);
+}
+
+af_err af_qr(af_array *q, af_array *r, af_array *tau, const af_array in)
+{
+    return CALL(q, r, tau, in);
+}
+
+af_err af_qr_inplace(af_array *tau, af_array in)
+{
+    return CALL(tau, in);
+}
+
+af_err af_cholesky(af_array *out, int *info, const af_array in, const bool is_upper)
+{
+    return CALL(out, info, in, is_upper);
+}
+
+af_err af_cholesky_inplace(int *info, af_array in, const bool is_upper)
+{
+    return CALL(info, in, is_upper);
+}
+
+af_err af_solve(af_array *x, const af_array a, const af_array b,
+        const af_mat_prop options)
+{
+    return CALL(x, a, b, options);
+}
+
+af_err af_solve_lu(af_array *x, const af_array a, const af_array piv,
+        const af_array b, const af_mat_prop options)
+{
+    return CALL(x, a, piv, b, options);
+}
+
+af_err af_inverse(af_array *out, const af_array in, const af_mat_prop options)
+{
+    return CALL(out, in, options);
+}
+
+af_err af_rank(unsigned *rank, const af_array in, const double tol)
+{
+    return CALL(rank, in, tol);
+}
+
+af_err af_det(double *det_real, double *det_imag, const af_array in)
+{
+    return CALL(det_real, det_imag, in);
+}
+
+af_err af_norm(double *out, const af_array in, const af_norm_type type, const double p, const double q)
+{
+    return CALL(out, in, type, p, q);
+}
diff --git a/src/api/hapi/print.cpp b/src/api/hapi/print.cpp
deleted file mode 100644
index 7371910..0000000
--- a/src/api/hapi/print.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************
- * Copyright (c) 2015, ArrayFire
- * All rights reserved.
- *
- * This file is distributed under 3-clause BSD license.
- * The complete license agreement can be obtained at:
- * http://arrayfire.com/licenses/BSD-3-Clause
- ********************************************************/
-
-#include <af/util.h>
-#include "symbol_manager.hpp"
-
-af_err af_print_array(const af_array arr)
-{
-    AFSymbolManager& symbolManager = AFSymbolManager::getInstance();
-    return symbolManager.call("af_print_array", arr);
-}
diff --git a/src/api/hapi/signal.cpp b/src/api/hapi/signal.cpp
new file mode 100644
index 0000000..a4e6e9c
--- /dev/null
+++ b/src/api/hapi/signal.cpp
@@ -0,0 +1,117 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include <af/signal.h>
+#include "symbol_manager.hpp"
+
+#define APPROX_HAPI_DEF(af_func)\
+af_err af_func(af_array *out, const af_array in, const af_array pos, const af_interp_type method, const float offGrid) \
+{\
+    return CALL(out, in, pos, method, offGrid);\
+}
+
+APPROX_HAPI_DEF(af_approx1)
+APPROX_HAPI_DEF(af_approx2)
+
+#define FFT_HAPI_DEF(af_func)\
+af_err af_func(af_array in, const double norm_factor)\
+{\
+    return CALL(in, norm_factor);\
+}
+
+FFT_HAPI_DEF(af_fft_inplace)
+FFT_HAPI_DEF(af_fft2_inplace)
+FFT_HAPI_DEF(af_fft3_inplace)
+FFT_HAPI_DEF(af_ifft_inplace)
+FFT_HAPI_DEF(af_ifft2_inplace)
+FFT_HAPI_DEF(af_ifft3_inplace)
+
+af_err af_fft(af_array *out, const af_array in, const double norm_factor, const dim_t odim0)
+{
+    return CALL(out, in, norm_factor, odim0);
+}
+
+af_err af_fft2(af_array *out, const af_array in, const double norm_factor, const dim_t odim0, const dim_t odim1)
+{
+    return CALL(out, in, norm_factor, odim0, odim1);
+}
+
+af_err af_fft3(af_array *out, const af_array in, const double norm_factor, const dim_t odim0, const dim_t odim1, const dim_t odim2)
+{
+    return CALL(out, in, norm_factor, odim0, odim1, odim2);
+}
+
+af_err af_ifft(af_array *out, const af_array in, const double norm_factor, const dim_t odim0)
+{
+    return CALL(out, in, norm_factor, odim0);
+}
+
+af_err af_ifft2(af_array *out, const af_array in, const double norm_factor, const dim_t odim0, const dim_t odim1)
+{
+    return CALL(out, in, norm_factor, odim0, odim1);
+}
+
+af_err af_ifft3(af_array *out, const af_array in, const double norm_factor, const dim_t odim0, const dim_t odim1, const dim_t odim2)
+{
+    return CALL(out, in, norm_factor, odim0, odim1, odim2);
+}
+
+af_err af_fft_r2c (af_array *out, const af_array in, const double norm_factor, const dim_t pad0)
+{
+    return CALL(out, in, norm_factor, pad0);
+}
+
+af_err af_fft2_r2c(af_array *out, const af_array in, const double norm_factor, const dim_t pad0, const dim_t pad1)
+{
+    return CALL(out, in, norm_factor, pad0, pad1);
+}
+
+af_err af_fft3_r2c(af_array *out, const af_array in, const double norm_factor, const dim_t pad0, const dim_t pad1, const dim_t pad2)
+{
+    return CALL(out, in, norm_factor, pad0, pad1, pad2);
+}
+
+#define FFTC2R_HAPI_DEF(af_func)\
+af_err af_func(af_array *out, const af_array in, const double norm_factor, const bool is_odd)\
+{\
+    return CALL(out, in, norm_factor, is_odd);\
+}
+
+FFTC2R_HAPI_DEF(af_fft_c2r)
+FFTC2R_HAPI_DEF(af_fft2_c2r)
+FFTC2R_HAPI_DEF(af_fft3_c2r)
+
+#define CONV_HAPI_DEF(af_func)\
+af_err af_func(af_array *out, const af_array signal, const af_array filter, const af_conv_mode mode, af_conv_domain domain)\
+{\
+    return CALL(out, signal, filter, mode, domain);\
+}
+
+CONV_HAPI_DEF(af_convolve1)
+CONV_HAPI_DEF(af_convolve2)
+CONV_HAPI_DEF(af_convolve3)
+CONV_HAPI_DEF(af_fft_convolve1)
+CONV_HAPI_DEF(af_fft_convolve2)
+CONV_HAPI_DEF(af_fft_convolve3)
+
+af_err af_convolve2_sep(af_array *out, const af_array col_filter, const af_array row_filter, const af_array signal, const af_conv_mode mode)
+{
+    return CALL(out, col_filter, row_filter, signal, mode);
+}
+
+af_err af_fir(af_array *y, const af_array b, const af_array x)
+{
+    return CALL(y, b, x);
+}
+
+af_err af_iir(af_array *y, const af_array b, const af_array a, const af_array x)
+{
+    return CALL(y, b, a, x);
+}
diff --git a/src/api/hapi/statistics.cpp b/src/api/hapi/statistics.cpp
new file mode 100644
index 0000000..18705f6
--- /dev/null
+++ b/src/api/hapi/statistics.cpp
@@ -0,0 +1,82 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include <af/statistics.h>
+#include "symbol_manager.hpp"
+
+af_err af_mean(af_array *out, const af_array in, const dim_t dim)
+{
+    return CALL(out, in, dim);
+}
+
+af_err af_mean_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim)
+{
+    return CALL(out, in, weights, dim);
+}
+
+af_err af_var(af_array *out, const af_array in, const bool isbiased, const dim_t dim)
+{
+    return CALL(out, in, isbiased, dim);
+}
+
+af_err af_var_weighted(af_array *out, const af_array in, const af_array weights, const dim_t dim)
+{
+    return CALL(out, in, weights, dim);
+}
+
+af_err af_stdev(af_array *out, const af_array in, const dim_t dim)
+{
+    return CALL(out, in, dim);
+}
+
+af_err af_cov(af_array* out, const af_array X, const af_array Y, const bool isbiased)
+{
+    return CALL(out, X, Y, isbiased);
+}
+
+af_err af_median(af_array* out, const af_array in, const dim_t dim)
+{
+    return CALL(out, in, dim);
+}
+
+af_err af_mean_all(double *real, double *imag, const af_array in)
+{
+    return CALL(real, imag, in);
+}
+
+af_err af_mean_all_weighted(double *real, double *imag, const af_array in, const af_array weights)
+{
+    return CALL(real, imag, in, weights);
+}
+
+af_err af_var_all(double *realVal, double *imagVal, const af_array in, const bool isbiased)
+{
+    return CALL(realVal, imagVal, in, isbiased);
+}
+
+af_err af_var_all_weighted(double *realVal, double *imagVal, const af_array in, const af_array weights)
+{
+    return CALL(realVal, imagVal, in, weights);
+}
+
+af_err af_stdev_all(double *real, double *imag, const af_array in)
+{
+    return CALL(real, imag, in);
+}
+
+af_err af_median_all(double *realVal, double *imagVal, const af_array in)
+{
+    return CALL(realVal, imagVal, in);
+}
+
+af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y)
+{
+    return CALL(realVal, imagVal, X, Y);
+}
diff --git a/src/api/hapi/symbol_manager.hpp b/src/api/hapi/symbol_manager.hpp
index afed6b8..8af2f3f 100644
--- a/src/api/hapi/symbol_manager.hpp
+++ b/src/api/hapi/symbol_manager.hpp
@@ -73,6 +73,8 @@ class AFSymbolManager {
 
 #if defined(OS_WIN)
 #define CALL(...) AFSymbolManager::getInstance().call(__FUNCTION__, __VA_ARGS__)
+#define CALL_NO_PARAMS() AFSymbolManager::getInstance().call(__FUNCTION__)
 #else
 #define CALL(...) AFSymbolManager::getInstance().call(__func__, __VA_ARGS__)
+#define CALL_NO_PARAMS() AFSymbolManager::getInstance().call(__func__)
 #endif
diff --git a/src/api/hapi/util.cpp b/src/api/hapi/util.cpp
new file mode 100644
index 0000000..f98b79f
--- /dev/null
+++ b/src/api/hapi/util.cpp
@@ -0,0 +1,58 @@
+/*******************************************************
+ * Copyright (c) 2015, ArrayFire
+ * All rights reserved.
+ *
+ * This file is distributed under 3-clause BSD license.
+ * The complete license agreement can be obtained at:
+ * http://arrayfire.com/licenses/BSD-3-Clause
+ ********************************************************/
+
+#include <af/array.h>
+#include <af/util.h>
+#include "symbol_manager.hpp"
+
+af_err af_print_array(af_array arr)
+{
+    return CALL(arr);
+}
+
+af_err af_print_array_gen(const char *exp, const af_array arr, const int precision)
+{
+    return CALL(exp, arr, precision);
+}
+
+af_err af_save_array(int *index, const char* key, const af_array arr, const char *filename, const bool append)
+{
+    return CALL(index, key, arr, filename, append);
+}
+
+af_err af_read_array_index(af_array *out, const char *filename, const unsigned index)
+{
+    return CALL(out, filename, index);
+}
+
+af_err af_read_array_key(af_array *out, const char *filename, const char* key)
+{
+    return CALL(out, filename, key);
+}
+
+af_err af_read_array_key_check(int *index, const char *filename, const char* key)
+{
+    return CALL(index, filename, key);
+}
+
+af_err af_array_to_string(char **output, const char *exp, const af_array arr,
+        const int precision, const bool transpose)
+{
+    return CALL(output, exp, arr, precision, transpose);
+}
+
+af_err af_example_function(af_array* out, const af_array in, const af_someenum_t param)
+{
+    return CALL(out, in, param);
+}
+
+af_err af_get_version(int *major, int *minor, int *patch)
+{
+    return CALL(major, minor, patch);
+}

-- 
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