MCPcopy Create free account
hub / github.com/KDE/labplot / cell

Function cell

src/backend/gsl/ExpressionParser.cpp:460–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458};
459
460double cell(double x, const std::string_view& variable, const std::weak_ptr<Payload> payload) {
461 const auto p = std::dynamic_pointer_cast<PayloadExpressionParser>(payload.lock());
462 if (!p) {
463 assert(p); // Debug build
464 return NAN;
465 }
466
467 const int index = (int)x - 1;
468 for (int i = 0; i < p->vars->length(); i++) {
469 if (p->vars->at(i).compare(QLatin1String(variable)) == 0) {
470 if (index >= 0 && index < p->xVectors->at(i)->length())
471 return p->xVectors->at(i)->at(index);
472 else
473 break;
474 }
475 }
476
477 return NAN;
478}
479
480double cell_default_value(double x, double defaultValue, const std::string_view& variable, const std::weak_ptr<Payload> payload) {
481 const auto p = std::dynamic_pointer_cast<PayloadExpressionParser>(payload.lock());

Callers 4

maFunction · 0.85
mrFunction · 0.85
psampleFunction · 0.85
rsampleFunction · 0.85

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected