aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/kmeans/lloyds_algorithm_util.h
diff options
context:
space:
mode:
authorJianyi Cheng <jcheng@Jianyis-Beast.home.ukb>2020-06-12 13:02:33 +0100
committerJianyi Cheng <jcheng@Jianyis-Beast.home.ukb>2020-06-12 13:02:33 +0100
commitcb1d47636f9bb9adbdfb3f18982417b746b2bf40 (patch)
tree56fb65f7590b4ed73d714d3bfc8ce8e6e4594e51 /benchmarks/kmeans/lloyds_algorithm_util.h
parentc54b32a91427e5342ce5ffa94b2398a2fcb8c144 (diff)
downloadvericert-cb1d47636f9bb9adbdfb3f18982417b746b2bf40.tar.gz
vericert-cb1d47636f9bb9adbdfb3f18982417b746b2bf40.zip
Adding benchmarks to branch_jc
Diffstat (limited to 'benchmarks/kmeans/lloyds_algorithm_util.h')
-rw-r--r--benchmarks/kmeans/lloyds_algorithm_util.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/benchmarks/kmeans/lloyds_algorithm_util.h b/benchmarks/kmeans/lloyds_algorithm_util.h
new file mode 100644
index 0000000..3853c3d
--- /dev/null
+++ b/benchmarks/kmeans/lloyds_algorithm_util.h
@@ -0,0 +1,33 @@
+/**********************************************************************
+* Felix Winterstein, Imperial College London
+*
+* File: lloyds_algorithm_util.h
+*
+* Revision 1.01
+* Additional Comments: distributed under a BSD license, see LICENSE.txt
+*
+**********************************************************************/
+
+#ifndef LLOYDS_ALGORITHM_UTIL_H
+#define LLOYDS_ALGORITHM_UTIL_H
+
+#include "lloyds_algorithm_top.h"
+
+
+// helper functions
+void set_coord_type_vector_item(coord_type_vector *a, const coord_type b, const uint idx);
+void set_coord_type_vector_ext_item(coord_type_vector_ext *a, const coord_type_ext b, const uint idx);
+coord_type get_coord_type_vector_item(const coord_type_vector a, const uint idx);
+coord_type_ext get_coord_type_vector_ext_item(const coord_type_vector_ext a, const uint idx);
+
+data_type conv_long_to_short(data_type_ext p);
+data_type_ext conv_short_to_long(data_type p);
+mul_input_type saturate_mul_input(coord_type_ext val);
+coord_type_ext fi_mul(coord_type_ext op1, coord_type_ext op2);
+coord_type_ext tree_adder(coord_type_ext *input_array);
+void tree_cs(coord_type_ext *input_array,centre_index_type *index_array,coord_type_ext *res_val,centre_index_type *res_idx,const uint m);
+coord_type_ext tree_adder(coord_type_ext *input_array,const uint m);
+void compute_distance(data_type p1, data_type p2, coord_type_ext *dist);
+
+
+#endif /* LLOYDS_ALGORITHM_UTIL_H */