Skip to content

Commit 5f22761

Browse files
committed
test(ibex): add newton_01.cpp
1 parent cb2fa4e commit 5f22761

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/tests/ibex/newton_01.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*********************************************************************
2+
Author: Soonho Kong <[email protected]>
3+
4+
dReal -- Copyright (C) 2013 - 2016, the dReal Team
5+
6+
dReal is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
dReal is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with dReal. If not, see <http://www.gnu.org/licenses/>.
18+
*********************************************************************/
19+
20+
// Related issue: https://github.com/ibex-team/ibex-lib/issues/145
21+
22+
#include <algorithm>
23+
#include <iostream>
24+
#include "ibex/ibex.h"
25+
26+
using ibex::Variable;
27+
using ibex::Function;
28+
using ibex::NumConstraint;
29+
using ibex::CtcFwdBwd;
30+
using ibex::IntervalVector;
31+
using ibex::Interval;
32+
using ibex::ExprSymbol;
33+
using std::cout;
34+
using std::endl;
35+
36+
int main() {
37+
Variable x1,x2;
38+
Function f(x1,x2,ibex::Return(x1 - 1, ibex::asin(x2) - x1));
39+
double init_box[][2]={{1, 1}, {1.570796326794893, 1.570796326794901}};
40+
IntervalVector box(2,init_box);
41+
ibex::CtcNewton newton(f);
42+
cout << "Before: " << box << endl;
43+
newton.contract(box);
44+
cout << "After: " << box << endl;
45+
return 0;
46+
}

0 commit comments

Comments
 (0)