12 #ifndef MFEM_GECKO_HPP
13 #define MFEM_GECKO_HPP
198 #define GECKO_FLOAT_EPSILON std::numeric_limits<Float>::epsilon()
199 #define GECKO_FLOAT_MAX std::numeric_limits<Float>::max()
207 #if GECKO_WITH_DOUBLE_PRECISION
284 virtual Float optimum(
const std::vector<WeightedValue>& v)
const = 0;
296 Float x = v[0].value;
297 Float min = GECKO_FLOAT_MAX;
306 if (v[1].weight > v[0].weight)
312 for (std::vector<WeightedValue>::const_iterator
p = v.begin();
p != v.end();
316 for (std::vector<WeightedValue>::const_iterator q = v.begin(); q != v.end();
319 Float l = std::fabs(
p->value - q->value);
440 Float min = GECKO_FLOAT_MAX;
441 for (std::vector<WeightedValue>::const_iterator
p = v.begin();
p != v.end();
446 for (std::vector<WeightedValue>::const_iterator q = v.begin(); q != v.end();
448 if (q->value <
p->value)
452 else if (q->value >
p->value)
467 x = std::min(x,
p->value);
468 y = std::max(y,
p->value);
497 for (std::vector<WeightedValue>::const_iterator
p = v.begin();
p != v.end();
500 s.
value +=
p->weight *
p->value;
532 Float min = v[0].value;
533 Float max = v[0].value;
534 for (std::vector<WeightedValue>::const_iterator
p = v.begin() + 1;
p != v.end();
541 else if (
p->value > max)
546 return (min + max) / 2;
572 virtual bool quit()
const {
return false; }
587 typedef std::vector<Index>::const_iterator
ConstPtr;
596 typedef std::vector<Node>::const_iterator
ConstPtr;
709 void place(
bool sort =
false);
734 std::vector<Node::Index>
adj;
764 #endif // MFEM_GECKO_HPP
Node(Float pos=-1, Float length=1, Arc::Index arc=Arc::null, Node::Index parent=Node::null)
Node::Index permutation(uint rank) const
Float optimum(const std::vector< WeightedValue > &v) const
virtual Float optimum(const std::vector< WeightedValue > &v) const =0
Arc::Index node_begin(Node::Index i) const
virtual bool less(const WeightedSum &s, const WeightedSum &t) const
Float mean(const WeightedSum &sum) const
Arc::Index insert_arc(Node::Index i, Node::Index j, Float w=1, Float b=1)
std::vector< Float > bond
std::vector< Index >::const_iterator ConstPtr
Float mean(const WeightedSum &sum) const
Float mean(const WeightedSum &sum) const
Float optimum(const std::vector< WeightedValue > &v) const
std::vector< Node >::const_iterator ConstPtr
WeightedSum sum(const WeightedValue &term) const
std::vector< Float > weight
Float bond(Float w, Float l, uint k) const
Float bond(Float, Float, uint) const
virtual void beginiter(const Graph *, uint, uint, uint) const
WeightedSum sum(const WeightedValue &term) const
bool remove_arc(Arc::Index a)
void order(Functional *functional, uint iterations=1, uint window=2, uint period=2, uint seed=0, Progress *progress=0)
std::vector< Node::Index > adj
Float arc_weight(Arc::Index a) const
Arc::Index node_end(Node::Index i) const
virtual void endorder(const Graph *, Float) const
Node::Index arc_source(Arc::Index a) const
Float optimum(const std::vector< WeightedValue > &v, Float lmin) const
Float bond(Float w, Float l, uint k) const
std::vector< Node::Index > node_neighbors(Node::Index i) const
void relax(bool compatible, uint m=1)
Float mean(const WeightedSum &sum) const
WeightedValue(Float value, Float weight)
uint rank(Node::Index i) const
virtual WeightedSum sum(const WeightedSum &s, const WeightedValue &t) const
virtual void enditer(const Graph *, Float, Float) const
std::vector< Node::Index > perm
WeightedSum sum(const WeightedValue &term) const
bool placed(Node::Index i) const
WeightedSum sum(const WeightedValue &term) const
Float optimum(const std::vector< WeightedValue > &v) const
virtual void accumulate(WeightedSum &s, const WeightedValue &t) const
WeightedSum sum(const WeightedValue &term) const
virtual Float bond(Float w, Float l, uint k) const =0
const std::vector< Node::Index > & permutation() const
WeightedSum(Float value=0, Float weight=0)
bool remove_edge(Node::Index i, Node::Index j)
Arc::Index directed() const
Comparator(ConstPtr node_)
Float mean(const WeightedSum &sum) const
double p(const Vector &x, double t)
uint node_degree(Node::Index i) const
Float optimum(const std::vector< WeightedValue > &v) const
virtual Float mean(const WeightedSum &sum) const =0
virtual WeightedSum sum(const WeightedSum &s, const WeightedSum &t) const
Float length(Arc::Index a) const
WeightedSum sum(const WeightedValue &term) const
Graph(uint nodes, uint level)
Float bond(Float w, Float, uint) const
void vcycle(uint n, uint work=0)
void accumulate(WeightedSum &s, const WeightedSum &t) const
Arc::Index arc_index(Node::Index i, Node::Index j) const
Node::Index arc_target(Arc::Index a) const
Float optimum(const std::vector< WeightedValue > &v) const
virtual void beginphase(const Graph *, std::string) const
void shuffle(uint seed=0)
virtual void beginorder(const Graph *, Float) const
Float bond(Float w, Float l, uint k) const
Float optimum(const std::vector< WeightedValue > &v) const
bool less(const WeightedSum &s, const WeightedSum &t) const
Arc::Index reverse_arc(Arc::Index a) const
virtual void endphase(const Graph *, bool) const
Float length(Node::Index i, Node::Index j) const
virtual void accumulate(WeightedSum &s, const WeightedSum &t) const
Node::Index insert_node(Float length=1)
void refine(const Graph *graph)
void place(bool sort=false)
Float mean(const WeightedSum &sum) const
bool operator()(uint k, uint l) const
virtual bool quit() const
bool persistent(Node::Index i) const
Float bond(Float w, Float l, uint k) const
double f(const Vector &p)