20#include <boost/test/unit_test.hpp>
21#include <ql/math/functional.hpp>
22#include <ql/math/randomnumbers/mt19937uniformrng.hpp>
23#include <ql/methods/montecarlo/lsmbasissystem.hpp>
24#include <ql/types.hpp>
27using namespace boost::unit_test_framework;
33BOOST_AUTO_TEST_SUITE(StabilisedGLLSTest)
37 BOOST_TEST_MESSAGE(
"Testing QuantExt::StablizedGLLS with big input numbers (1D)");
39 std::vector<Real> x, y;
41 std::vector<ext::function<Real(Real)> > v;
42 v.push_back([](Real x) {
return 1.0; });
43 v.push_back([](Real x) {
return x; });
44 v.push_back([](Real x) {
return x * x; });
50 x.push_back(-3785510); y.push_back(6647590000);
51 x.push_back(-3705810); y.push_back(7956560000);
52 x.push_back(-3471430); y.push_back(21228600000);
53 x.push_back(-3314710); y.push_back(13044900000);
54 x.push_back(-3255810); y.push_back(33468500000);
55 x.push_back(-3248300); y.push_back(17334700000);
56 x.push_back(-3114480); y.push_back(10151300000);
57 x.push_back(-3113260); y.push_back(36295400);
58 x.push_back(-3098690); y.push_back(4971880);
59 x.push_back(-3057130); y.push_back(4898680000);
60 x.push_back(-3051020); y.push_back(3176250000);
61 x.push_back(-3046080); y.push_back(4372520000);
62 x.push_back(-3036630); y.push_back(52151500000);
63 x.push_back(-2993930); y.push_back(24165200000);
64 x.push_back(-2960970); y.push_back(330354000);
65 x.push_back(-2953400); y.push_back(5444900000);
66 x.push_back(-2919570); y.push_back(13833100000);
67 x.push_back(-2914280); y.push_back(219816000);
68 x.push_back(-2887750); y.push_back(20394800000);
69 x.push_back(-2859600); y.push_back(1236390000);
70 x.push_back(-2847340); y.push_back(27781900000);
71 x.push_back(-2845470); y.push_back(5648840000);
72 x.push_back(-2829940); y.push_back(16720800000);
73 x.push_back(-2809910); y.push_back(130198000000);
74 x.push_back(-2795220); y.push_back(4639700000);
75 x.push_back(-2789400); y.push_back(1451330000);
76 x.push_back(-2778810); y.push_back(709615000);
77 x.push_back(-2775750); y.push_back(27378800000);
78 x.push_back(-2735680); y.push_back(14926200000);
79 x.push_back(-2708270); y.push_back(32262700000);
80 x.push_back(-2676490); y.push_back(59605300000);
81 x.push_back(-2676470); y.push_back(2358130000);
82 x.push_back(-2669310); y.push_back(108703000000);
83 x.push_back(-2662420); y.push_back(25204900000);
84 x.push_back(-2648670); y.push_back(47167500000);
85 x.push_back(-2590840); y.push_back(1976380000);
86 x.push_back(-2587530); y.push_back(8121390000);
87 x.push_back(-2563420); y.push_back(171882000);
88 x.push_back(-2561190); y.push_back(7222640000);
89 x.push_back(-2545970); y.push_back(97811000);
90 x.push_back(-2544910); y.push_back(1341230000);
91 x.push_back(-2531030); y.push_back(5892440000);
92 x.push_back(-2514290); y.push_back(296502000);
93 x.push_back(-2512150); y.push_back(9890050000);
94 x.push_back(-2499340); y.push_back(19302600000);
95 x.push_back(-2492530); y.push_back(15483100000);
96 x.push_back(-2486520); y.push_back(5123850000);
97 x.push_back(-2475260); y.push_back(113184000);
98 x.push_back(-2470970); y.push_back(2232020000);
99 x.push_back(-2468900); y.push_back(25951800000);
100 x.push_back(-2465320); y.push_back(12108600000);
101 x.push_back(-2451530); y.push_back(10054400000);
102 x.push_back(-2449550); y.push_back(789513000);
103 x.push_back(-2438270); y.push_back(18344000000);
104 x.push_back(-2438020); y.push_back(14633000000);
105 x.push_back(-2436170); y.push_back(886414000);
106 x.push_back(-2426210); y.push_back(663629000);
107 x.push_back(-2415360); y.push_back(6439610000);
108 x.push_back(-2412350); y.push_back(10155300000);
109 x.push_back(-2407210); y.push_back(91927000000);
110 x.push_back(-2401500); y.push_back(12008300000);
111 x.push_back(-2381040); y.push_back(5631130000);
112 x.push_back(-2369550); y.push_back(19146200000);
113 x.push_back(-2351520); y.push_back(53207900000);
114 x.push_back(-2321990); y.push_back(5529370000);
115 x.push_back(-2319310); y.push_back(55292800000);
116 x.push_back(-2316600); y.push_back(8031610000);
117 x.push_back(-2311910); y.push_back(67915800000);
118 x.push_back(-2305900); y.push_back(3414250000);
119 x.push_back(-2297880); y.push_back(464327000);
120 x.push_back(-2297830); y.push_back(5487780000);
121 x.push_back(-2288690); y.push_back(438278);
122 x.push_back(-2281220); y.push_back(42339500000);
123 x.push_back(-2279540); y.push_back(35275200000);
124 x.push_back(-2269110); y.push_back(370882000);
125 x.push_back(-2267970); y.push_back(7833390000);
126 x.push_back(-2260480); y.push_back(48407500000);
127 x.push_back(-2259980); y.push_back(19963300000);
128 x.push_back(-2252110); y.push_back(1055560000);
129 x.push_back(-2249890); y.push_back(13131700000);
130 x.push_back(-2238670); y.push_back(9621520000);
131 x.push_back(-2234450); y.push_back(8279900000);
132 x.push_back(-2228910); y.push_back(40985800);
133 x.push_back(-2210330); y.push_back(6994520000);
134 x.push_back(-2201120); y.push_back(2561510000);
135 x.push_back(-2199540); y.push_back(58612700000);
136 x.push_back(-2188400); y.push_back(23132000000);
137 x.push_back(-2187090); y.push_back(79443300000);
138 x.push_back(-2185380); y.push_back(98445700000);
139 x.push_back(-2180480); y.push_back(10242800000);
140 x.push_back(-2176810); y.push_back(895524000);
141 x.push_back(-2175280); y.push_back(64544700000);
142 x.push_back(-2170620); y.push_back(25701100000);
143 x.push_back(-2157020); y.push_back(75964600000);
144 x.push_back(-2155940); y.push_back(41396100000);
145 x.push_back(-2138670); y.push_back(68850000000);
146 x.push_back(-2137090); y.push_back(13561700000);
147 x.push_back(-2128460); y.push_back(10827800000);
148 x.push_back(-2126760); y.push_back(3441740000);
149 x.push_back(-2126040); y.push_back(57062200000);
150 x.push_back(-2120070); y.push_back(3749230000);
151 x.push_back(-2115370); y.push_back(22334500000);
152 x.push_back(-2111680); y.push_back(8920670000);
153 x.push_back(-2101200); y.push_back(2171960000);
154 x.push_back(-2091580); y.push_back(1038880000);
155 x.push_back(-2086060); y.push_back(8118830000);
156 x.push_back(-2085460); y.push_back(37523500000);
157 x.push_back(-2077480); y.push_back(23531200000);
158 x.push_back(-2074070); y.push_back(39098600000);
159 x.push_back(-2068810); y.push_back(357532000);
160 x.push_back(-2063370); y.push_back(5125550000);
161 x.push_back(-2061570); y.push_back(554719000);
162 x.push_back(-2048470); y.push_back(4556820000);
163 x.push_back(-2043840); y.push_back(2789040000);
164 x.push_back(-2040270); y.push_back(50977700000);
165 x.push_back(-2040100); y.push_back(4580650000);
166 x.push_back(-2037580); y.push_back(358515000);
167 x.push_back(-2037210); y.push_back(60210700);
168 x.push_back(-2032200); y.push_back(56995300000);
169 x.push_back(-2010490); y.push_back(11028500000);
170 x.push_back(-2007580); y.push_back(21341300000);
171 x.push_back(-2007370); y.push_back(2769080000);
172 x.push_back(-1999220); y.push_back(18404800000);
173 x.push_back(-1993890); y.push_back(33280900000);
174 x.push_back(-1992740); y.push_back(39607100000);
175 x.push_back(-1983530); y.push_back(17512800000);
176 x.push_back(-1981280); y.push_back(75433800000);
177 x.push_back(-1974760); y.push_back(67683800);
178 x.push_back(-1967500); y.push_back(25633500000);
179 x.push_back(-1963860); y.push_back(15472500000);
180 x.push_back(-1963710); y.push_back(8035400000);
181 x.push_back(-1963670); y.push_back(56209300000);
182 x.push_back(-1963660); y.push_back(40213100000);
183 x.push_back(-1963330); y.push_back(6937200000);
184 x.push_back(-1962190); y.push_back(554226000);
185 x.push_back(-1957650); y.push_back(3276860000);
186 x.push_back(-1955200); y.push_back(313041000);
187 x.push_back(-1954620); y.push_back(23962700000);
188 x.push_back(-1948270); y.push_back(17393500000);
189 x.push_back(-1934970); y.push_back(7285600000);
190 x.push_back(-1934330); y.push_back(439341000);
191 x.push_back(-1930610); y.push_back(32918300000);
192 x.push_back(-1928480); y.push_back(652619000);
193 x.push_back(-1919910); y.push_back(17619600000);
194 x.push_back(-1914650); y.push_back(1817170000);
195 x.push_back(-1910250); y.push_back(41127100000);
196 x.push_back(-1909970); y.push_back(38804100000);
197 x.push_back(-1896280); y.push_back(16247700000);
198 x.push_back(-1895790); y.push_back(1805770000);
199 x.push_back(-1894120); y.push_back(9988020000);
200 x.push_back(-1892200); y.push_back(2857270000);
201 x.push_back(-1890260); y.push_back(14383700000);
202 x.push_back(-1889660); y.push_back(4420730000);
203 x.push_back(-1880740); y.push_back(84390400000);
204 x.push_back(-1877200); y.push_back(65460800000);
205 x.push_back(-1876620); y.push_back(25201800000);
206 x.push_back(-1875840); y.push_back(29691800000);
207 x.push_back(-1874290); y.push_back(36662700000);
208 x.push_back(-1864660); y.push_back(74300100000);
209 x.push_back(-1861630); y.push_back(69185000000);
210 x.push_back(-1861270); y.push_back(13635600000);
211 x.push_back(-1860050); y.push_back(8666950000);
212 x.push_back(-1856210); y.push_back(77616600);
213 x.push_back(-1852170); y.push_back(35845300000);
214 x.push_back(-1851760); y.push_back(73509600000);
215 x.push_back(-1839340); y.push_back(233971000000);
216 x.push_back(-1823400); y.push_back(1003360000);
217 x.push_back(-1820530); y.push_back(2663990000);
218 x.push_back(-1820410); y.push_back(4699760000);
219 x.push_back(-1814910); y.push_back(38534300000);
220 x.push_back(-1813220); y.push_back(111583000);
221 x.push_back(-1780030); y.push_back(55287800000);
222 x.push_back(-1778780); y.push_back(4155900000);
223 x.push_back(-1754210); y.push_back(58371000000);
224 x.push_back(-1751880); y.push_back(1793200000);
225 x.push_back(-1750810); y.push_back(44557300000);
226 x.push_back(-1748620); y.push_back(3059980000);
227 x.push_back(-1744860); y.push_back(159269000);
228 x.push_back(-1740270); y.push_back(4575270000);
229 x.push_back(-1734860); y.push_back(35236500000);
230 x.push_back(-1719490); y.push_back(2360650000);
231 x.push_back(-1719300); y.push_back(55787500000);
232 x.push_back(-1717030); y.push_back(870937000);
233 x.push_back(-1710070); y.push_back(6165510000);
234 x.push_back(-1707140); y.push_back(1071020000);
235 x.push_back(-1703700); y.push_back(33099900000);
236 x.push_back(-1666250); y.push_back(18262100000);
237 x.push_back(-1666010); y.push_back(486805000);
238 x.push_back(-1663120); y.push_back(20967100000);
239 x.push_back(-1654990); y.push_back(470454000);
240 x.push_back(-1653580); y.push_back(2998690000);
241 x.push_back(-1639660); y.push_back(44373200000);
242 x.push_back(-1639000); y.push_back(1267830000);
243 x.push_back(-1634390); y.push_back(15732900000);
244 x.push_back(-1633300); y.push_back(65058700);
245 x.push_back(-1626460); y.push_back(2020740000);
246 x.push_back(-1623240); y.push_back(12074700000);
247 x.push_back(-1619910); y.push_back(21753100000);
248 x.push_back(-1608060); y.push_back(17984900000);
249 x.push_back(-1606680); y.push_back(22051100000);
250 x.push_back(-1606170); y.push_back(37747300000);
251 x.push_back(-1602990); y.push_back(475291000);
252 x.push_back(-1600340); y.push_back(29972900000);
253 x.push_back(-1596460); y.push_back(1940680000);
254 x.push_back(-1588470); y.push_back(87234700000);
255 x.push_back(-1586120); y.push_back(50444500000);
256 x.push_back(-1584800); y.push_back(2321190000);
257 x.push_back(-1579740); y.push_back(3085400000);
258 x.push_back(-1574780); y.push_back(3186990000);
259 x.push_back(-1574380); y.push_back(961264000);
260 x.push_back(-1568050); y.push_back(173244000);
261 x.push_back(-1565350); y.push_back(810019000);
262 x.push_back(-1563200); y.push_back(11511900000);
263 x.push_back(-1548860); y.push_back(154903000);
264 x.push_back(-1544360); y.push_back(2607070000);
265 x.push_back(-1542580); y.push_back(468262000);
266 x.push_back(-1529820); y.push_back(548601000);
267 x.push_back(-1529560); y.push_back(34995000000);
268 x.push_back(-1518810); y.push_back(37212000000);
269 x.push_back(-1518750); y.push_back(25748000000);
270 x.push_back(-1516600); y.push_back(1237850000);
271 x.push_back(-1511430); y.push_back(109024000000);
272 x.push_back(-1505770); y.push_back(16061000000);
273 x.push_back(-1501360); y.push_back(6813310000);
274 x.push_back(-1496150); y.push_back(4001070000);
275 x.push_back(-1493520); y.push_back(18352200000);
276 x.push_back(-1487860); y.push_back(17579700000);
277 x.push_back(-1485790); y.push_back(4482060000);
278 x.push_back(-1483540); y.push_back(27163100000);
279 x.push_back(-1479260); y.push_back(11395800000);
280 x.push_back(-1474260); y.push_back(6867880000);
281 x.push_back(-1467990); y.push_back(13878100000);
282 x.push_back(-1463870); y.push_back(62355100000);
283 x.push_back(-1458340); y.push_back(13743400000);
284 x.push_back(-1450910); y.push_back(7176080000);
285 x.push_back(-1444330); y.push_back(63445600000);
286 x.push_back(-1438760); y.push_back(19276800000);
287 x.push_back(-1433670); y.push_back(41227900000);
288 x.push_back(-1433110); y.push_back(118382000000);
289 x.push_back(-1430240); y.push_back(6801420000);
290 x.push_back(-1429350); y.push_back(20656100000);
291 x.push_back(-1427450); y.push_back(56217400000);
292 x.push_back(-1420470); y.push_back(20045000000);
293 x.push_back(-1419650); y.push_back(343972000);
294 x.push_back(-1418440); y.push_back(72124700000);
295 x.push_back(-1408830); y.push_back(217039000000);
296 x.push_back(-1408530); y.push_back(269983000000);
297 x.push_back(-1406940); y.push_back(33940900000);
298 x.push_back(-1389990); y.push_back(7653740000);
299 x.push_back(-1385820); y.push_back(29413900000);
300 x.push_back(-1382460); y.push_back(81026800000);
301 x.push_back(-1380870); y.push_back(12674900000);
302 x.push_back(-1379210); y.push_back(5360790000);
303 x.push_back(-1378790); y.push_back(154367000000);
304 x.push_back(-1363090); y.push_back(12466100000);
305 x.push_back(-1358890); y.push_back(2547120000);
306 x.push_back(-1355810); y.push_back(58044300000);
307 x.push_back(-1352120); y.push_back(98736100000);
308 x.push_back(-1343170); y.push_back(9317640000);
309 x.push_back(-1340560); y.push_back(1045490000);
310 x.push_back(-1340550); y.push_back(20136400000);
311 x.push_back(-1333100); y.push_back(6108130000);
312 x.push_back(-1321540); y.push_back(10709000000);
313 x.push_back(-1305340); y.push_back(57110700000);
314 x.push_back(-1303310); y.push_back(30371600);
315 x.push_back(-1298780); y.push_back(586226000);
316 x.push_back(-1298120); y.push_back(96072500000);
317 x.push_back(-1289750); y.push_back(3009440000);
318 x.push_back(-1279520); y.push_back(30911700);
319 x.push_back(-1279180); y.push_back(6184920000);
320 x.push_back(-1270940); y.push_back(7996100000);
321 x.push_back(-1265140); y.push_back(17123900000);
322 x.push_back(-1263700); y.push_back(10639900000);
323 x.push_back(-1258810); y.push_back(17014700000);
324 x.push_back(-1258350); y.push_back(227967000000);
325 x.push_back(-1251800); y.push_back(81266700000);
326 x.push_back(-1249700); y.push_back(63571200000);
327 x.push_back(-1247970); y.push_back(8079130000);
328 x.push_back(-1246780); y.push_back(43539400000);
329 x.push_back(-1243090); y.push_back(179318000000);
330 x.push_back(-1240820); y.push_back(1059750000);
331 x.push_back(-1239260); y.push_back(151087000000);
332 x.push_back(-1232500); y.push_back(49744700000);
333 x.push_back(-1219900); y.push_back(17484200000);
334 x.push_back(-1217290); y.push_back(26273100000);
335 x.push_back(-1216700); y.push_back(3952690000);
336 x.push_back(-1212470); y.push_back(49007000000);
337 x.push_back(-1200970); y.push_back(26281000000);
338 x.push_back(-1199880); y.push_back(40463800000);
339 x.push_back(-1188570); y.push_back(27455100000);
340 x.push_back(-1187470); y.push_back(612916000);
341 x.push_back(-1178840); y.push_back(12828400000);
342 x.push_back(-1178140); y.push_back(36469400000);
343 x.push_back(-1175400); y.push_back(12088900000);
344 x.push_back(-1173550); y.push_back(6231780000);
345 x.push_back(-1171510); y.push_back(36856000000);
346 x.push_back(-1169290); y.push_back(22897300);
347 x.push_back(-1169110); y.push_back(154804000);
348 x.push_back(-1168500); y.push_back(57566400000);
349 x.push_back(-1166450); y.push_back(42294600000);
350 x.push_back(-1165490); y.push_back(8246510000);
351 x.push_back(-1163580); y.push_back(2731020000);
352 x.push_back(-1163140); y.push_back(41714800000);
353 x.push_back(-1162760); y.push_back(1515270000);
354 x.push_back(-1162030); y.push_back(41843700000);
355 x.push_back(-1159160); y.push_back(913801000);
356 x.push_back(-1143400); y.push_back(62628100000);
357 x.push_back(-1129490); y.push_back(37251700000);
358 x.push_back(-1125790); y.push_back(5636130000);
359 x.push_back(-1125530); y.push_back(8557710000);
360 x.push_back(-1123620); y.push_back(18241800000);
361 x.push_back(-1121100); y.push_back(2736250000);
362 x.push_back(-1117690); y.push_back(34174500000);
363 x.push_back(-1116830); y.push_back(10687100000);
364 x.push_back(-1113660); y.push_back(109939000000);
365 x.push_back(-1107590); y.push_back(2504280000);
366 x.push_back(-1097840); y.push_back(781542000);
367 x.push_back(-1092910); y.push_back(9956610000);
368 x.push_back(-1085620); y.push_back(50411400000);
369 x.push_back(-1081180); y.push_back(22804100000);
370 x.push_back(-1080430); y.push_back(77770000000);
371 x.push_back(-1077380); y.push_back(93696700);
372 x.push_back(-1071450); y.push_back(32584900000);
373 x.push_back(-1069330); y.push_back(152526000000);
374 x.push_back(-1065840); y.push_back(426548000);
375 x.push_back(-1063980); y.push_back(243612000000);
376 x.push_back(-1063830); y.push_back(6108760000);
377 x.push_back(-1058130); y.push_back(6509980000);
378 x.push_back(-1057690); y.push_back(26688500000);
379 x.push_back(-1057210); y.push_back(107867000000);
380 x.push_back(-1042790); y.push_back(192744000);
381 x.push_back(-1034790); y.push_back(612999000);
382 x.push_back(-1034710); y.push_back(13122200000);
383 x.push_back(-1027980); y.push_back(7615620000);
384 x.push_back(-1022230); y.push_back(36024900000);
385 x.push_back(-1019560); y.push_back(5732950000);
386 x.push_back(-1012170); y.push_back(44658700000);
387 x.push_back(-1011620); y.push_back(20912300000);
388 x.push_back(-1005240); y.push_back(40067800000);
389 x.push_back(-1003280); y.push_back(97478600000);
390 x.push_back(-1001310); y.push_back(8320570000);
391 x.push_back(-995426); y.push_back(95603400000);
392 x.push_back(-993490); y.push_back(5583570000);
393 x.push_back(-991487); y.push_back(32580400000);
394 x.push_back(-990636); y.push_back(53178700000);
395 x.push_back(-990275); y.push_back(112817000);
396 x.push_back(-990274); y.push_back(48205800000);
397 x.push_back(-988365); y.push_back(684403000);
398 x.push_back(-984174); y.push_back(107386000000);
399 x.push_back(-982098); y.push_back(387909000);
400 x.push_back(-980680); y.push_back(4071540000);
401 x.push_back(-976117); y.push_back(8492360000);
402 x.push_back(-975613); y.push_back(7514680000);
403 x.push_back(-969971); y.push_back(25428100000);
404 x.push_back(-962199); y.push_back(102135000000);
405 x.push_back(-960976); y.push_back(261743000);
406 x.push_back(-956524); y.push_back(2921070000);
407 x.push_back(-949394); y.push_back(159303000);
408 x.push_back(-942361); y.push_back(41315400000);
409 x.push_back(-941364); y.push_back(12468000000);
410 x.push_back(-926832); y.push_back(30139600000);
411 x.push_back(-920153); y.push_back(3571940000);
412 x.push_back(-915766); y.push_back(2362270000);
413 x.push_back(-908941); y.push_back(26289000000);
414 x.push_back(-903218); y.push_back(10999400000);
415 x.push_back(-901096); y.push_back(8753440000);
416 x.push_back(-897726); y.push_back(6205020000);
417 x.push_back(-894429); y.push_back(24480800000);
418 x.push_back(-883866); y.push_back(74896900000);
419 x.push_back(-871810); y.push_back(335075000);
420 x.push_back(-870209); y.push_back(40547500000);
421 x.push_back(-863257); y.push_back(94311700);
422 x.push_back(-843840); y.push_back(16675600000);
423 x.push_back(-839200); y.push_back(4937470000);
424 x.push_back(-838530); y.push_back(5996490000);
425 x.push_back(-831476); y.push_back(60985800000);
426 x.push_back(-830936); y.push_back(122832000000);
427 x.push_back(-823453); y.push_back(16107200000);
428 x.push_back(-823014); y.push_back(1258650000);
429 x.push_back(-817723); y.push_back(1734220000);
430 x.push_back(-814020); y.push_back(22877100000);
431 x.push_back(-811479); y.push_back(2748760000);
432 x.push_back(-809562); y.push_back(3231710000);
433 x.push_back(-804696); y.push_back(3810700000);
434 x.push_back(-786037); y.push_back(1631510000);
435 x.push_back(-784417); y.push_back(5390300000);
436 x.push_back(-781408); y.push_back(2540560000);
437 x.push_back(-778038); y.push_back(13501000000);
438 x.push_back(-774441); y.push_back(478227000);
439 x.push_back(-769762); y.push_back(7858920);
440 x.push_back(-767922); y.push_back(284949000);
441 x.push_back(-766503); y.push_back(172472000000);
442 x.push_back(-751171); y.push_back(17841600000);
443 x.push_back(-749229); y.push_back(6487500000);
444 x.push_back(-745089); y.push_back(53438700000);
445 x.push_back(-737979); y.push_back(71034500000);
446 x.push_back(-736748); y.push_back(1559780000);
447 x.push_back(-735490); y.push_back(3261110000);
448 x.push_back(-731303); y.push_back(46840300000);
449 x.push_back(-729343); y.push_back(38878500000);
450 x.push_back(-728830); y.push_back(22698500000);
451 x.push_back(-723391); y.push_back(120646000000);
452 x.push_back(-719867); y.push_back(102520000000);
453 x.push_back(-719187); y.push_back(64671400000);
454 x.push_back(-711428); y.push_back(32338600000);
455 x.push_back(-709184); y.push_back(3976630000);
456 x.push_back(-696269); y.push_back(7409190000);
457 x.push_back(-690874); y.push_back(44530200000);
458 x.push_back(-686284); y.push_back(44002200000);
459 x.push_back(-686010); y.push_back(41597400000);
460 x.push_back(-674092); y.push_back(2263600000);
461 x.push_back(-672880); y.push_back(59396400000);
462 x.push_back(-669449); y.push_back(6083730000);
463 x.push_back(-653231); y.push_back(598151);
464 x.push_back(-652116); y.push_back(1252700000);
465 x.push_back(-649127); y.push_back(5545360000);
466 x.push_back(-645632); y.push_back(1111500000);
467 x.push_back(-636997); y.push_back(104900000);
468 x.push_back(-634781); y.push_back(40226200000);
469 x.push_back(-628928); y.push_back(8759010000);
470 x.push_back(-620560); y.push_back(101045000000);
471 x.push_back(-614656); y.push_back(48163900000);
472 x.push_back(-613166); y.push_back(22588900);
473 x.push_back(-608135); y.push_back(2265350000);
474 x.push_back(-602830); y.push_back(21003000000);
475 x.push_back(-595976); y.push_back(30281700000);
476 x.push_back(-595240); y.push_back(17083500000);
477 x.push_back(-595119); y.push_back(41062400000);
478 x.push_back(-578178); y.push_back(28339000000);
479 x.push_back(-575932); y.push_back(11471900000);
480 x.push_back(-574440); y.push_back(2256850000);
481 x.push_back(-566760); y.push_back(14803300000);
482 x.push_back(-560977); y.push_back(4036820000);
483 x.push_back(-558070); y.push_back(84852400000);
484 x.push_back(-556747); y.push_back(124073000000);
485 x.push_back(-552921); y.push_back(1586820000);
486 x.push_back(-548712); y.push_back(9064990000);
487 x.push_back(-546803); y.push_back(9656290000);
488 x.push_back(-543992); y.push_back(4113190000);
489 x.push_back(-537913); y.push_back(50619500000);
490 x.push_back(-530839); y.push_back(21747300000);
491 x.push_back(-526333); y.push_back(21147100000);
492 x.push_back(-521058); y.push_back(38338800000);
493 x.push_back(-520990); y.push_back(26376100000);
494 x.push_back(-519548); y.push_back(36703000000);
495 x.push_back(-518786); y.push_back(43638500000);
496 x.push_back(-517739); y.push_back(10597800000);
497 x.push_back(-507022); y.push_back(6841320000);
498 x.push_back(-505393); y.push_back(5471170000);
499 x.push_back(-503880); y.push_back(5284920000);
500 x.push_back(-495142); y.push_back(73409600000);
501 x.push_back(-481800); y.push_back(28457800000);
502 x.push_back(-479933); y.push_back(12472500000);
503 x.push_back(-478095); y.push_back(41709900000);
504 x.push_back(-476239); y.push_back(33199300000);
505 x.push_back(-474191); y.push_back(37369100000);
506 x.push_back(-463810); y.push_back(228150000000);
507 x.push_back(-462751); y.push_back(5080750000);
508 x.push_back(-461013); y.push_back(94715100000);
509 x.push_back(-458713); y.push_back(50851500000);
510 x.push_back(-455108); y.push_back(6347770000);
511 x.push_back(-448784); y.push_back(36322700000);
512 x.push_back(-442329); y.push_back(20504800000);
513 x.push_back(-440017); y.push_back(8779150000);
514 x.push_back(-437718); y.push_back(433214000);
515 x.push_back(-435241); y.push_back(71511600000);
516 x.push_back(-433880); y.push_back(20676000000);
517 x.push_back(-429882); y.push_back(9493730);
518 x.push_back(-427423); y.push_back(96495600000);
519 x.push_back(-415886); y.push_back(55359100000);
520 x.push_back(-407545); y.push_back(10003800000);
521 x.push_back(-406526); y.push_back(3437690000);
522 x.push_back(-403941); y.push_back(49548100000);
523 x.push_back(-402376); y.push_back(2091490000);
524 x.push_back(-399225); y.push_back(3714250000);
525 x.push_back(-397820); y.push_back(22342600000);
526 x.push_back(-396885); y.push_back(1019950000);
527 x.push_back(-394718); y.push_back(1749870000);
528 x.push_back(-394095); y.push_back(3567690000);
529 x.push_back(-387249); y.push_back(13366000000);
530 x.push_back(-378038); y.push_back(6099400000);
531 x.push_back(-377259); y.push_back(56535900000);
532 x.push_back(-375340); y.push_back(29323900000);
533 x.push_back(-375100); y.push_back(40413700000);
534 x.push_back(-366602); y.push_back(47094200000);
535 x.push_back(-351251); y.push_back(43591400000);
536 x.push_back(-350010); y.push_back(37870900000);
537 x.push_back(-348916); y.push_back(18443200000);
538 x.push_back(-346757); y.push_back(18798600000);
539 x.push_back(-318196); y.push_back(102261000);
540 x.push_back(-317069); y.push_back(35451800000);
541 x.push_back(-311004); y.push_back(168376000000);
542 x.push_back(-309911); y.push_back(51694700000);
543 x.push_back(-302817); y.push_back(1879560000);
544 x.push_back(-273236); y.push_back(6318060000);
545 x.push_back(-271303); y.push_back(92423400000);
546 x.push_back(-266900); y.push_back(16893900);
547 x.push_back(-263574); y.push_back(971747000);
548 x.push_back(-260118); y.push_back(226590000000);
549 x.push_back(-258501); y.push_back(31429800000);
550 x.push_back(-257323); y.push_back(127407000);
551 x.push_back(-254462); y.push_back(4698590000);
552 x.push_back(-251804); y.push_back(145572000);
553 x.push_back(-250813); y.push_back(7532050000);
554 x.push_back(-241901); y.push_back(25081400000);
555 x.push_back(-240850); y.push_back(16499300000);
556 x.push_back(-230571); y.push_back(71582800000);
557 x.push_back(-229493); y.push_back(11097300000);
558 x.push_back(-228291); y.push_back(6917050000);
559 x.push_back(-226978); y.push_back(2355050000);
560 x.push_back(-225984); y.push_back(4660020000);
561 x.push_back(-225280); y.push_back(4572200000);
562 x.push_back(-221129); y.push_back(4745930000);
563 x.push_back(-220655); y.push_back(395378000);
564 x.push_back(-220128); y.push_back(255450000000);
565 x.push_back(-212635); y.push_back(5680600000);
566 x.push_back(-207977); y.push_back(20446300000);
567 x.push_back(-195767); y.push_back(2702520000);
568 x.push_back(-193499); y.push_back(54415400);
569 x.push_back(-186720); y.push_back(3099450000);
570 x.push_back(-179957); y.push_back(2050030000);
571 x.push_back(-176609); y.push_back(1171220000);
572 x.push_back(-173992); y.push_back(5912110000);
573 x.push_back(-172110); y.push_back(51790100000);
574 x.push_back(-170752); y.push_back(312892000000);
575 x.push_back(-164208); y.push_back(24675000000);
576 x.push_back(-162987); y.push_back(116691000000);
577 x.push_back(-157601); y.push_back(36050800000);
578 x.push_back(-151125); y.push_back(39014700000);
579 x.push_back(-148104); y.push_back(66298700000);
580 x.push_back(-147783); y.push_back(26281000000);
581 x.push_back(-134883); y.push_back(256163000000);
582 x.push_back(-131376); y.push_back(1088010000);
583 x.push_back(-131234); y.push_back(87481300000);
584 x.push_back(-117674); y.push_back(19146600000);
585 x.push_back(-111524); y.push_back(15687400000);
586 x.push_back(-100294); y.push_back(10817800000);
587 x.push_back(-99066.7); y.push_back(18966900000);
588 x.push_back(-97529.9); y.push_back(127772000000);
589 x.push_back(-93235.1); y.push_back(1328540000);
590 x.push_back(-75557.6); y.push_back(135845000000);
591 x.push_back(-71939.8); y.push_back(32708300000);
592 x.push_back(-70189.9); y.push_back(112167000000);
593 x.push_back(-66779.3); y.push_back(48189200000);
594 x.push_back(-66388.1); y.push_back(15881700000);
595 x.push_back(-62410.3); y.push_back(594780000);
596 x.push_back(-56582.7); y.push_back(33763600000);
597 x.push_back(-55542.4); y.push_back(1781470000);
598 x.push_back(-52836.8); y.push_back(70255800000);
599 x.push_back(-51546.1); y.push_back(6302580000);
600 x.push_back(-41151.6); y.push_back(14400500000);
601 x.push_back(-40824.2); y.push_back(108453000000);
602 x.push_back(-40620.9); y.push_back(63952400000);
603 x.push_back(-36542.4); y.push_back(1596450000);
604 x.push_back(-35350.8); y.push_back(17443400000);
605 x.push_back(-33200.3); y.push_back(109116000000);
606 x.push_back(-26318.7); y.push_back(74132500000);
607 x.push_back(-25688.8); y.push_back(3473250000);
608 x.push_back(-23581.3); y.push_back(1275210000);
609 x.push_back(-17910); y.push_back(4683150000);
610 x.push_back(-13508.7); y.push_back(263642000000);
611 x.push_back(-10286.7); y.push_back(37359000000);
612 x.push_back(-3795.14); y.push_back(80313100000);
613 x.push_back(339.985); y.push_back(29112300);
614 x.push_back(9421.72); y.push_back(10550800000);
615 x.push_back(13116.6); y.push_back(1088440);
616 x.push_back(24652.5); y.push_back(2724860000);
617 x.push_back(25418.5); y.push_back(567340000);
618 x.push_back(26790.8); y.push_back(2054540000);
619 x.push_back(28431); y.push_back(79279900000);
620 x.push_back(30653.3); y.push_back(8568070000);
621 x.push_back(35957.1); y.push_back(23860100000);
622 x.push_back(40433.7); y.push_back(30763900000);
623 x.push_back(55019); y.push_back(9733280);
624 x.push_back(65309.3); y.push_back(60649000000);
625 x.push_back(66793.8); y.push_back(6500990000);
626 x.push_back(74464.9); y.push_back(9261390000);
627 x.push_back(75478.7); y.push_back(79231800000);
628 x.push_back(80723.1); y.push_back(797890000);
629 x.push_back(108078); y.push_back(24970500000);
630 x.push_back(111762); y.push_back(23091600000);
631 x.push_back(112784); y.push_back(6146980000);
632 x.push_back(123015); y.push_back(1518700000);
633 x.push_back(130334); y.push_back(34579500000);
634 x.push_back(134188); y.push_back(530312000);
635 x.push_back(142306); y.push_back(153451000000);
636 x.push_back(146734); y.push_back(19513300000);
637 x.push_back(153586); y.push_back(120533000000);
638 x.push_back(156209); y.push_back(65870700000);
639 x.push_back(161788); y.push_back(2972790000);
640 x.push_back(165879); y.push_back(4375280000);
641 x.push_back(170931); y.push_back(14884400000);
642 x.push_back(184819); y.push_back(28301100000);
643 x.push_back(187046); y.push_back(29303900000);
644 x.push_back(198595); y.push_back(10473200000);
645 x.push_back(200527); y.push_back(98880300000);
646 x.push_back(203232); y.push_back(69507400000);
647 x.push_back(205665); y.push_back(22385100000);
648 x.push_back(212344); y.push_back(28215400000);
649 x.push_back(214561); y.push_back(2961960);
650 x.push_back(215077); y.push_back(75373600000);
651 x.push_back(218791); y.push_back(302331000000);
652 x.push_back(222681); y.push_back(108068000000);
653 x.push_back(225756); y.push_back(6041920000);
654 x.push_back(239017); y.push_back(24358200000);
655 x.push_back(240676); y.push_back(11908200000);
656 x.push_back(243407); y.push_back(29576700000);
657 x.push_back(248047); y.push_back(3567870000);
658 x.push_back(248087); y.push_back(79355900000);
659 x.push_back(255082); y.push_back(337974000);
660 x.push_back(259351); y.push_back(24872900000);
661 x.push_back(260627); y.push_back(25026300000);
662 x.push_back(261206); y.push_back(2816590000);
663 x.push_back(269919); y.push_back(14723600000);
664 x.push_back(291897); y.push_back(54841600000);
665 x.push_back(292705); y.push_back(3954190000);
666 x.push_back(293223); y.push_back(1599500000);
667 x.push_back(308294); y.push_back(13058100000);
668 x.push_back(308958); y.push_back(11409100000);
669 x.push_back(312736); y.push_back(3660670000);
670 x.push_back(312839); y.push_back(9567740000);
671 x.push_back(318209); y.push_back(26737900000);
672 x.push_back(318786); y.push_back(44569400000);
673 x.push_back(322524); y.push_back(37879700000);
674 x.push_back(322986); y.push_back(9537860000);
675 x.push_back(339522); y.push_back(66343800000);
676 x.push_back(346793); y.push_back(12605300000);
677 x.push_back(350096); y.push_back(180195000000);
678 x.push_back(359359); y.push_back(4734930000);
679 x.push_back(365945); y.push_back(302101000000);
680 x.push_back(366317); y.push_back(37412600);
681 x.push_back(371432); y.push_back(8640630000);
682 x.push_back(391471); y.push_back(22257600000);
683 x.push_back(398231); y.push_back(37217200000);
684 x.push_back(432550); y.push_back(42619700);
685 x.push_back(436346); y.push_back(1848230000);
686 x.push_back(443443); y.push_back(6910350000);
687 x.push_back(445824); y.push_back(50743600000);
688 x.push_back(446578); y.push_back(42354300000);
689 x.push_back(447668); y.push_back(182843000000);
690 x.push_back(447754); y.push_back(36714200000);
691 x.push_back(456330); y.push_back(5260260000);
692 x.push_back(458400); y.push_back(4449380000);
693 x.push_back(463438); y.push_back(5086850000);
694 x.push_back(472633); y.push_back(23681300000);
695 x.push_back(479020); y.push_back(2107580000);
696 x.push_back(480255); y.push_back(1392430000);
697 x.push_back(485796); y.push_back(16106800000);
698 x.push_back(491023); y.push_back(21524600000);
699 x.push_back(493004); y.push_back(56948300000);
700 x.push_back(497637); y.push_back(18632700000);
701 x.push_back(498860); y.push_back(167551000000);
702 x.push_back(500691); y.push_back(59175300000);
703 x.push_back(503147); y.push_back(34282900000);
704 x.push_back(503899); y.push_back(35831400000);
705 x.push_back(506526); y.push_back(60630800000);
706 x.push_back(507701); y.push_back(306180000);
707 x.push_back(508051); y.push_back(20880600000);
708 x.push_back(509671); y.push_back(1128020000);
709 x.push_back(518560); y.push_back(93909400000);
710 x.push_back(523288); y.push_back(7504710000);
711 x.push_back(552170); y.push_back(9104760000);
712 x.push_back(556366); y.push_back(78126400000);
713 x.push_back(571607); y.push_back(13720400000);
714 x.push_back(572663); y.push_back(5567500000);
715 x.push_back(573072); y.push_back(5650130000);
716 x.push_back(577875); y.push_back(474770000);
717 x.push_back(578831); y.push_back(135960000);
718 x.push_back(579161); y.push_back(2310100000);
719 x.push_back(591867); y.push_back(68360100000);
720 x.push_back(600861); y.push_back(21715400000);
721 x.push_back(616123); y.push_back(34821100000);
722 x.push_back(628239); y.push_back(121400000);
723 x.push_back(629173); y.push_back(1948270000);
724 x.push_back(630815); y.push_back(1287830);
725 x.push_back(631093); y.push_back(108295000000);
726 x.push_back(634182); y.push_back(318463000000);
727 x.push_back(640157); y.push_back(363512000);
728 x.push_back(646123); y.push_back(24251300000);
729 x.push_back(650255); y.push_back(16439700000);
730 x.push_back(655598); y.push_back(9144300000);
731 x.push_back(669056); y.push_back(48022100000);
732 x.push_back(680932); y.push_back(71693600000);
733 x.push_back(684788); y.push_back(76028600000);
734 x.push_back(701083); y.push_back(36323500000);
735 x.push_back(707509); y.push_back(176742000);
736 x.push_back(719985); y.push_back(179116000000);
737 x.push_back(731794); y.push_back(773486000);
738 x.push_back(733426); y.push_back(5480390000);
739 x.push_back(734917); y.push_back(114812000000);
740 x.push_back(739521); y.push_back(4787130000);
741 x.push_back(740977); y.push_back(15476500000);
742 x.push_back(743393); y.push_back(50330900000);
743 x.push_back(751407); y.push_back(20354200000);
744 x.push_back(751882); y.push_back(405190000000);
745 x.push_back(759358); y.push_back(2183280000);
746 x.push_back(767202); y.push_back(6528430000);
747 x.push_back(779066); y.push_back(25694500000);
748 x.push_back(788319); y.push_back(5704350000);
749 x.push_back(790213); y.push_back(134689000000);
750 x.push_back(793001); y.push_back(116230000);
751 x.push_back(797208); y.push_back(298680000000);
752 x.push_back(799237); y.push_back(43370000000);
753 x.push_back(800163); y.push_back(21171100000);
754 x.push_back(823478); y.push_back(32433000000);
755 x.push_back(828018); y.push_back(9521280000);
756 x.push_back(835937); y.push_back(38792600000);
757 x.push_back(836087); y.push_back(48391300000);
758 x.push_back(851657); y.push_back(78642200000);
759 x.push_back(854583); y.push_back(12190200000);
760 x.push_back(861789); y.push_back(226172000000);
761 x.push_back(865328); y.push_back(21404800000);
762 x.push_back(870339); y.push_back(12866500000);
763 x.push_back(878635); y.push_back(191988000000);
764 x.push_back(883901); y.push_back(11572400000);
765 x.push_back(901127); y.push_back(96723300000);
766 x.push_back(917549); y.push_back(34408300000);
767 x.push_back(919737); y.push_back(27487800000);
768 x.push_back(926773); y.push_back(98754800000);
769 x.push_back(932217); y.push_back(21316800000);
770 x.push_back(935983); y.push_back(8100020000);
771 x.push_back(957226); y.push_back(1050290000);
772 x.push_back(965943); y.push_back(31338800000);
773 x.push_back(969992); y.push_back(2961770000);
774 x.push_back(974473); y.push_back(6460350000);
775 x.push_back(975034); y.push_back(4573300000);
776 x.push_back(977934); y.push_back(23325600000);
777 x.push_back(1003090); y.push_back(17260600000);
778 x.push_back(1015680); y.push_back(130551000000);
779 x.push_back(1021080); y.push_back(91266700);
780 x.push_back(1025490); y.push_back(4223040000);
781 x.push_back(1026210); y.push_back(38156900000);
782 x.push_back(1045310); y.push_back(98423100);
783 x.push_back(1056590); y.push_back(15396200000);
784 x.push_back(1065060); y.push_back(2491660000);
785 x.push_back(1065730); y.push_back(157402000000);
786 x.push_back(1066680); y.push_back(186808000000);
787 x.push_back(1067600); y.push_back(23746000000);
788 x.push_back(1095040); y.push_back(21896700000);
789 x.push_back(1106310); y.push_back(40013000000);
790 x.push_back(1111940); y.push_back(7904500000);
791 x.push_back(1113310); y.push_back(55649000000);
792 x.push_back(1126160); y.push_back(57293300000);
793 x.push_back(1129470); y.push_back(245157000);
794 x.push_back(1129840); y.push_back(9970740000);
795 x.push_back(1140210); y.push_back(162958000000);
796 x.push_back(1144510); y.push_back(422492000000);
797 x.push_back(1166270); y.push_back(40816600000);
798 x.push_back(1169200); y.push_back(78688800000);
799 x.push_back(1175420); y.push_back(134903000000);
800 x.push_back(1178110); y.push_back(17221900000);
801 x.push_back(1185940); y.push_back(681213000);
802 x.push_back(1195430); y.push_back(2767580000);
803 x.push_back(1199280); y.push_back(40122500000);
804 x.push_back(1224150); y.push_back(46297700000);
805 x.push_back(1244930); y.push_back(97591200000);
806 x.push_back(1245590); y.push_back(2125010000);
807 x.push_back(1246520); y.push_back(4039900000);
808 x.push_back(1247170); y.push_back(141895000000);
809 x.push_back(1255720); y.push_back(23257400000);
810 x.push_back(1259430); y.push_back(76595100000);
811 x.push_back(1260520); y.push_back(7552180000);
812 x.push_back(1283550); y.push_back(10215600000);
813 x.push_back(1319460); y.push_back(276636000000);
814 x.push_back(1323080); y.push_back(142958000000);
815 x.push_back(1348750); y.push_back(28849500000);
816 x.push_back(1363670); y.push_back(586851000);
817 x.push_back(1367030); y.push_back(18033200000);
818 x.push_back(1368210); y.push_back(58319000000);
819 x.push_back(1379690); y.push_back(69655700000);
820 x.push_back(1393640); y.push_back(45191900000);
821 x.push_back(1396530); y.push_back(1109790000);
822 x.push_back(1404190); y.push_back(24877400000);
823 x.push_back(1406310); y.push_back(27652800000);
824 x.push_back(1416320); y.push_back(182722000);
825 x.push_back(1435800); y.push_back(26082200000);
826 x.push_back(1441770); y.push_back(70575400000);
827 x.push_back(1444080); y.push_back(5108370000);
828 x.push_back(1457220); y.push_back(42554100000);
829 x.push_back(1487060); y.push_back(1169910000);
830 x.push_back(1489830); y.push_back(10984600000);
831 x.push_back(1500980); y.push_back(35217900000);
832 x.push_back(1502070); y.push_back(60664700000);
833 x.push_back(1502250); y.push_back(77179700);
834 x.push_back(1504780); y.push_back(789511000);
835 x.push_back(1516500); y.push_back(17772500000);
836 x.push_back(1566650); y.push_back(16914200000);
837 x.push_back(1577680); y.push_back(6436100000);
838 x.push_back(1579160); y.push_back(240150000000);
839 x.push_back(1584700); y.push_back(32330100000);
840 x.push_back(1588400); y.push_back(54419600);
841 x.push_back(1592410); y.push_back(41109000000);
842 x.push_back(1594810); y.push_back(47762200000);
843 x.push_back(1601650); y.push_back(242693000000);
844 x.push_back(1604760); y.push_back(284569000);
845 x.push_back(1610050); y.push_back(121712000000);
846 x.push_back(1628940); y.push_back(5783270000);
847 x.push_back(1633120); y.push_back(24590700000);
848 x.push_back(1633550); y.push_back(21084700000);
849 x.push_back(1640640); y.push_back(12537600000);
850 x.push_back(1652570); y.push_back(59479000000);
851 x.push_back(1655800); y.push_back(12793200000);
852 x.push_back(1668220); y.push_back(4359890000);
853 x.push_back(1669230); y.push_back(51980500000);
854 x.push_back(1673460); y.push_back(19196200000);
855 x.push_back(1707010); y.push_back(89606200000);
856 x.push_back(1708600); y.push_back(3580800000);
857 x.push_back(1712950); y.push_back(4296770000);
858 x.push_back(1721540); y.push_back(100186000000);
859 x.push_back(1762900); y.push_back(79211000000);
860 x.push_back(1765790); y.push_back(18060800);
861 x.push_back(1774300); y.push_back(59076600000);
862 x.push_back(1778560); y.push_back(24550400000);
863 x.push_back(1784910); y.push_back(3053560000);
864 x.push_back(1806270); y.push_back(32868100000);
865 x.push_back(1811640); y.push_back(24829600000);
866 x.push_back(1815810); y.push_back(34457500000);
867 x.push_back(1846920); y.push_back(21537800000);
868 x.push_back(1847890); y.push_back(12746400000);
869 x.push_back(1863180); y.push_back(63896200000);
870 x.push_back(1865470); y.push_back(65715700000);
871 x.push_back(1876970); y.push_back(153767000000);
872 x.push_back(1878330); y.push_back(21199000000);
873 x.push_back(1884960); y.push_back(409201000000);
874 x.push_back(1885580); y.push_back(4774100000);
875 x.push_back(1899570); y.push_back(64453000);
876 x.push_back(1940440); y.push_back(17345600000);
877 x.push_back(1957760); y.push_back(84255100000);
878 x.push_back(1988320); y.push_back(66425500000);
879 x.push_back(1990150); y.push_back(22769800000);
880 x.push_back(2009170); y.push_back(116703000000);
881 x.push_back(2014380); y.push_back(11927300000);
882 x.push_back(2031040); y.push_back(17404700000);
883 x.push_back(2032540); y.push_back(72059800000);
884 x.push_back(2052080); y.push_back(92564600000);
885 x.push_back(2069540); y.push_back(1973030000);
886 x.push_back(2078660); y.push_back(111463000000);
887 x.push_back(2084780); y.push_back(4059980000);
888 x.push_back(2100040); y.push_back(4568210000);
889 x.push_back(2109850); y.push_back(93568100000);
890 x.push_back(2114020); y.push_back(1323740000);
891 x.push_back(2114880); y.push_back(143479000000);
892 x.push_back(2116040); y.push_back(19966600000);
893 x.push_back(2139220); y.push_back(314437000000);
894 x.push_back(2140310); y.push_back(22546600000);
895 x.push_back(2151240); y.push_back(4059570000);
896 x.push_back(2157770); y.push_back(259199000000);
897 x.push_back(2163880); y.push_back(108687000000);
898 x.push_back(2167850); y.push_back(37381000000);
899 x.push_back(2181320); y.push_back(3111490000);
900 x.push_back(2192090); y.push_back(98129000000);
901 x.push_back(2193630); y.push_back(17474300000);
902 x.push_back(2209370); y.push_back(24065400000);
903 x.push_back(2227150); y.push_back(66655700000);
904 x.push_back(2240670); y.push_back(65031900000);
905 x.push_back(2240850); y.push_back(385443000000);
906 x.push_back(2249350); y.push_back(54081500000);
907 x.push_back(2260060); y.push_back(1225620000);
908 x.push_back(2272080); y.push_back(20635700000);
909 x.push_back(2276890); y.push_back(41914500000);
910 x.push_back(2301270); y.push_back(120385000000);
911 x.push_back(2302960); y.push_back(23482300000);
912 x.push_back(2320640); y.push_back(51734200000);
913 x.push_back(2320650); y.push_back(30394400000);
914 x.push_back(2336010); y.push_back(210031000000);
915 x.push_back(2337350); y.push_back(16737900000);
916 x.push_back(2338510); y.push_back(91972000000);
917 x.push_back(2357700); y.push_back(51483900000);
918 x.push_back(2379460); y.push_back(30991900000);
919 x.push_back(2399290); y.push_back(66141100000);
920 x.push_back(2421440); y.push_back(55624400000);
921 x.push_back(2421550); y.push_back(9547730000);
922 x.push_back(2440150); y.push_back(6341410000);
923 x.push_back(2447710); y.push_back(23898900000);
924 x.push_back(2465300); y.push_back(1902690000);
925 x.push_back(2467830); y.push_back(2538120000);
926 x.push_back(2478310); y.push_back(83603400000);
927 x.push_back(2484360); y.push_back(2568870000);
928 x.push_back(2486050); y.push_back(6738170000);
929 x.push_back(2511130); y.push_back(299601000000);
930 x.push_back(2525450); y.push_back(10126000000);
931 x.push_back(2555260); y.push_back(60903300000);
932 x.push_back(2559140); y.push_back(43812000000);
933 x.push_back(2563130); y.push_back(61366600000);
934 x.push_back(2578760); y.push_back(52929700000);
935 x.push_back(2610120); y.push_back(15630500000);
936 x.push_back(2642220); y.push_back(92302600);
937 x.push_back(2650870); y.push_back(9180030000);
938 x.push_back(2657610); y.push_back(65376300000);
939 x.push_back(2664620); y.push_back(56671800000);
940 x.push_back(2679430); y.push_back(10653200000);
941 x.push_back(2694280); y.push_back(16841300000);
942 x.push_back(2702400); y.push_back(2577630000);
943 x.push_back(2712720); y.push_back(89169900000);
944 x.push_back(2751590); y.push_back(128693000000);
945 x.push_back(2754810); y.push_back(24162500000);
946 x.push_back(2773930); y.push_back(35959100000);
947 x.push_back(2779250); y.push_back(21559600000);
948 x.push_back(2782660); y.push_back(181634000000);
949 x.push_back(2784460); y.push_back(15478500000);
950 x.push_back(2788200); y.push_back(1435940000);
951 x.push_back(2789740); y.push_back(11617300000);
952 x.push_back(2804620); y.push_back(27466500000);
953 x.push_back(2854120); y.push_back(1008740000);
954 x.push_back(2863020); y.push_back(748736000);
955 x.push_back(2877670); y.push_back(518376000);
956 x.push_back(2920480); y.push_back(49015700000);
957 x.push_back(2948340); y.push_back(1182600000);
958 x.push_back(2968530); y.push_back(50922600000);
959 x.push_back(2974520); y.push_back(3376730000);
960 x.push_back(3003480); y.push_back(28586800000);
961 x.push_back(3009450); y.push_back(126094000000);
962 x.push_back(3057970); y.push_back(5821900000);
963 x.push_back(3066930); y.push_back(6347340000);
964 x.push_back(3070940); y.push_back(1700380000);
965 x.push_back(3081280); y.push_back(14476600000);
966 x.push_back(3107100); y.push_back(908094000);
967 x.push_back(3108030); y.push_back(11210100000);
968 x.push_back(3108930); y.push_back(38050600000);
969 x.push_back(3134110); y.push_back(58425800000);
970 x.push_back(3148610); y.push_back(17085100000);
971 x.push_back(3185120); y.push_back(53031800000);
972 x.push_back(3258510); y.push_back(8409000000);
973 x.push_back(3268520); y.push_back(3316830000);
974 x.push_back(3293140); y.push_back(176581000000);
975 x.push_back(3293370); y.push_back(34819600000);
976 x.push_back(3302680); y.push_back(83729000000);
977 x.push_back(3325310); y.push_back(352444000000);
978 x.push_back(3380740); y.push_back(5713650000);
979 x.push_back(3380830); y.push_back(49984100000);
980 x.push_back(3405450); y.push_back(102992000000);
981 x.push_back(3407970); y.push_back(26784100000);
982 x.push_back(3458190); y.push_back(300434000000);
983 x.push_back(3461700); y.push_back(6092970000);
984 x.push_back(3479430); y.push_back(33403400000);
985 x.push_back(3514210); y.push_back(45409100000);
986 x.push_back(3563680); y.push_back(168130000000);
987 x.push_back(3582340); y.push_back(44141700000);
988 x.push_back(3594680); y.push_back(26575200000);
989 x.push_back(3606680); y.push_back(26277800000);
990 x.push_back(3654970); y.push_back(64993300000);
991 x.push_back(3674560); y.push_back(38963500000);
992 x.push_back(3699390); y.push_back(46693000000);
993 x.push_back(3734070); y.push_back(36856000000);
994 x.push_back(3737590); y.push_back(33200500000);
995 x.push_back(3750910); y.push_back(214492000000);
996 x.push_back(3757080); y.push_back(21250800000);
997 x.push_back(3787100); y.push_back(399561000000);
998 x.push_back(3792460); y.push_back(20480100000);
999 x.push_back(3795800); y.push_back(202723000000);
1000 x.push_back(3817270); y.push_back(7245750000);
1001 x.push_back(3825860); y.push_back(71192000000);
1002 x.push_back(3849970); y.push_back(225834000000);
1003 x.push_back(3921570); y.push_back(415278000000);
1004 x.push_back(3933950); y.push_back(46431900000);
1005 x.push_back(3945690); y.push_back(13534900000);
1006 x.push_back(4047170); y.push_back(3470350000);
1007 x.push_back(4047930); y.push_back(368560000000);
1008 x.push_back(4108270); y.push_back(75158500000);
1009 x.push_back(4183460); y.push_back(286197000000);
1010 x.push_back(4295020); y.push_back(25482100000);
1011 x.push_back(4304910); y.push_back(37203600000);
1012 x.push_back(4314270); y.push_back(180305000000);
1013 x.push_back(4360360); y.push_back(155196000000);
1014 x.push_back(4426930); y.push_back(39062300000);
1015 x.push_back(4451850); y.push_back(192177000000);
1016 x.push_back(4451920); y.push_back(2500950000);
1017 x.push_back(4468240); y.push_back(137583000000);
1018 x.push_back(4499510); y.push_back(39004400000);
1019 x.push_back(4499990); y.push_back(272265000000);
1020 x.push_back(4527040); y.push_back(666194000);
1021 x.push_back(4539560); y.push_back(7186070000);
1022 x.push_back(4600570); y.push_back(12832500000);
1023 x.push_back(4675530); y.push_back(42036800000);
1024 x.push_back(4709490); y.push_back(9942470000);
1025 x.push_back(4732350); y.push_back(9577110000);
1026 x.push_back(4769660); y.push_back(355010000);
1027 x.push_back(4918270); y.push_back(51580600000);
1028 x.push_back(4933220); y.push_back(20196000000);
1029 x.push_back(5073370); y.push_back(48221300000);
1030 x.push_back(5177230); y.push_back(123157000000);
1031 x.push_back(5326160); y.push_back(55445200000);
1032 x.push_back(5338670); y.push_back(8993170000);
1033 x.push_back(5428300); y.push_back(8562550000);
1034 x.push_back(5452630); y.push_back(107327000000);
1035 x.push_back(5473440); y.push_back(1713490000);
1036 x.push_back(5564510); y.push_back(30016800000);
1037 x.push_back(5605190); y.push_back(101928000);
1038 x.push_back(5780430); y.push_back(265159000000);
1039 x.push_back(5873870); y.push_back(12441500000);
1040 x.push_back(5926190); y.push_back(3499210000);
1041 x.push_back(5987320); y.push_back(21360000000);
1042 x.push_back(6191300); y.push_back(43263700000);
1043 x.push_back(6345250); y.push_back(80164900000);
1044 x.push_back(6539470); y.push_back(2794630000);
1045 x.push_back(6575520); y.push_back(9829000000);
1046 x.push_back(6612570); y.push_back(65350400000);
1047 x.push_back(6929240); y.push_back(113606000000);
1048 x.push_back(7532910); y.push_back(12801500000);
1049 x.push_back(7946080); y.push_back(355173000000);
1061 Real scaling = 1E-12;
1062 std::vector<Real> xt(x.size()), yt(y.size());
1063 std::transform(x.begin(), x.end(), xt.begin(), std::bind(std::multiplies<Real>(), std::placeholders::_1, scaling));
1064 std::transform(y.begin(), y.end(), yt.begin(), std::bind(std::multiplies<Real>(), std::placeholders::_1, scaling));
1065 GeneralLinearLeastSquares m2(xt, yt, v);
1066 Real d0 = m2.coefficients()[0] / scaling;
1067 Real d1 = m2.coefficients()[1];
1068 Real d2 = m2.coefficients()[2] * scaling;
1072 if (std::abs((c0 - d0) / d0) > tol)
1073 BOOST_ERROR(
"could not verify c0 (" << c0 <<
") against expected value (" << d0 <<
"), relative error ("
1074 << (c0 - d0) / d0 <<
") exceeds tolerance (" << tol <<
")");
1075 if (std::abs((c1 - d1) / d1) > tol)
1076 BOOST_ERROR(
"could not verify c1 (" << c1 <<
") against expected value (" << d1 <<
"), relative error ("
1077 << (c1 - d1) / d1 <<
") exceeds tolerance (" << tol <<
")");
1078 if (std::abs((c2 - d2) / d2) > tol)
1079 BOOST_ERROR(
"could not verify c2 (" << c2 <<
") against expected value (" << d2 <<
"), relative error ("
1080 << (c2 - d2) / d2 <<
") exceeds tolerance (" << tol <<
")");
1085 Real y = m.
eval(x0, v);
1086 Real y2 = c0 + c1 * x0 + c2 * x0 * x0;
1087 if (std::abs((y - y2) / y2) > tol)
1088 BOOST_ERROR(
"could not verify eval(" << x0 <<
") for MaxBas mode, got " << y <<
", expected " << y2
1089 <<
", relative error " << (y - y2) / y2 <<
", tolerance " << tol);
1098 Real y = mb.
eval(x0, v);
1099 Real y2 = c0 + c1 * x0 + c2 * x0 * x0;
1100 if (std::abs((y - y2) / y2) > tol)
1101 BOOST_ERROR(
"could not verify eval(" << x0 <<
") for MeanStdDev mode, got " << y <<
", expected " << y2
1102 <<
", relative error " << (y - y2) / y2 <<
", tolerance " << tol);
1111 BOOST_TEST_MESSAGE(
"Testing QuantExt::StablizedGLLS 2D Regression");
1113 std::vector<Array> x;
1114 std::vector<Real> y;
1117 MersenneTwisterUniformRng mt(42);
1118 for (Size n = 0; n < 1000; ++n) {
1120 xa[0] = mt.nextReal() * 1000.0;
1121 xa[1] = mt.nextReal() * 2000.0;
1122 Real yt = -4982.0 + xa[0] * 43.0 + xa[1] * 142.0 + xa[0] * xa[1] * 0.8 - xa[0] * xa[0] * 0.02948 +
1123 xa[1] * xa[1] * 1533.0;
1128 std::vector<ext::function<Real(Array)> > basis =
1129 LsmBasisSystem::multiPathBasisSystem(2, 2, LsmBasisSystem::Monomial);
1133 GeneralLinearLeastSquares m2(x, y, basis);
1145 for (Size i = 0; i < basis.size(); ++i) {
1146 yn += basis[i](p) * m2.coefficients()[i];
1148 Real ys = m.
eval(p, basis);
1149 if (std::abs((ys - yn) / yn) > tol)
1150 BOOST_ERROR(
"could not verify eval(" << p <<
") for MaxAbs mode, got " << ys <<
", expected " << yn
1151 <<
", relative error " << (ys - yn) / yn <<
", tolerance " << tol);
1152 Real ysb = mb.
eval(p, basis);
1153 if (std::abs((ysb - yn) / yn) > tol)
1154 BOOST_ERROR(
"could not verify eval(" << p <<
") for MeanStdDev mode, got " << ysb <<
", expected " << yn
1155 <<
", relative error " << (ysb - yn) / yn <<
", tolerance "
1164BOOST_AUTO_TEST_SUITE_END()
1166BOOST_AUTO_TEST_SUITE_END()
Numerically stabilised general linear least squares.
const Array & transformedCoefficients() const
Real eval(xType x, vContainer &v, typename boost::enable_if< typename boost::is_arithmetic< xType >::type >::type *=0)
evaluate regression function in terms of original x, y
const Real yMultiplier() const
const Array & xMultiplier() const
Transformation parameters (u => (u + shift) * multiplier for u = x, y)
BOOST_AUTO_TEST_CASE(testBigInputNumbers)
Numerically stabilised general linear least squares.
Fixture that can be used at top level.