| 436 | |
| 437 | |
| 438 | real N_VMaxNorm(N_Vector x) |
| 439 | { |
| 440 | integer N; |
| 441 | real max = ZERO, *xd, gmax; |
| 442 | machEnvType machenv; |
| 443 | |
| 444 | N = x->length; |
| 445 | xd = x->data; |
| 446 | machenv = x->machEnv; |
| 447 | |
| 448 | #ifndef _OPENMP |
| 449 | for (integer i=0; i < N; i++, xd++) { |
| 450 | if (ABS(*xd) > max) max = ABS(*xd); |
| 451 | } |
| 452 | #else |
| 453 | #pragma omp parallel |
| 454 | { |
| 455 | real max2 = ZERO; |
| 456 | #pragma omp for nowait |
| 457 | for (integer i=0; i < N; i++) { |
| 458 | if (ABS(xd[i]) > max2) |
| 459 | max2 = ABS(xd[i]); |
| 460 | } |
| 461 | #pragma omp critical |
| 462 | { |
| 463 | if(max2 > max) |
| 464 | max = max2; |
| 465 | } |
| 466 | } |
| 467 | #endif |
| 468 | gmax = PVecAllReduce(max, 2, machenv); |
| 469 | return(gmax); |
| 470 | } |
| 471 | |
| 472 | |
| 473 | real N_VWrmsNorm(N_Vector x, N_Vector w) |
no test coverage detected