Task 6 and 7 are done!
This commit is contained in:
parent
2058f7ed6f
commit
87e1eb75d5
36 changed files with 883 additions and 21 deletions
|
|
@ -9,14 +9,13 @@ void init_vec_b(const double * restrict a, double * restrict b, int n)
|
|||
double sum = 0;
|
||||
|
||||
#pragma omp simd reduction(+:sum)
|
||||
for (int k = 1; k < n; k+=2)
|
||||
for (int k = 0; k < n; k+=2)
|
||||
sum += a[i * n + k];
|
||||
|
||||
b[i] = sum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void matvec_mul(int n, const double * restrict A, const double * restrict x, double * restrict x_k)
|
||||
{
|
||||
#pragma omp parallel for
|
||||
|
|
@ -29,3 +28,4 @@ void matvec_mul(int n, const double * restrict A, const double * restrict x, dou
|
|||
x_k[i] = sum;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue