| 69 | 
  | 
  } | 
| 70 | 
  | 
 | 
| 71 | 
  | 
  void PRCGMinimizer::prepareStep(){ | 
| 72 | 
< | 
    std::vector<double> deltaGrad; | 
| 73 | 
< | 
    double beta; | 
| 72 | 
> | 
    std::vector<RealType> deltaGrad; | 
| 73 | 
> | 
    RealType beta; | 
| 74 | 
  | 
    size_t i; | 
| 75 | 
  | 
 | 
| 76 | 
  | 
    deltaGrad.resize(ndim); | 
| 83 | 
  | 
#ifndef IS_MPI | 
| 84 | 
  | 
    beta = dotProduct(deltaGrad, curG) / dotProduct(prevG, prevG); | 
| 85 | 
  | 
#else | 
| 86 | 
< | 
    double localDP1; | 
| 87 | 
< | 
    double localDP2; | 
| 88 | 
< | 
    double globalDP1; | 
| 89 | 
< | 
    double globalDP2; | 
| 86 | 
> | 
    RealType localDP1; | 
| 87 | 
> | 
    RealType localDP2; | 
| 88 | 
> | 
    RealType globalDP1; | 
| 89 | 
> | 
    RealType globalDP2; | 
| 90 | 
  | 
 | 
| 91 | 
  | 
    localDP1 =  dotProduct(deltaGrad, curG); | 
| 92 | 
  | 
    localDP2 = dotProduct(prevG, prevG); | 
| 93 | 
  | 
 | 
| 94 | 
< | 
    MPI_Allreduce(&localDP1, &globalDP1, 1, MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); | 
| 95 | 
< | 
    MPI_Allreduce(&localDP2, &globalDP2, 1, MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); | 
| 94 | 
> | 
    MPI_Allreduce(&localDP1, &globalDP1, 1, MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); | 
| 95 | 
> | 
    MPI_Allreduce(&localDP2, &globalDP2, 1, MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); | 
| 96 | 
  | 
   | 
| 97 | 
  | 
    beta = globalDP1 / globalDP2; | 
| 98 | 
  | 
#endif |