MCPcopy Create free account
hub / github.com/bgrimstad/splinter / compareBSplines

Function compareBSplines

test/testingutilities.cpp:487–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487bool compareBSplines(const BSpline &left, const BSpline &right)
488{
489 auto left_lb = left.getDomainLowerBound();
490 auto left_ub = left.getDomainUpperBound();
491 auto right_lb = right.getDomainLowerBound();
492 auto right_ub = right.getDomainUpperBound();
493
494 REQUIRE(left_lb.size() == left_ub.size());
495 REQUIRE(left_ub.size() == right_lb.size());
496 REQUIRE(right_lb.size() == right_ub.size());
497
498 int dim = left_lb.size();
499
500 auto points = linspace(dim);
501
502 for(int i = 0; i < dim; i++) {
503 REQUIRE(left_lb.at(i) == right_lb.at(i));
504 REQUIRE(left_ub.at(i) == right_ub.at(i));
505 }
506
507 return compareFunctions(left, right, points);
508
509// auto x0_vec = linspace(lb.at(0), ub.at(0), 10);
510// auto x1_vec = linspace(lb.at(1), ub.at(1), 10);
511//
512// DenseVector x(2);
513// for (auto x0 : x0_vec)
514// {
515// for (auto x1 : x1_vec)
516// {
517// x(0) = x0;
518// x(1) = x1;
519//
520// double yb = bs.eval(x);
521// double yb_orig = bs_orig.eval(x);
522// if (std::abs(yb-yb_orig) > 1e-8)
523// {
524// cout << yb << endl;
525// cout << yb_orig << endl;
526// return false;
527// }
528// }
529// }
530//
531// return true;
532}
533
534
535DataTable sample(const Function &func, std::vector<std::vector<double>> &points) {

Callers 1

domainReductionTestFunction · 0.85

Calls 4

compareFunctionsFunction · 0.85
getDomainLowerBoundMethod · 0.80
getDomainUpperBoundMethod · 0.80
linspaceFunction · 0.70

Tested by

no test coverage detected