MCPcopy Create free account
hub / github.com/Gecode/gecode / max

Function max

gecode/minimodel/float-arith.cpp:381–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379 }
380
381 LinFloatExpr
382 max(const LinFloatExpr& e0, const LinFloatExpr& e1) {
383 using namespace MiniModel;
384 int n = 0;
385 if (hasType(e0, ArithNonLinFloatExpr::ANLFE_MAX))
386 n += static_cast<ArithNonLinFloatExpr*>(e0.nlfe())->n;
387 else
388 n += 1;
389 if (hasType(e1, ArithNonLinFloatExpr::ANLFE_MAX))
390 n += static_cast<ArithNonLinFloatExpr*>(e1.nlfe())->n;
391 else
392 n += 1;
393 ArithNonLinFloatExpr* ae =
394 new ArithNonLinFloatExpr(ArithNonLinFloatExpr::ANLFE_MAX,n);
395 int i=0;
396 if (hasType(e0, ArithNonLinFloatExpr::ANLFE_MAX)) {
397 ArithNonLinFloatExpr* e0e = static_cast<ArithNonLinFloatExpr*>(e0.nlfe());
398 for (; i<e0e->n; i++)
399 ae->a[i] = e0e->a[i];
400 } else {
401 ae->a[i++] = e0;
402 }
403 if (hasType(e1, ArithNonLinFloatExpr::ANLFE_MAX)) {
404 ArithNonLinFloatExpr* e1e = static_cast<ArithNonLinFloatExpr*>(e1.nlfe());
405 int curN = i;
406 for (; i<curN+e1e->n; i++)
407 ae->a[i] = e1e->a[i-curN];
408 } else {
409 ae->a[i++] = e1;
410 }
411 return LinFloatExpr(ae);
412 }
413
414 LinFloatExpr
415 max(const FloatVarArgs& x) {

Callers 1

postFunction · 0.70

Calls 4

LinFloatExprClass · 0.85
nlfeMethod · 0.80
hasTypeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected