From 2713700fa23cbda74a7689b0d6be60387ed06399 Mon Sep 17 00:00:00 2001 From: Emanuel Date: Sat, 6 Jun 2015 03:11:33 -0300 Subject: [PATCH] Add root function to math library. --- src/math/p_root.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/math/p_root.c diff --git a/src/math/p_root.c b/src/math/p_root.c new file mode 100644 index 0000000..ff3aafa --- /dev/null +++ b/src/math/p_root.c @@ -0,0 +1,30 @@ +#include + +/** + * + * Calculate 'a' radicand to the index 'b' + * + * @param a Pointer to input vector + * + * @param b Pointer to input vector + * + * @param c Pointer to output vector + * + * @param n Size of 'a' and 'c' vector. + * + * @param p Number of processor to use (task parallelism) + * + * @param team Team to work with + * + * @return None + * + */ +#include +void p_root_f32(float *a, float *b, float *c, int n, int p, p_team_t team) +{ + + int i; + for (i = 0; i < n; i++) { + *(c + i) = powf(*(a + i), 1/(*(b + i))); + } +} \ No newline at end of file