aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/kmeans/lloyds_algorithm_util.h
diff options
context:
space:
mode:
authorJames Pollard <james@pollard.dev>2020-06-12 17:48:51 +0100
committerJames Pollard <james@pollard.dev>2020-06-12 17:48:51 +0100
commitf7795011ea9ac0d34ee565d3832f15b649bf1827 (patch)
treefd731b58626c8665032afd62068ece8cedc76eb0 /benchmarks/kmeans/lloyds_algorithm_util.h
parent9acb804500b590edbff66cd802216f58dde169cd (diff)
parent86f42b92d87020875e2a7ef4ba40de12d261685f (diff)
downloadvericert-kvx-f7795011ea9ac0d34ee565d3832f15b649bf1827.tar.gz
vericert-kvx-f7795011ea9ac0d34ee565d3832f15b649bf1827.zip
Merge branch 'master' into arrays-proof
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 */