minor update

release/4.3a0
Yong-Dian Jian 2012-02-14 04:08:43 +00:00
parent 2573383eca
commit 8b05fdb14f
1 changed files with 45 additions and 67 deletions

View File

@ -27,83 +27,61 @@ public:
} verbosityLevel; } verbosityLevel;
public: public:
int maxIterations_; size_t minIterations_;
int reset_; // number of iterations before reset, for cg and gmres size_t maxIterations_;
double epsilon_; // relative error size_t reset_; // number of iterations before reset, for cg and gmres
double epsilon_rel_; // relative error
double epsilon_abs_; // absolute error double epsilon_abs_; // absolute error
verbosityLevel verbosity_; verbosityLevel verbosity_;
size_t nReduce_ ;
boost::shared_ptr<DimSpec> skeleton_spec_;
bool est_cond_ ; bool est_cond_ ;
public: public:
IterativeOptimizationParameters() : IterativeOptimizationParameters()
maxIterations_(500), reset_(501), epsilon_(1e-3), epsilon_abs_(1e-3), : minIterations_(1), maxIterations_(500), reset_(501),
verbosity_(SILENT), nReduce_(0), skeleton_spec_(), est_cond_(false) { epsilon_rel_(1e-3), epsilon_abs_(1e-3), verbosity_(SILENT), est_cond_(false) {}
}
IterativeOptimizationParameters( IterativeOptimizationParameters(
const IterativeOptimizationParameters &parameters) : const IterativeOptimizationParameters &p) :
maxIterations_(parameters.maxIterations_), reset_(parameters.reset_), minIterations_(p.minIterations_), maxIterations_(p.maxIterations_), reset_(p.reset_),
epsilon_(parameters.epsilon_), epsilon_abs_(parameters.epsilon_abs_), epsilon_rel_(p.epsilon_rel_), epsilon_abs_(p.epsilon_abs_), verbosity_(p.verbosity_),
verbosity_(parameters.verbosity_), est_cond_(p.est_cond_){ }
nReduce_(parameters.nReduce_),
skeleton_spec_(parameters.skeleton_spec_),
est_cond_(parameters.est_cond_){
}
IterativeOptimizationParameters(int maxIterations, double epsilon, IterativeOptimizationParameters(size_t minIterations, size_t maxIterations, size_t reset,
double epsilon_abs, verbosityLevel verbosity = ERROR, int reset = -1, bool est_cond=false) : double epsilon, double epsilon_abs, verbosityLevel verbosity = ERROR, bool est_cond = false) :
maxIterations_(maxIterations), reset_(reset), epsilon_(epsilon), minIterations_(minIterations), maxIterations_(maxIterations), reset_(reset),
epsilon_abs_(epsilon_abs), verbosity_(verbosity), epsilon_rel_(epsilon), epsilon_abs_(epsilon_abs), verbosity_(verbosity), est_cond_(est_cond) {}
nReduce_(0),
skeleton_spec_(),
est_cond_(est_cond) {
if (reset_ == -1)
reset_ = maxIterations_ + 1;
}
int maxIterations() const { size_t minIterations() const { return minIterations_; }
return maxIterations_; size_t maxIterations() const { return maxIterations_; }
} size_t reset() const { return reset_; }
int reset() const { double epsilon() const { return epsilon_rel_; }
return reset_; double epsilon_rel() const { return epsilon_rel_; }
} double epsilon_abs() const { return epsilon_abs_; }
double epsilon() const { verbosityLevel verbosity() const { return verbosity_; }
return epsilon_; bool est_cond() const { return est_cond_ ; }
}
double epsilon_abs() const {
return epsilon_abs_;
}
verbosityLevel verbosity() const {
return verbosity_;
}
bool est_cond() const {
return est_cond_ ;
}
}; };
struct DimSpec: public std::vector<size_t> { //struct DimSpec: public std::vector<size_t> {
//
typedef std::vector<size_t> Base; // typedef std::vector<size_t> Base;
typedef boost::shared_ptr<DimSpec> shared_ptr; // typedef boost::shared_ptr<DimSpec> shared_ptr;
//
DimSpec() : // DimSpec() :
Base() { // Base() {
} // }
DimSpec(size_t n) : // DimSpec(size_t n) :
Base(n) { // Base(n) {
} // }
DimSpec(size_t n, size_t init) : // DimSpec(size_t n, size_t init) :
Base(n, init) { // Base(n, init) {
} // }
DimSpec(const VectorValues &V) : // DimSpec(const VectorValues &V) :
Base(V.size()) { // Base(V.size()) {
const size_t n = V.size(); // const size_t n = V.size();
for (size_t i = 0; i < n; ++i) { // for (size_t i = 0; i < n; ++i) {
(*this)[i] = V[i].rows(); // (*this)[i] = V[i].rows();
} // }
} // }
}; //};
} }