PlayaRosenbrock.hpp

00001 /* @HEADER@ */
00002 //   
00003 /* @HEADER@ */
00004 
00005 #ifndef PLAYA_ROSENBROCK_HPP
00006 #define PLAYA_ROSENBROCK_HPP
00007 
00008 #include "PlayaObjectiveBase.hpp"
00009 #include "PlayaVectorType.hpp"
00010 
00011 namespace Playa
00012 {
00013 using std::ostringstream;
00014 
00041 class Rosenbrock : public ObjectiveBase
00042 {
00043 public:
00051   Rosenbrock(int N, double alpha, const VectorType<double>& vecType)
00052     : N_(N), vs_(vecType.createEvenlyPartitionedSpace(MPIComm::self(), 2*N)),
00053       alpha_(alpha)
00054     {}
00055 
00058 
00066   void  evalGrad(const Vector<double>& x, double& f, 
00067     Vector<double>& grad) const ;
00068 
00075   void eval(const Vector<double>& x, double& f) const ;
00076 
00081   Vector<double> getInit() const ;
00083 
00085   string description() const 
00086     {
00087       ostringstream oss;
00088       oss << "Rosenbrock[n=" << N_ << ", alpha=" << alpha_ << "]";
00089       return oss.str();
00090     }
00091 
00092 private:
00093   int N_;
00094   VectorSpace<double> vs_;
00095   double alpha_;
00096 };
00097 
00098 
00099 }
00100 
00101 #endif

doxygen