 
   // TODO sum
   primal_energy = 10.0;
-  //imp::cu::minMax(primal_energies_, )
+  imp::cu::minMax(*primal_energies_, ep_min, ep_max);
   IMP_CUDA_CHECK();
 
   k_rofDualEnergy

           size_.width(), size_.height(), params_.lambda,
           *f_tex_, *p_tex_);
  dual_energy = 20.0;

  IMP_CUDA_CHECK();
}

    dual_energies_.reset(new ImageGpu32fC1(size_));
  }

  Pixel32fC1 ep_min, ep_max, ed_min, ed_max;

  k_rofPrimalEnergy
      <<<
         this->dimGrid(), this->dimBlock()
