[arrayfire] 37/248: Moved indexing utility functions to common location
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:53:52 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 11fbdfb0e7c6d434227559665b5e3201e26f924f
Author: pradeep <pradeep at arrayfire.com>
Date: Wed Sep 2 15:24:03 2015 -0400
Moved indexing utility functions to common location
---
src/api/c/index.cpp | 68 -------------------------------------
src/api/c/util.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++++
src/api/hapi/CMakeLists.txt | 3 ++
src/api/hapi/seq.cpp | 16 ---------
4 files changed, 84 insertions(+), 84 deletions(-)
diff --git a/src/api/c/index.cpp b/src/api/c/index.cpp
index 893559e..9dc7836 100644
--- a/src/api/c/index.cpp
+++ b/src/api/c/index.cpp
@@ -222,71 +222,3 @@ af_err af_index_gen(af_array *out, const af_array in, const dim_t ndims, const a
return AF_SUCCESS;
}
-
-af_seq af_make_seq(double begin, double end, double step)
-{
- af_seq seq = {begin, end, step};
- return seq;
-}
-
-af_err af_create_indexers(af_index_t** indexers)
-{
- try {
- af_index_t* out = new af_index_t[4];
- std::swap(*indexers, out);
- }
- CATCHALL;
- return AF_SUCCESS;
-}
-
-af_err af_set_array_indexer(af_index_t* indexer, const af_array idx, const dim_t dim)
-{
- ARG_ASSERT(0, (indexer!=NULL));
- ARG_ASSERT(1, (idx!=NULL));
- ARG_ASSERT(2, (dim>=0 && dim<=3));
- try {
- indexer[dim].idx.arr = idx;
- indexer[dim].isBatch = false;
- indexer[dim].isSeq = false;
- }
- CATCHALL
- return AF_SUCCESS;
-}
-
-af_err af_set_seq_indexer(af_index_t* indexer, const af_seq* idx, const dim_t dim, const bool is_batch)
-{
- ARG_ASSERT(0, (indexer!=NULL));
- ARG_ASSERT(1, (idx!=NULL));
- ARG_ASSERT(2, (dim>=0 && dim<=3));
- try {
- indexer[dim].idx.seq = *idx;
- indexer[dim].isBatch = is_batch;
- indexer[dim].isSeq = true;
- }
- CATCHALL
- return AF_SUCCESS;
-}
-
-af_err af_set_seq_param_indexer(af_index_t* indexer,
- const double begin, const double end, const double step,
- const dim_t dim, const bool is_batch)
-{
- ARG_ASSERT(0, (indexer!=NULL));
- ARG_ASSERT(4, (dim>=0 && dim<=3));
- try {
- indexer[dim].idx.seq = af_make_seq(begin, end, step);
- indexer[dim].isBatch = is_batch;
- indexer[dim].isSeq = true;
- }
- CATCHALL
- return AF_SUCCESS;
-}
-
-af_err af_release_indexers(af_index_t* indexers)
-{
- try {
- delete[] indexers;
- }
- CATCHALL;
- return AF_SUCCESS;
-}
diff --git a/src/api/c/util.cpp b/src/api/c/util.cpp
new file mode 100644
index 0000000..efcf50d
--- /dev/null
+++ b/src/api/c/util.cpp
@@ -0,0 +1,81 @@
+/*******************************************************
+ * Copyright (c) 2014, 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/index.h>
+// The following should be included using double quotes
+// to enable it's use in HAPI wrapper
+#include "err_common.hpp"
+
+af_seq af_make_seq(double begin, double end, double step)
+{
+ af_seq seq = {begin, end, step};
+ return seq;
+}
+
+af_err af_create_indexers(af_index_t** indexers)
+{
+ try {
+ af_index_t* out = new af_index_t[4];
+ std::swap(*indexers, out);
+ }
+ CATCHALL;
+ return AF_SUCCESS;
+}
+
+af_err af_set_array_indexer(af_index_t* indexer, const af_array idx, const dim_t dim)
+{
+ ARG_ASSERT(0, (indexer!=NULL));
+ ARG_ASSERT(1, (idx!=NULL));
+ ARG_ASSERT(2, (dim>=0 && dim<=3));
+ try {
+ indexer[dim].idx.arr = idx;
+ indexer[dim].isBatch = false;
+ indexer[dim].isSeq = false;
+ }
+ CATCHALL
+ return AF_SUCCESS;
+}
+
+af_err af_set_seq_indexer(af_index_t* indexer, const af_seq* idx, const dim_t dim, const bool is_batch)
+{
+ ARG_ASSERT(0, (indexer!=NULL));
+ ARG_ASSERT(1, (idx!=NULL));
+ ARG_ASSERT(2, (dim>=0 && dim<=3));
+ try {
+ indexer[dim].idx.seq = *idx;
+ indexer[dim].isBatch = is_batch;
+ indexer[dim].isSeq = true;
+ }
+ CATCHALL
+ return AF_SUCCESS;
+}
+
+af_err af_set_seq_param_indexer(af_index_t* indexer,
+ const double begin, const double end, const double step,
+ const dim_t dim, const bool is_batch)
+{
+ ARG_ASSERT(0, (indexer!=NULL));
+ ARG_ASSERT(4, (dim>=0 && dim<=3));
+ try {
+ indexer[dim].idx.seq = af_make_seq(begin, end, step);
+ indexer[dim].isBatch = is_batch;
+ indexer[dim].isSeq = true;
+ }
+ CATCHALL
+ return AF_SUCCESS;
+}
+
+af_err af_release_indexers(af_index_t* indexers)
+{
+ try {
+ delete[] indexers;
+ }
+ CATCHALL;
+ return AF_SUCCESS;
+}
diff --git a/src/api/hapi/CMakeLists.txt b/src/api/hapi/CMakeLists.txt
index 23f7c8a..e94e577 100644
--- a/src/api/hapi/CMakeLists.txt
+++ b/src/api/hapi/CMakeLists.txt
@@ -6,6 +6,9 @@ FILE(GLOB hapi_headers
FILE(GLOB hapi_sources
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
+FILE(GLOB backend_sources
+ "../c/util.cpp")
+
ADD_LIBRARY(af SHARED
${hapi_headers}
${hapi_sources})
diff --git a/src/api/hapi/seq.cpp b/src/api/hapi/seq.cpp
deleted file mode 100644
index c839a48..0000000
--- a/src/api/hapi/seq.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************
- * Copyright (c) 2014, 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/seq.h>
-
-af_seq af_make_seq(double begin, double end, double step) {
- af_seq seq = {begin, end, step};
- return seq;
-}
-
--
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