Optimised sumVector

This commit is contained in:
Aadi Desai 2022-02-17 19:03:56 +00:00
parent 00405c820c
commit 0ad87f0c97
No known key found for this signature in database
GPG key ID: CFFFE425830EF4D9

View file

@ -48,8 +48,8 @@ void generateVector(float x[N]){
float sumVector(float x[], int M){
float y = 0.0;
for(int i = 0; i < M; i++){
y += 0.5 * x[i] + x[i] * x[i] * cos((x[i] - 128.0) / 128.0);
for(int i = 0;i<=M;i++){
y += (float)((int)x[i]>>1) + x[i]*x[i]*cosf((x[i]-128)*0.0078125);
}
return y;
}