You are not logged in.
Pages: 1
Hi;
What was the error message the compiler gave?
There aren't compiler's errors, but the application produces bad, meaningless results.
(completely different than non-parallel version) ![]()
I found a solution:
    int k, i, j;
    for (k=0; k<3; k++)
   {
      r[k][k]=0; // equivalent to sum = 0
      for (i=0; i<3; i++)
        r[k][k] = r[k][k] + a[i][k] * a[i][k]; // rkk = sqr(a0k) + sqr(a1k) + sqr(a2k) 
      r[k][k] = sqrt(r[k][k]);  // ||a||
      
      for (i=0; i<3; i++)
          q[i][k] = a[i][k]/r[k][k];
     
      for(j=k+1; j<3; j++) {
        r[k][j]=0;
        for(i=0; i<3; i++) r[k][j] += q[i][k] * a[i][j];
        for (i=0; i<3; i++) a[i][j] = a[i][j] - r[k][j]*q[i][k];
        
      }I have tested this and it's working good.
But now I must parallelize this code using OpenMP (it's the project for my college) and
I have a new problem. I try parallelize the main "for":
int k, i, j;
#pragma omp parallel for private (k, i, j) shared (a, q, r)
// ........but it doesn't work correctly. I noticed that the problematic fragment is:
for (i=0; i<3; i++) 
          q[i][k] = a[i][k]/r[k][k];but I don't know why it makes a problem...
Anybody help ?
Hello !
I'm very beginner in numerical methods... I have the pseudo-code
(look at image), but I don't know how intrepret this and how
I can implement this in C++...
Can You help me ?
Pages: 1