| 485 | } |
| 486 | |
| 487 | bool 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 | |
| 535 | DataTable sample(const Function &func, std::vector<std::vector<double>> &points) { |
no test coverage detected