Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add root function to math library. #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/math/p_root.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <pal.h>

/**
*
* 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 <math.h>
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)));
}
}