alglib4 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +47 -0
  3. data/ext/alglib/alglib.cpp +537 -0
  4. data/ext/alglib/alglib_array_converters.cpp +86 -0
  5. data/ext/alglib/alglib_array_converters.h +15 -0
  6. data/ext/alglib/alglib_utils.cpp +10 -0
  7. data/ext/alglib/alglib_utils.h +6 -0
  8. data/ext/alglib/alglibinternal.cpp +21749 -0
  9. data/ext/alglib/alglibinternal.h +2168 -0
  10. data/ext/alglib/alglibmisc.cpp +9106 -0
  11. data/ext/alglib/alglibmisc.h +2114 -0
  12. data/ext/alglib/ap.cpp +20094 -0
  13. data/ext/alglib/ap.h +7244 -0
  14. data/ext/alglib/dataanalysis.cpp +52588 -0
  15. data/ext/alglib/dataanalysis.h +10601 -0
  16. data/ext/alglib/diffequations.cpp +1342 -0
  17. data/ext/alglib/diffequations.h +282 -0
  18. data/ext/alglib/extconf.rb +5 -0
  19. data/ext/alglib/fasttransforms.cpp +4696 -0
  20. data/ext/alglib/fasttransforms.h +1018 -0
  21. data/ext/alglib/integration.cpp +4249 -0
  22. data/ext/alglib/integration.h +869 -0
  23. data/ext/alglib/interpolation.cpp +74502 -0
  24. data/ext/alglib/interpolation.h +12264 -0
  25. data/ext/alglib/kernels_avx2.cpp +2171 -0
  26. data/ext/alglib/kernels_avx2.h +201 -0
  27. data/ext/alglib/kernels_fma.cpp +1065 -0
  28. data/ext/alglib/kernels_fma.h +137 -0
  29. data/ext/alglib/kernels_sse2.cpp +735 -0
  30. data/ext/alglib/kernels_sse2.h +100 -0
  31. data/ext/alglib/linalg.cpp +65182 -0
  32. data/ext/alglib/linalg.h +9927 -0
  33. data/ext/alglib/optimization.cpp +135331 -0
  34. data/ext/alglib/optimization.h +19235 -0
  35. data/ext/alglib/solvers.cpp +20488 -0
  36. data/ext/alglib/solvers.h +4781 -0
  37. data/ext/alglib/specialfunctions.cpp +10672 -0
  38. data/ext/alglib/specialfunctions.h +2305 -0
  39. data/ext/alglib/statistics.cpp +19791 -0
  40. data/ext/alglib/statistics.h +1359 -0
  41. data/ext/alglib/stdafx.h +2 -0
  42. data/gpl2.txt +339 -0
  43. data/gpl3.txt +674 -0
  44. data/lib/alglib/version.rb +3 -0
  45. data/lib/alglib.rb +4 -0
  46. metadata +101 -0
@@ -0,0 +1,4781 @@
1
+ /*************************************************************************
2
+ ALGLIB 4.04.0 (source code generated 2024-12-21)
3
+ Copyright (c) Sergey Bochkanov (ALGLIB project).
4
+
5
+ >>> SOURCE LICENSE >>>
6
+ This program 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 (www.fsf.org); either version 2 of the
9
+ License, or (at your option) any later version.
10
+
11
+ This program 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
+ A copy of the GNU General Public License is available at
17
+ http://www.fsf.org/licensing/licenses
18
+ >>> END OF LICENSE >>>
19
+ *************************************************************************/
20
+ #ifndef _solvers_pkg_h
21
+ #define _solvers_pkg_h
22
+ #include "ap.h"
23
+ #include "alglibinternal.h"
24
+ #include "alglibmisc.h"
25
+ #include "linalg.h"
26
+
27
+ /////////////////////////////////////////////////////////////////////////
28
+ //
29
+ // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (DATATYPES)
30
+ //
31
+ /////////////////////////////////////////////////////////////////////////
32
+ namespace alglib_impl
33
+ {
34
+ #if defined(AE_COMPILE_POLYNOMIALSOLVER) || !defined(AE_PARTIAL_BUILD)
35
+ typedef struct
36
+ {
37
+ double maxerr;
38
+ } polynomialsolverreport;
39
+ #endif
40
+ #if defined(AE_COMPILE_DIRECTDENSESOLVERS) || !defined(AE_PARTIAL_BUILD)
41
+ typedef struct
42
+ {
43
+ ae_int_t terminationtype;
44
+ double r1;
45
+ double rinf;
46
+ } densesolverreport;
47
+ typedef struct
48
+ {
49
+ ae_int_t terminationtype;
50
+ double r2;
51
+ ae_matrix cx;
52
+ ae_int_t n;
53
+ ae_int_t k;
54
+ } densesolverlsreport;
55
+ #endif
56
+ #if defined(AE_COMPILE_ITERATIVESPARSE) || !defined(AE_PARTIAL_BUILD)
57
+ typedef struct
58
+ {
59
+ ae_int_t terminationtype;
60
+ ae_int_t nmv;
61
+ ae_int_t iterationscount;
62
+ double r2;
63
+ } sparsesolverreport;
64
+ typedef struct
65
+ {
66
+ ae_int_t n;
67
+ ae_vector x0;
68
+ double epsf;
69
+ ae_int_t maxits;
70
+ ae_int_t algotype;
71
+ ae_int_t gmresk;
72
+ ae_bool xrep;
73
+ ae_bool running;
74
+ ae_bool userterminationneeded;
75
+ ae_vector b;
76
+ ae_vector xf;
77
+ ae_int_t repiterationscount;
78
+ ae_int_t repnmv;
79
+ ae_int_t repterminationtype;
80
+ double repr2;
81
+ ae_int_t requesttype;
82
+ ae_vector x;
83
+ ae_vector ax;
84
+ double reply1;
85
+ ae_vector wrkb;
86
+ sparsematrix convbuf;
87
+ fblsgmresstate gmressolver;
88
+ rcommstate rstate;
89
+ } sparsesolverstate;
90
+ #endif
91
+ #if defined(AE_COMPILE_LINCG) || !defined(AE_PARTIAL_BUILD)
92
+ typedef struct
93
+ {
94
+ ae_vector rx;
95
+ ae_vector b;
96
+ ae_int_t n;
97
+ ae_int_t prectype;
98
+ ae_vector cx;
99
+ ae_vector cr;
100
+ ae_vector cz;
101
+ ae_vector p;
102
+ ae_vector r;
103
+ ae_vector z;
104
+ double alpha;
105
+ double beta;
106
+ double r2;
107
+ double meritfunction;
108
+ ae_vector x;
109
+ ae_vector mv;
110
+ ae_vector pv;
111
+ double vmv;
112
+ ae_vector startx;
113
+ double epsf;
114
+ ae_int_t maxits;
115
+ ae_int_t itsbeforerestart;
116
+ ae_int_t itsbeforerupdate;
117
+ ae_bool xrep;
118
+ ae_bool xupdated;
119
+ ae_bool needmv;
120
+ ae_bool needmtv;
121
+ ae_bool needmv2;
122
+ ae_bool needvmv;
123
+ ae_bool needprec;
124
+ ae_int_t repiterationscount;
125
+ ae_int_t repnmv;
126
+ ae_int_t repterminationtype;
127
+ ae_bool running;
128
+ ae_vector tmpd;
129
+ rcommstate rstate;
130
+ } lincgstate;
131
+ typedef struct
132
+ {
133
+ ae_int_t iterationscount;
134
+ ae_int_t nmv;
135
+ ae_int_t terminationtype;
136
+ double r2;
137
+ } lincgreport;
138
+ #endif
139
+ #if defined(AE_COMPILE_LINLSQR) || !defined(AE_PARTIAL_BUILD)
140
+ typedef struct
141
+ {
142
+ normestimatorstate nes;
143
+ ae_vector rx;
144
+ ae_vector b;
145
+ ae_int_t n;
146
+ ae_int_t m;
147
+ ae_int_t prectype;
148
+ ae_vector ui;
149
+ ae_vector uip1;
150
+ ae_vector vi;
151
+ ae_vector vip1;
152
+ ae_vector omegai;
153
+ ae_vector omegaip1;
154
+ double alphai;
155
+ double alphaip1;
156
+ double betai;
157
+ double betaip1;
158
+ double phibari;
159
+ double phibarip1;
160
+ double phii;
161
+ double rhobari;
162
+ double rhobarip1;
163
+ double rhoi;
164
+ double ci;
165
+ double si;
166
+ double theta;
167
+ double lambdai;
168
+ ae_vector d;
169
+ double anorm;
170
+ double bnorm2;
171
+ double dnorm;
172
+ double r2;
173
+ ae_vector x;
174
+ ae_vector mv;
175
+ ae_vector mtv;
176
+ double epsa;
177
+ double epsb;
178
+ double epsc;
179
+ ae_int_t maxits;
180
+ ae_bool xrep;
181
+ ae_bool xupdated;
182
+ ae_bool needmv;
183
+ ae_bool needmtv;
184
+ ae_bool needmv2;
185
+ ae_bool needvmv;
186
+ ae_bool needprec;
187
+ ae_int_t repiterationscount;
188
+ ae_int_t repnmv;
189
+ ae_int_t repterminationtype;
190
+ ae_bool running;
191
+ ae_bool userterminationneeded;
192
+ ae_vector tmpd;
193
+ ae_vector tmpx;
194
+ rcommstate rstate;
195
+ } linlsqrstate;
196
+ typedef struct
197
+ {
198
+ ae_int_t iterationscount;
199
+ ae_int_t nmv;
200
+ ae_int_t terminationtype;
201
+ } linlsqrreport;
202
+ #endif
203
+ #if defined(AE_COMPILE_DIRECTSPARSESOLVERS) || !defined(AE_PARTIAL_BUILD)
204
+ #endif
205
+ #if defined(AE_COMPILE_NLEQ) || !defined(AE_PARTIAL_BUILD)
206
+ typedef struct
207
+ {
208
+ ae_int_t n;
209
+ ae_int_t m;
210
+ double epsf;
211
+ ae_int_t maxits;
212
+ ae_bool xrep;
213
+ double stpmax;
214
+ ae_vector x;
215
+ double f;
216
+ ae_vector fi;
217
+ ae_matrix j;
218
+ ae_bool needf;
219
+ ae_bool needfij;
220
+ ae_bool xupdated;
221
+ rcommstate rstate;
222
+ ae_int_t repiterationscount;
223
+ ae_int_t repnfunc;
224
+ ae_int_t repnjac;
225
+ ae_int_t repterminationtype;
226
+ ae_vector xbase;
227
+ double fbase;
228
+ double fprev;
229
+ ae_vector candstep;
230
+ ae_vector rightpart;
231
+ ae_vector cgbuf;
232
+ } nleqstate;
233
+ typedef struct
234
+ {
235
+ ae_int_t iterationscount;
236
+ ae_int_t nfunc;
237
+ ae_int_t njac;
238
+ ae_int_t terminationtype;
239
+ } nleqreport;
240
+ #endif
241
+
242
+ }
243
+
244
+ /////////////////////////////////////////////////////////////////////////
245
+ //
246
+ // THIS SECTION CONTAINS C++ INTERFACE
247
+ //
248
+ /////////////////////////////////////////////////////////////////////////
249
+ namespace alglib
250
+ {
251
+
252
+ #if defined(AE_COMPILE_POLYNOMIALSOLVER) || !defined(AE_PARTIAL_BUILD)
253
+ /*************************************************************************
254
+
255
+ *************************************************************************/
256
+ class _polynomialsolverreport_owner
257
+ {
258
+ public:
259
+ _polynomialsolverreport_owner();
260
+ _polynomialsolverreport_owner(alglib_impl::polynomialsolverreport *attach_to);
261
+ _polynomialsolverreport_owner(const _polynomialsolverreport_owner &rhs);
262
+ _polynomialsolverreport_owner& operator=(const _polynomialsolverreport_owner &rhs);
263
+ virtual ~_polynomialsolverreport_owner();
264
+ alglib_impl::polynomialsolverreport* c_ptr();
265
+ const alglib_impl::polynomialsolverreport* c_ptr() const;
266
+ protected:
267
+ alglib_impl::polynomialsolverreport *p_struct;
268
+ bool is_attached;
269
+ };
270
+ class polynomialsolverreport : public _polynomialsolverreport_owner
271
+ {
272
+ public:
273
+ polynomialsolverreport();
274
+ polynomialsolverreport(alglib_impl::polynomialsolverreport *attach_to);
275
+ polynomialsolverreport(const polynomialsolverreport &rhs);
276
+ polynomialsolverreport& operator=(const polynomialsolverreport &rhs);
277
+ virtual ~polynomialsolverreport();
278
+ double &maxerr;
279
+
280
+ };
281
+ #endif
282
+
283
+ #if defined(AE_COMPILE_DIRECTDENSESOLVERS) || !defined(AE_PARTIAL_BUILD)
284
+ /*************************************************************************
285
+
286
+ *************************************************************************/
287
+ class _densesolverreport_owner
288
+ {
289
+ public:
290
+ _densesolverreport_owner();
291
+ _densesolverreport_owner(alglib_impl::densesolverreport *attach_to);
292
+ _densesolverreport_owner(const _densesolverreport_owner &rhs);
293
+ _densesolverreport_owner& operator=(const _densesolverreport_owner &rhs);
294
+ virtual ~_densesolverreport_owner();
295
+ alglib_impl::densesolverreport* c_ptr();
296
+ const alglib_impl::densesolverreport* c_ptr() const;
297
+ protected:
298
+ alglib_impl::densesolverreport *p_struct;
299
+ bool is_attached;
300
+ };
301
+ class densesolverreport : public _densesolverreport_owner
302
+ {
303
+ public:
304
+ densesolverreport();
305
+ densesolverreport(alglib_impl::densesolverreport *attach_to);
306
+ densesolverreport(const densesolverreport &rhs);
307
+ densesolverreport& operator=(const densesolverreport &rhs);
308
+ virtual ~densesolverreport();
309
+ ae_int_t &terminationtype;
310
+ double &r1;
311
+ double &rinf;
312
+
313
+ };
314
+
315
+
316
+ /*************************************************************************
317
+
318
+ *************************************************************************/
319
+ class _densesolverlsreport_owner
320
+ {
321
+ public:
322
+ _densesolverlsreport_owner();
323
+ _densesolverlsreport_owner(alglib_impl::densesolverlsreport *attach_to);
324
+ _densesolverlsreport_owner(const _densesolverlsreport_owner &rhs);
325
+ _densesolverlsreport_owner& operator=(const _densesolverlsreport_owner &rhs);
326
+ virtual ~_densesolverlsreport_owner();
327
+ alglib_impl::densesolverlsreport* c_ptr();
328
+ const alglib_impl::densesolverlsreport* c_ptr() const;
329
+ protected:
330
+ alglib_impl::densesolverlsreport *p_struct;
331
+ bool is_attached;
332
+ };
333
+ class densesolverlsreport : public _densesolverlsreport_owner
334
+ {
335
+ public:
336
+ densesolverlsreport();
337
+ densesolverlsreport(alglib_impl::densesolverlsreport *attach_to);
338
+ densesolverlsreport(const densesolverlsreport &rhs);
339
+ densesolverlsreport& operator=(const densesolverlsreport &rhs);
340
+ virtual ~densesolverlsreport();
341
+ ae_int_t &terminationtype;
342
+ double &r2;
343
+ real_2d_array cx;
344
+ ae_int_t &n;
345
+ ae_int_t &k;
346
+
347
+ };
348
+ #endif
349
+
350
+ #if defined(AE_COMPILE_ITERATIVESPARSE) || !defined(AE_PARTIAL_BUILD)
351
+ /*************************************************************************
352
+ This structure is a sparse solver report (both direct and iterative solvers
353
+ use this structure).
354
+
355
+ Following fields can be accessed by users:
356
+ * TerminationType (specific error codes depend on the solver being used,
357
+ with positive values ALWAYS signaling that something useful is returned
358
+ in X, and negative values ALWAYS meaning critical failures.
359
+ * NMV - number of matrix-vector products performed (0 for direct solvers)
360
+ * IterationsCount - inner iterations count (0 for direct solvers)
361
+ * R2 - squared residual
362
+ *************************************************************************/
363
+ class _sparsesolverreport_owner
364
+ {
365
+ public:
366
+ _sparsesolverreport_owner();
367
+ _sparsesolverreport_owner(alglib_impl::sparsesolverreport *attach_to);
368
+ _sparsesolverreport_owner(const _sparsesolverreport_owner &rhs);
369
+ _sparsesolverreport_owner& operator=(const _sparsesolverreport_owner &rhs);
370
+ virtual ~_sparsesolverreport_owner();
371
+ alglib_impl::sparsesolverreport* c_ptr();
372
+ const alglib_impl::sparsesolverreport* c_ptr() const;
373
+ protected:
374
+ alglib_impl::sparsesolverreport *p_struct;
375
+ bool is_attached;
376
+ };
377
+ class sparsesolverreport : public _sparsesolverreport_owner
378
+ {
379
+ public:
380
+ sparsesolverreport();
381
+ sparsesolverreport(alglib_impl::sparsesolverreport *attach_to);
382
+ sparsesolverreport(const sparsesolverreport &rhs);
383
+ sparsesolverreport& operator=(const sparsesolverreport &rhs);
384
+ virtual ~sparsesolverreport();
385
+ ae_int_t &terminationtype;
386
+ ae_int_t &nmv;
387
+ ae_int_t &iterationscount;
388
+ double &r2;
389
+
390
+ };
391
+
392
+
393
+ /*************************************************************************
394
+ This object stores state of the sparse linear solver object.
395
+
396
+ You should use ALGLIB functions to work with this object.
397
+ Never try to access its fields directly!
398
+ *************************************************************************/
399
+ class _sparsesolverstate_owner
400
+ {
401
+ public:
402
+ _sparsesolverstate_owner();
403
+ _sparsesolverstate_owner(alglib_impl::sparsesolverstate *attach_to);
404
+ _sparsesolverstate_owner(const _sparsesolverstate_owner &rhs);
405
+ _sparsesolverstate_owner& operator=(const _sparsesolverstate_owner &rhs);
406
+ virtual ~_sparsesolverstate_owner();
407
+ alglib_impl::sparsesolverstate* c_ptr();
408
+ const alglib_impl::sparsesolverstate* c_ptr() const;
409
+ protected:
410
+ alglib_impl::sparsesolverstate *p_struct;
411
+ bool is_attached;
412
+ };
413
+ class sparsesolverstate : public _sparsesolverstate_owner
414
+ {
415
+ public:
416
+ sparsesolverstate();
417
+ sparsesolverstate(alglib_impl::sparsesolverstate *attach_to);
418
+ sparsesolverstate(const sparsesolverstate &rhs);
419
+ sparsesolverstate& operator=(const sparsesolverstate &rhs);
420
+ virtual ~sparsesolverstate();
421
+
422
+ };
423
+ #endif
424
+
425
+ #if defined(AE_COMPILE_LINCG) || !defined(AE_PARTIAL_BUILD)
426
+ /*************************************************************************
427
+ This object stores state of the linear CG method.
428
+
429
+ You should use ALGLIB functions to work with this object.
430
+ Never try to access its fields directly!
431
+ *************************************************************************/
432
+ class _lincgstate_owner
433
+ {
434
+ public:
435
+ _lincgstate_owner();
436
+ _lincgstate_owner(alglib_impl::lincgstate *attach_to);
437
+ _lincgstate_owner(const _lincgstate_owner &rhs);
438
+ _lincgstate_owner& operator=(const _lincgstate_owner &rhs);
439
+ virtual ~_lincgstate_owner();
440
+ alglib_impl::lincgstate* c_ptr();
441
+ const alglib_impl::lincgstate* c_ptr() const;
442
+ protected:
443
+ alglib_impl::lincgstate *p_struct;
444
+ bool is_attached;
445
+ };
446
+ class lincgstate : public _lincgstate_owner
447
+ {
448
+ public:
449
+ lincgstate();
450
+ lincgstate(alglib_impl::lincgstate *attach_to);
451
+ lincgstate(const lincgstate &rhs);
452
+ lincgstate& operator=(const lincgstate &rhs);
453
+ virtual ~lincgstate();
454
+
455
+ };
456
+
457
+
458
+ /*************************************************************************
459
+
460
+ *************************************************************************/
461
+ class _lincgreport_owner
462
+ {
463
+ public:
464
+ _lincgreport_owner();
465
+ _lincgreport_owner(alglib_impl::lincgreport *attach_to);
466
+ _lincgreport_owner(const _lincgreport_owner &rhs);
467
+ _lincgreport_owner& operator=(const _lincgreport_owner &rhs);
468
+ virtual ~_lincgreport_owner();
469
+ alglib_impl::lincgreport* c_ptr();
470
+ const alglib_impl::lincgreport* c_ptr() const;
471
+ protected:
472
+ alglib_impl::lincgreport *p_struct;
473
+ bool is_attached;
474
+ };
475
+ class lincgreport : public _lincgreport_owner
476
+ {
477
+ public:
478
+ lincgreport();
479
+ lincgreport(alglib_impl::lincgreport *attach_to);
480
+ lincgreport(const lincgreport &rhs);
481
+ lincgreport& operator=(const lincgreport &rhs);
482
+ virtual ~lincgreport();
483
+ ae_int_t &iterationscount;
484
+ ae_int_t &nmv;
485
+ ae_int_t &terminationtype;
486
+ double &r2;
487
+
488
+ };
489
+ #endif
490
+
491
+ #if defined(AE_COMPILE_LINLSQR) || !defined(AE_PARTIAL_BUILD)
492
+ /*************************************************************************
493
+ This object stores state of the LinLSQR method.
494
+
495
+ You should use ALGLIB functions to work with this object.
496
+ *************************************************************************/
497
+ class _linlsqrstate_owner
498
+ {
499
+ public:
500
+ _linlsqrstate_owner();
501
+ _linlsqrstate_owner(alglib_impl::linlsqrstate *attach_to);
502
+ _linlsqrstate_owner(const _linlsqrstate_owner &rhs);
503
+ _linlsqrstate_owner& operator=(const _linlsqrstate_owner &rhs);
504
+ virtual ~_linlsqrstate_owner();
505
+ alglib_impl::linlsqrstate* c_ptr();
506
+ const alglib_impl::linlsqrstate* c_ptr() const;
507
+ protected:
508
+ alglib_impl::linlsqrstate *p_struct;
509
+ bool is_attached;
510
+ };
511
+ class linlsqrstate : public _linlsqrstate_owner
512
+ {
513
+ public:
514
+ linlsqrstate();
515
+ linlsqrstate(alglib_impl::linlsqrstate *attach_to);
516
+ linlsqrstate(const linlsqrstate &rhs);
517
+ linlsqrstate& operator=(const linlsqrstate &rhs);
518
+ virtual ~linlsqrstate();
519
+
520
+ };
521
+
522
+
523
+ /*************************************************************************
524
+
525
+ *************************************************************************/
526
+ class _linlsqrreport_owner
527
+ {
528
+ public:
529
+ _linlsqrreport_owner();
530
+ _linlsqrreport_owner(alglib_impl::linlsqrreport *attach_to);
531
+ _linlsqrreport_owner(const _linlsqrreport_owner &rhs);
532
+ _linlsqrreport_owner& operator=(const _linlsqrreport_owner &rhs);
533
+ virtual ~_linlsqrreport_owner();
534
+ alglib_impl::linlsqrreport* c_ptr();
535
+ const alglib_impl::linlsqrreport* c_ptr() const;
536
+ protected:
537
+ alglib_impl::linlsqrreport *p_struct;
538
+ bool is_attached;
539
+ };
540
+ class linlsqrreport : public _linlsqrreport_owner
541
+ {
542
+ public:
543
+ linlsqrreport();
544
+ linlsqrreport(alglib_impl::linlsqrreport *attach_to);
545
+ linlsqrreport(const linlsqrreport &rhs);
546
+ linlsqrreport& operator=(const linlsqrreport &rhs);
547
+ virtual ~linlsqrreport();
548
+ ae_int_t &iterationscount;
549
+ ae_int_t &nmv;
550
+ ae_int_t &terminationtype;
551
+
552
+ };
553
+ #endif
554
+
555
+ #if defined(AE_COMPILE_DIRECTSPARSESOLVERS) || !defined(AE_PARTIAL_BUILD)
556
+
557
+ #endif
558
+
559
+ #if defined(AE_COMPILE_NLEQ) || !defined(AE_PARTIAL_BUILD)
560
+ /*************************************************************************
561
+
562
+ *************************************************************************/
563
+ class _nleqstate_owner
564
+ {
565
+ public:
566
+ _nleqstate_owner();
567
+ _nleqstate_owner(alglib_impl::nleqstate *attach_to);
568
+ _nleqstate_owner(const _nleqstate_owner &rhs);
569
+ _nleqstate_owner& operator=(const _nleqstate_owner &rhs);
570
+ virtual ~_nleqstate_owner();
571
+ alglib_impl::nleqstate* c_ptr();
572
+ const alglib_impl::nleqstate* c_ptr() const;
573
+ protected:
574
+ alglib_impl::nleqstate *p_struct;
575
+ bool is_attached;
576
+ };
577
+ class nleqstate : public _nleqstate_owner
578
+ {
579
+ public:
580
+ nleqstate();
581
+ nleqstate(alglib_impl::nleqstate *attach_to);
582
+ nleqstate(const nleqstate &rhs);
583
+ nleqstate& operator=(const nleqstate &rhs);
584
+ virtual ~nleqstate();
585
+ ae_bool &needf;
586
+ ae_bool &needfij;
587
+ ae_bool &xupdated;
588
+ double &f;
589
+ real_1d_array fi;
590
+ real_2d_array j;
591
+ real_1d_array x;
592
+
593
+ };
594
+
595
+
596
+ /*************************************************************************
597
+
598
+ *************************************************************************/
599
+ class _nleqreport_owner
600
+ {
601
+ public:
602
+ _nleqreport_owner();
603
+ _nleqreport_owner(alglib_impl::nleqreport *attach_to);
604
+ _nleqreport_owner(const _nleqreport_owner &rhs);
605
+ _nleqreport_owner& operator=(const _nleqreport_owner &rhs);
606
+ virtual ~_nleqreport_owner();
607
+ alglib_impl::nleqreport* c_ptr();
608
+ const alglib_impl::nleqreport* c_ptr() const;
609
+ protected:
610
+ alglib_impl::nleqreport *p_struct;
611
+ bool is_attached;
612
+ };
613
+ class nleqreport : public _nleqreport_owner
614
+ {
615
+ public:
616
+ nleqreport();
617
+ nleqreport(alglib_impl::nleqreport *attach_to);
618
+ nleqreport(const nleqreport &rhs);
619
+ nleqreport& operator=(const nleqreport &rhs);
620
+ virtual ~nleqreport();
621
+ ae_int_t &iterationscount;
622
+ ae_int_t &nfunc;
623
+ ae_int_t &njac;
624
+ ae_int_t &terminationtype;
625
+
626
+ };
627
+ #endif
628
+
629
+ #if defined(AE_COMPILE_POLYNOMIALSOLVER) || !defined(AE_PARTIAL_BUILD)
630
+ /*************************************************************************
631
+ Polynomial root finding.
632
+
633
+ This function returns all roots of the polynomial
634
+ P(x) = a0 + a1*x + a2*x^2 + ... + an*x^n
635
+ Both real and complex roots are returned (see below).
636
+
637
+ INPUT PARAMETERS:
638
+ A - array[N+1], polynomial coefficients:
639
+ * A[0] is constant term
640
+ * A[N] is a coefficient of X^N
641
+ N - polynomial degree
642
+
643
+ OUTPUT PARAMETERS:
644
+ X - array of complex roots:
645
+ * for isolated real root, X[I] is strictly real: IMAGE(X[I])=0
646
+ * complex roots are always returned in pairs - roots occupy
647
+ positions I and I+1, with:
648
+ * X[I+1]=Conj(X[I])
649
+ * IMAGE(X[I]) > 0
650
+ * IMAGE(X[I+1]) = -IMAGE(X[I]) < 0
651
+ * multiple real roots may have non-zero imaginary part due
652
+ to roundoff errors. There is no reliable way to distinguish
653
+ real root of multiplicity 2 from two complex roots in
654
+ the presence of roundoff errors.
655
+ Rep - report, additional information, following fields are set:
656
+ * Rep.MaxErr - max( |P(xi)| ) for i=0..N-1. This field
657
+ allows to quickly estimate "quality" of the roots being
658
+ returned.
659
+
660
+ NOTE: this function uses companion matrix method to find roots. In case
661
+ internal EVD solver fails do find eigenvalues, exception is
662
+ generated.
663
+
664
+ NOTE: roots are not "polished" and no matrix balancing is performed
665
+ for them.
666
+
667
+ -- ALGLIB --
668
+ Copyright 24.02.2014 by Bochkanov Sergey
669
+ *************************************************************************/
670
+ void polynomialsolve(const real_1d_array &a, const ae_int_t n, complex_1d_array &x, polynomialsolverreport &rep, const xparams _xparams = alglib::xdefault);
671
+ #endif
672
+
673
+ #if defined(AE_COMPILE_DIRECTDENSESOLVERS) || !defined(AE_PARTIAL_BUILD)
674
+ /*************************************************************************
675
+ Dense solver for A*x=b with N*N real matrix A and N*1 real vectorx x and
676
+ b. This is "slow-but-feature rich" version of the linear solver. Faster
677
+ version is RMatrixSolveFast() function.
678
+
679
+ Algorithm features:
680
+ * automatic detection of degenerate cases
681
+ * condition number estimation
682
+ * iterative refinement
683
+ * O(N^3) complexity
684
+
685
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
686
+ ! by ALGLIB. It estimates condition number of linear system
687
+ ! and performs iterative refinement, which results in
688
+ ! significant performance penalty when compared with "fast"
689
+ ! version which just performs LU decomposition and calls
690
+ ! triangular solver.
691
+ !
692
+ ! This performance penalty is especially visible in the
693
+ ! multithreaded mode, because both condition number estimation
694
+ ! and iterative refinement are inherently sequential
695
+ ! calculations. It is also very significant on small matrices.
696
+ !
697
+ ! Thus, if you need high performance and if you are pretty sure
698
+ ! that your system is well conditioned, we strongly recommend
699
+ ! you to use faster solver, RMatrixSolveFast() function.
700
+
701
+ INPUT PARAMETERS
702
+ A - array[0..N-1,0..N-1], system matrix
703
+ N - size of A
704
+ B - array[0..N-1], right part
705
+
706
+ OUTPUT PARAMETERS
707
+ Rep - additional report, the following fields are set:
708
+ * rep.terminationtype >0 for success
709
+ -3 for badly conditioned matrix
710
+ * rep.r1 condition number in 1-norm
711
+ * rep.rinf condition number in inf-norm
712
+ X - array[N], it contains:
713
+ * rep.terminationtype>0 => solution
714
+ * rep.terminationtype=-3 => filled by zeros
715
+
716
+ ! FREE EDITION OF ALGLIB:
717
+ !
718
+ ! Free Edition of ALGLIB supports following important features for this
719
+ ! function:
720
+ ! * C++ version: x64 SIMD support using C++ intrinsics
721
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
722
+ !
723
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
724
+ ! Reference Manual in order to find out how to activate SIMD support
725
+ ! in ALGLIB.
726
+
727
+ ! COMMERCIAL EDITION OF ALGLIB:
728
+ !
729
+ ! Commercial Edition of ALGLIB includes following important improvements
730
+ ! of this function:
731
+ ! * high-performance native backend with same C# interface (C# version)
732
+ ! * multithreading support (C++ and C# versions)
733
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
734
+ ! (C++ and C# versions, x86/x64 platform)
735
+ !
736
+ ! We recommend you to read 'Working with commercial version' section of
737
+ ! ALGLIB Reference Manual in order to find out how to use performance-
738
+ ! related features provided by commercial edition of ALGLIB.
739
+
740
+ -- ALGLIB --
741
+ Copyright 27.01.2010 by Bochkanov Sergey
742
+ *************************************************************************/
743
+ void rmatrixsolve(const real_2d_array &a, const ae_int_t n, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
744
+ void rmatrixsolve(const real_2d_array &a, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
745
+
746
+
747
+ /*************************************************************************
748
+ Dense solver.
749
+
750
+ This subroutine solves a system A*x=b, where A is NxN non-denegerate
751
+ real matrix, x and b are vectors. This is a "fast" version of linear
752
+ solver which does NOT provide any additional functions like condition
753
+ number estimation or iterative refinement.
754
+
755
+ Algorithm features:
756
+ * efficient algorithm O(N^3) complexity
757
+ * no performance overhead from additional functionality
758
+
759
+ If you need condition number estimation or iterative refinement, use more
760
+ feature-rich version - RMatrixSolve().
761
+
762
+ INPUT PARAMETERS
763
+ A - array[0..N-1,0..N-1], system matrix
764
+ N - size of A
765
+ B - array[0..N-1], right part
766
+
767
+ OUTPUT PARAMETERS
768
+ B - array[N]:
769
+ * result=true => overwritten by solution
770
+ * result=false => filled by zeros
771
+
772
+ RETURNS:
773
+ True, if the system was solved
774
+ False, for an extremely badly conditioned or exactly singular system
775
+
776
+ ! FREE EDITION OF ALGLIB:
777
+ !
778
+ ! Free Edition of ALGLIB supports following important features for this
779
+ ! function:
780
+ ! * C++ version: x64 SIMD support using C++ intrinsics
781
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
782
+ !
783
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
784
+ ! Reference Manual in order to find out how to activate SIMD support
785
+ ! in ALGLIB.
786
+
787
+ ! COMMERCIAL EDITION OF ALGLIB:
788
+ !
789
+ ! Commercial Edition of ALGLIB includes following important improvements
790
+ ! of this function:
791
+ ! * high-performance native backend with same C# interface (C# version)
792
+ ! * multithreading support (C++ and C# versions)
793
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
794
+ ! (C++ and C# versions, x86/x64 platform)
795
+ !
796
+ ! We recommend you to read 'Working with commercial version' section of
797
+ ! ALGLIB Reference Manual in order to find out how to use performance-
798
+ ! related features provided by commercial edition of ALGLIB.
799
+
800
+ -- ALGLIB --
801
+ Copyright 16.03.2015 by Bochkanov Sergey
802
+ *************************************************************************/
803
+ bool rmatrixsolvefast(const real_2d_array &a, const ae_int_t n, real_1d_array &b, const xparams _xparams = alglib::xdefault);
804
+ bool rmatrixsolvefast(const real_2d_array &a, real_1d_array &b, const xparams _xparams = alglib::xdefault);
805
+
806
+
807
+ /*************************************************************************
808
+ Dense solver.
809
+
810
+ Similar to RMatrixSolve() but solves task with multiple right parts (where
811
+ b and x are NxM matrices). This is "slow-but-robust" version of linear
812
+ solver with additional functionality like condition number estimation.
813
+ There also exists faster version - RMatrixSolveMFast().
814
+
815
+ Algorithm features:
816
+ * automatic detection of degenerate cases
817
+ * condition number estimation
818
+ * optional iterative refinement
819
+ * O(N^3+M*N^2) complexity
820
+
821
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
822
+ ! by ALGLIB. It estimates condition number of linear system
823
+ ! and performs iterative refinement, which results in
824
+ ! significant performance penalty when compared with "fast"
825
+ ! version which just performs LU decomposition and calls
826
+ ! triangular solver.
827
+ !
828
+ ! This performance penalty is especially visible in the
829
+ ! multithreaded mode, because both condition number estimation
830
+ ! and iterative refinement are inherently sequential
831
+ ! calculations. It also very significant on small matrices.
832
+ !
833
+ ! Thus, if you need high performance and if you are pretty sure
834
+ ! that your system is well conditioned, we strongly recommend
835
+ ! you to use faster solver, RMatrixSolveMFast() function.
836
+
837
+ INPUT PARAMETERS
838
+ A - array[0..N-1,0..N-1], system matrix
839
+ N - size of A
840
+ B - array[0..N-1,0..M-1], right part
841
+ M - right part size
842
+ RFS - iterative refinement switch:
843
+ * True - refinement is used.
844
+ Less performance, more precision.
845
+ * False - refinement is not used.
846
+ More performance, less precision.
847
+
848
+ OUTPUT PARAMETERS
849
+ Rep - additional report, following fields are set:
850
+ * rep.terminationtype >0 for success
851
+ -3 for badly conditioned or exactly singular matrix
852
+ * rep.r1 condition number in 1-norm
853
+ * rep.rinf condition number in inf-norm
854
+ X - array[N], it contains:
855
+ * rep.terminationtype>0 => solution
856
+ * rep.terminationtype=-3 => filled by zeros
857
+
858
+ ! FREE EDITION OF ALGLIB:
859
+ !
860
+ ! Free Edition of ALGLIB supports following important features for this
861
+ ! function:
862
+ ! * C++ version: x64 SIMD support using C++ intrinsics
863
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
864
+ !
865
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
866
+ ! Reference Manual in order to find out how to activate SIMD support
867
+ ! in ALGLIB.
868
+
869
+ ! COMMERCIAL EDITION OF ALGLIB:
870
+ !
871
+ ! Commercial Edition of ALGLIB includes following important improvements
872
+ ! of this function:
873
+ ! * high-performance native backend with same C# interface (C# version)
874
+ ! * multithreading support (C++ and C# versions)
875
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
876
+ ! (C++ and C# versions, x86/x64 platform)
877
+ !
878
+ ! We recommend you to read 'Working with commercial version' section of
879
+ ! ALGLIB Reference Manual in order to find out how to use performance-
880
+ ! related features provided by commercial edition of ALGLIB.
881
+
882
+ -- ALGLIB --
883
+ Copyright 27.01.2010 by Bochkanov Sergey
884
+ *************************************************************************/
885
+ void rmatrixsolvem(const real_2d_array &a, const ae_int_t n, const real_2d_array &b, const ae_int_t m, const bool rfs, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
886
+ void rmatrixsolvem(const real_2d_array &a, const real_2d_array &b, const bool rfs, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
887
+
888
+
889
+ /*************************************************************************
890
+ Dense solver.
891
+
892
+ Similar to RMatrixSolve() but solves task with multiple right parts (where
893
+ b and x are NxM matrices). This is "fast" version of linear solver which
894
+ does NOT offer additional functions like condition number estimation or
895
+ iterative refinement.
896
+
897
+ Algorithm features:
898
+ * O(N^3+M*N^2) complexity
899
+ * no additional functionality, highest performance
900
+
901
+ INPUT PARAMETERS
902
+ A - array[0..N-1,0..N-1], system matrix
903
+ N - size of A
904
+ B - array[0..N-1,0..M-1], right part
905
+ M - right part size
906
+ RFS - iterative refinement switch:
907
+ * True - refinement is used.
908
+ Less performance, more precision.
909
+ * False - refinement is not used.
910
+ More performance, less precision.
911
+
912
+ OUTPUT PARAMETERS
913
+ Rep - additional report, following fields are set:
914
+ * rep.r1 condition number in 1-norm
915
+ * rep.rinf condition number in inf-norm
916
+ B - array[N]:
917
+ * result=true => overwritten by solution
918
+ * result=false => filled by zeros
919
+
920
+ RETURNS:
921
+ True for well-conditioned matrix
922
+ False for extremely badly conditioned or exactly singular problem
923
+
924
+ ! FREE EDITION OF ALGLIB:
925
+ !
926
+ ! Free Edition of ALGLIB supports following important features for this
927
+ ! function:
928
+ ! * C++ version: x64 SIMD support using C++ intrinsics
929
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
930
+ !
931
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
932
+ ! Reference Manual in order to find out how to activate SIMD support
933
+ ! in ALGLIB.
934
+
935
+ ! COMMERCIAL EDITION OF ALGLIB:
936
+ !
937
+ ! Commercial Edition of ALGLIB includes following important improvements
938
+ ! of this function:
939
+ ! * high-performance native backend with same C# interface (C# version)
940
+ ! * multithreading support (C++ and C# versions)
941
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
942
+ ! (C++ and C# versions, x86/x64 platform)
943
+ !
944
+ ! We recommend you to read 'Working with commercial version' section of
945
+ ! ALGLIB Reference Manual in order to find out how to use performance-
946
+ ! related features provided by commercial edition of ALGLIB.
947
+
948
+ -- ALGLIB --
949
+ Copyright 27.01.2010 by Bochkanov Sergey
950
+ *************************************************************************/
951
+ bool rmatrixsolvemfast(const real_2d_array &a, const ae_int_t n, real_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
952
+ bool rmatrixsolvemfast(const real_2d_array &a, real_2d_array &b, const xparams _xparams = alglib::xdefault);
953
+
954
+
955
+ /*************************************************************************
956
+ Dense solver.
957
+
958
+ This subroutine solves a system A*x=b, where A is NxN non-denegerate
959
+ real matrix given by its LU decomposition, x and b are real vectors. This
960
+ is "slow-but-robust" version of the linear LU-based solver. Faster version
961
+ is RMatrixLUSolveFast() function.
962
+
963
+ Algorithm features:
964
+ * automatic detection of degenerate cases
965
+ * O(N^2) complexity
966
+ * condition number estimation
967
+
968
+ No iterative refinement is provided because exact form of original matrix
969
+ is not known to subroutine. Use RMatrixSolve or RMatrixMixedSolve if you
970
+ need iterative refinement.
971
+
972
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
973
+ ! by ALGLIB. It estimates condition number of linear system,
974
+ ! which results in 10-15x performance penalty when compared
975
+ ! with "fast" version which just calls triangular solver.
976
+ !
977
+ ! This performance penalty is insignificant when compared with
978
+ ! cost of large LU decomposition. However, if you call this
979
+ ! function many times for the same left side, this overhead
980
+ ! BECOMES significant. It also becomes significant for small-
981
+ ! scale problems.
982
+ !
983
+ ! In such cases we strongly recommend you to use faster solver,
984
+ ! RMatrixLUSolveFast() function.
985
+
986
+ INPUT PARAMETERS
987
+ LUA - array[N,N], LU decomposition, RMatrixLU result
988
+ P - array[N], pivots array, RMatrixLU result
989
+ N - size of A
990
+ B - array[N], right part
991
+
992
+ OUTPUT PARAMETERS
993
+ Rep - additional report, the following fields are set:
994
+ * rep.terminationtype >0 for success
995
+ -3 for badly conditioned matrix
996
+ * rep.r1 condition number in 1-norm
997
+ * rep.rinf condition number in inf-norm
998
+ X - array[N], it contains:
999
+ * rep.terminationtype>0 => solution
1000
+ * rep.terminationtype=-3 => filled by zeros
1001
+
1002
+
1003
+ -- ALGLIB --
1004
+ Copyright 27.01.2010 by Bochkanov Sergey
1005
+ *************************************************************************/
1006
+ void rmatrixlusolve(const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1007
+ void rmatrixlusolve(const real_2d_array &lua, const integer_1d_array &p, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1008
+
1009
+
1010
+ /*************************************************************************
1011
+ Dense solver.
1012
+
1013
+ This subroutine solves a system A*x=b, where A is NxN non-denegerate
1014
+ real matrix given by its LU decomposition, x and b are real vectors. This
1015
+ is "fast-without-any-checks" version of the linear LU-based solver. Slower
1016
+ but more robust version is RMatrixLUSolve() function.
1017
+
1018
+ Algorithm features:
1019
+ * O(N^2) complexity
1020
+ * fast algorithm without ANY additional checks, just triangular solver
1021
+
1022
+ INPUT PARAMETERS
1023
+ LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1024
+ P - array[0..N-1], pivots array, RMatrixLU result
1025
+ N - size of A
1026
+ B - array[0..N-1], right part
1027
+
1028
+ OUTPUT PARAMETERS
1029
+ B - array[N]:
1030
+ * result=true => overwritten by solution
1031
+ * result=false => filled by zeros
1032
+
1033
+ RETURNS:
1034
+ True, if the system was solved
1035
+ False, for an extremely badly conditioned or exactly singular system
1036
+
1037
+
1038
+ -- ALGLIB --
1039
+ Copyright 18.03.2015 by Bochkanov Sergey
1040
+ *************************************************************************/
1041
+ bool rmatrixlusolvefast(const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, real_1d_array &b, const xparams _xparams = alglib::xdefault);
1042
+ bool rmatrixlusolvefast(const real_2d_array &lua, const integer_1d_array &p, real_1d_array &b, const xparams _xparams = alglib::xdefault);
1043
+
1044
+
1045
+ /*************************************************************************
1046
+ Dense solver.
1047
+
1048
+ Similar to RMatrixLUSolve() but solves task with multiple right parts
1049
+ (where b and x are NxM matrices). This is "robust-but-slow" version of
1050
+ LU-based solver which performs additional checks for non-degeneracy of
1051
+ inputs (condition number estimation). If you need best performance, use
1052
+ "fast-without-any-checks" version, RMatrixLUSolveMFast().
1053
+
1054
+ Algorithm features:
1055
+ * automatic detection of degenerate cases
1056
+ * O(M*N^2) complexity
1057
+ * condition number estimation
1058
+
1059
+ No iterative refinement is provided because exact form of original matrix
1060
+ is not known to subroutine. Use RMatrixSolve or RMatrixMixedSolve if you
1061
+ need iterative refinement.
1062
+
1063
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
1064
+ ! by ALGLIB. It estimates condition number of linear system,
1065
+ ! which results in significant performance penalty when
1066
+ ! compared with "fast" version which just calls triangular
1067
+ ! solver.
1068
+ !
1069
+ ! This performance penalty is especially apparent when you use
1070
+ ! ALGLIB parallel capabilities (condition number estimation is
1071
+ ! inherently sequential). It also becomes significant for
1072
+ ! small-scale problems.
1073
+ !
1074
+ ! In such cases we strongly recommend you to use faster solver,
1075
+ ! RMatrixLUSolveMFast() function.
1076
+
1077
+ INPUT PARAMETERS
1078
+ LUA - array[N,N], LU decomposition, RMatrixLU result
1079
+ P - array[N], pivots array, RMatrixLU result
1080
+ N - size of A
1081
+ B - array[0..N-1,0..M-1], right part
1082
+ M - right part size
1083
+
1084
+ OUTPUT PARAMETERS
1085
+ Rep - additional report, following fields are set:
1086
+ * rep.terminationtype >0 for success
1087
+ -3 for badly conditioned matrix
1088
+ * rep.r1 condition number in 1-norm
1089
+ * rep.rinf condition number in inf-norm
1090
+ X - array[N,M], it contains:
1091
+ * rep.terminationtype>0 => solution
1092
+ * rep.terminationtype=-3 => filled by zeros
1093
+
1094
+ ! FREE EDITION OF ALGLIB:
1095
+ !
1096
+ ! Free Edition of ALGLIB supports following important features for this
1097
+ ! function:
1098
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1099
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1100
+ !
1101
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1102
+ ! Reference Manual in order to find out how to activate SIMD support
1103
+ ! in ALGLIB.
1104
+
1105
+ ! COMMERCIAL EDITION OF ALGLIB:
1106
+ !
1107
+ ! Commercial Edition of ALGLIB includes following important improvements
1108
+ ! of this function:
1109
+ ! * high-performance native backend with same C# interface (C# version)
1110
+ ! * multithreading support (C++ and C# versions)
1111
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1112
+ ! (C++ and C# versions, x86/x64 platform)
1113
+ !
1114
+ ! We recommend you to read 'Working with commercial version' section of
1115
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1116
+ ! related features provided by commercial edition of ALGLIB.
1117
+
1118
+ -- ALGLIB --
1119
+ Copyright 27.01.2010 by Bochkanov Sergey
1120
+ *************************************************************************/
1121
+ void rmatrixlusolvem(const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const real_2d_array &b, const ae_int_t m, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1122
+ void rmatrixlusolvem(const real_2d_array &lua, const integer_1d_array &p, const real_2d_array &b, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1123
+
1124
+
1125
+ /*************************************************************************
1126
+ Dense solver.
1127
+
1128
+ Similar to RMatrixLUSolve() but solves task with multiple right parts,
1129
+ where b and x are NxM matrices. This is "fast-without-any-checks" version
1130
+ of LU-based solver. It does not estimate condition number of a system,
1131
+ so it is extremely fast. If you need better detection of near-degenerate
1132
+ cases, use RMatrixLUSolveM() function.
1133
+
1134
+ Algorithm features:
1135
+ * O(M*N^2) complexity
1136
+ * fast algorithm without ANY additional checks, just triangular solver
1137
+
1138
+ INPUT PARAMETERS:
1139
+ LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1140
+ P - array[0..N-1], pivots array, RMatrixLU result
1141
+ N - size of A
1142
+ B - array[0..N-1,0..M-1], right part
1143
+ M - right part size
1144
+
1145
+ OUTPUT PARAMETERS:
1146
+ B - array[N,M]:
1147
+ * result=true => overwritten by solution
1148
+ * result=false => filled by zeros
1149
+
1150
+ RETURNS:
1151
+ True, if the system was solved
1152
+ False, for an extremely badly conditioned or exactly singular system
1153
+
1154
+ ! FREE EDITION OF ALGLIB:
1155
+ !
1156
+ ! Free Edition of ALGLIB supports following important features for this
1157
+ ! function:
1158
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1159
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1160
+ !
1161
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1162
+ ! Reference Manual in order to find out how to activate SIMD support
1163
+ ! in ALGLIB.
1164
+
1165
+ ! COMMERCIAL EDITION OF ALGLIB:
1166
+ !
1167
+ ! Commercial Edition of ALGLIB includes following important improvements
1168
+ ! of this function:
1169
+ ! * high-performance native backend with same C# interface (C# version)
1170
+ ! * multithreading support (C++ and C# versions)
1171
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1172
+ ! (C++ and C# versions, x86/x64 platform)
1173
+ !
1174
+ ! We recommend you to read 'Working with commercial version' section of
1175
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1176
+ ! related features provided by commercial edition of ALGLIB.
1177
+
1178
+ -- ALGLIB --
1179
+ Copyright 18.03.2015 by Bochkanov Sergey
1180
+ *************************************************************************/
1181
+ bool rmatrixlusolvemfast(const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, real_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
1182
+ bool rmatrixlusolvemfast(const real_2d_array &lua, const integer_1d_array &p, real_2d_array &b, const xparams _xparams = alglib::xdefault);
1183
+
1184
+
1185
+ /*************************************************************************
1186
+ Dense solver.
1187
+
1188
+ This subroutine solves a system A*x=b, where BOTH ORIGINAL A AND ITS
1189
+ LU DECOMPOSITION ARE KNOWN. You can use it if for some reasons you have
1190
+ both A and its LU decomposition.
1191
+
1192
+ Algorithm features:
1193
+ * automatic detection of degenerate cases
1194
+ * condition number estimation
1195
+ * iterative refinement
1196
+ * O(N^2) complexity
1197
+
1198
+ INPUT PARAMETERS
1199
+ A - array[0..N-1,0..N-1], system matrix
1200
+ LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1201
+ P - array[0..N-1], pivots array, RMatrixLU result
1202
+ N - size of A
1203
+ B - array[0..N-1], right part
1204
+
1205
+ OUTPUT PARAMETERS
1206
+ Rep - additional report, following fields are set:
1207
+ * rep.terminationtype >0 for success
1208
+ -3 for badly conditioned matrix
1209
+ * rep.r1 condition number in 1-norm
1210
+ * rep.rinf condition number in inf-norm
1211
+ X - array[N], it contains:
1212
+ * rep.terminationtype>0 => solution
1213
+ * rep.terminationtype=-3 => filled by zeros
1214
+
1215
+ -- ALGLIB --
1216
+ Copyright 27.01.2010 by Bochkanov Sergey
1217
+ *************************************************************************/
1218
+ void rmatrixmixedsolve(const real_2d_array &a, const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1219
+ void rmatrixmixedsolve(const real_2d_array &a, const real_2d_array &lua, const integer_1d_array &p, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1220
+
1221
+
1222
+ /*************************************************************************
1223
+ Dense solver.
1224
+
1225
+ Similar to RMatrixMixedSolve() but solves task with multiple right parts
1226
+ (where b and x are NxM matrices).
1227
+
1228
+ Algorithm features:
1229
+ * automatic detection of degenerate cases
1230
+ * condition number estimation
1231
+ * iterative refinement
1232
+ * O(M*N^2) complexity
1233
+
1234
+ INPUT PARAMETERS
1235
+ A - array[0..N-1,0..N-1], system matrix
1236
+ LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1237
+ P - array[0..N-1], pivots array, RMatrixLU result
1238
+ N - size of A
1239
+ B - array[0..N-1,0..M-1], right part
1240
+ M - right part size
1241
+
1242
+ OUTPUT PARAMETERS
1243
+ Rep - additional report, following fields are set:
1244
+ * rep.terminationtype >0 for success
1245
+ -3 for badly conditioned matrix
1246
+ * rep.r1 condition number in 1-norm
1247
+ * rep.rinf condition number in inf-norm
1248
+ X - array[N,M], it contains:
1249
+ * rep.terminationtype>0 => solution
1250
+ * rep.terminationtype=-3 => filled by zeros
1251
+
1252
+ -- ALGLIB --
1253
+ Copyright 27.01.2010 by Bochkanov Sergey
1254
+ *************************************************************************/
1255
+ void rmatrixmixedsolvem(const real_2d_array &a, const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const real_2d_array &b, const ae_int_t m, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1256
+ void rmatrixmixedsolvem(const real_2d_array &a, const real_2d_array &lua, const integer_1d_array &p, const real_2d_array &b, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1257
+
1258
+
1259
+ /*************************************************************************
1260
+ Complex dense solver for A*X=B with N*N complex matrix A, N*M complex
1261
+ matrices X and B. "Slow-but-feature-rich" version which provides
1262
+ additional functions, at the cost of slower performance. Faster version
1263
+ may be invoked with CMatrixSolveMFast() function.
1264
+
1265
+ Algorithm features:
1266
+ * automatic detection of degenerate cases
1267
+ * condition number estimation
1268
+ * iterative refinement
1269
+ * O(N^3+M*N^2) complexity
1270
+
1271
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
1272
+ ! by ALGLIB. It estimates condition number of linear system
1273
+ ! and performs iterative refinement, which results in
1274
+ ! significant performance penalty when compared with "fast"
1275
+ ! version which just performs LU decomposition and calls
1276
+ ! triangular solver.
1277
+ !
1278
+ ! This performance penalty is especially visible in the
1279
+ ! multithreaded mode, because both condition number estimation
1280
+ ! and iterative refinement are inherently sequential
1281
+ ! calculations.
1282
+ !
1283
+ ! Thus, if you need high performance and if you are pretty sure
1284
+ ! that your system is well conditioned, we strongly recommend
1285
+ ! you to use faster solver, CMatrixSolveMFast() function.
1286
+
1287
+ INPUT PARAMETERS
1288
+ A - array[0..N-1,0..N-1], system matrix
1289
+ N - size of A
1290
+ B - array[0..N-1,0..M-1], right part
1291
+ M - right part size
1292
+ RFS - iterative refinement switch:
1293
+ * True - refinement is used.
1294
+ Less performance, more precision.
1295
+ * False - refinement is not used.
1296
+ More performance, less precision.
1297
+
1298
+ OUTPUT PARAMETERS
1299
+ Rep - additional report, following fields are set:
1300
+ * rep.terminationtype >0 for success
1301
+ -3 for badly conditioned or exactly singular matrix
1302
+ * rep.r1 condition number in 1-norm
1303
+ * rep.rinf condition number in inf-norm
1304
+ X - array[N,M], it contains:
1305
+ * rep.terminationtype>0 => solution
1306
+ * rep.terminationtype=-3 => filled by zeros
1307
+
1308
+ ! FREE EDITION OF ALGLIB:
1309
+ !
1310
+ ! Free Edition of ALGLIB supports following important features for this
1311
+ ! function:
1312
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1313
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1314
+ !
1315
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1316
+ ! Reference Manual in order to find out how to activate SIMD support
1317
+ ! in ALGLIB.
1318
+
1319
+ ! COMMERCIAL EDITION OF ALGLIB:
1320
+ !
1321
+ ! Commercial Edition of ALGLIB includes following important improvements
1322
+ ! of this function:
1323
+ ! * high-performance native backend with same C# interface (C# version)
1324
+ ! * multithreading support (C++ and C# versions)
1325
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1326
+ ! (C++ and C# versions, x86/x64 platform)
1327
+ !
1328
+ ! We recommend you to read 'Working with commercial version' section of
1329
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1330
+ ! related features provided by commercial edition of ALGLIB.
1331
+
1332
+ -- ALGLIB --
1333
+ Copyright 27.01.2010 by Bochkanov Sergey
1334
+ *************************************************************************/
1335
+ void cmatrixsolvem(const complex_2d_array &a, const ae_int_t n, const complex_2d_array &b, const ae_int_t m, const bool rfs, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1336
+ void cmatrixsolvem(const complex_2d_array &a, const complex_2d_array &b, const bool rfs, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1337
+
1338
+
1339
+ /*************************************************************************
1340
+ Complex dense solver for A*X=B with N*N complex matrix A, N*M complex
1341
+ matrices X and B. "Fast-but-lightweight" version which provides just
1342
+ triangular solver - and no additional functions like iterative refinement
1343
+ or condition number estimation.
1344
+
1345
+ Algorithm features:
1346
+ * O(N^3+M*N^2) complexity
1347
+ * no additional time consuming functions
1348
+
1349
+ INPUT PARAMETERS
1350
+ A - array[0..N-1,0..N-1], system matrix
1351
+ N - size of A
1352
+ B - array[0..N-1,0..M-1], right part
1353
+ M - right part size
1354
+
1355
+ OUTPUT PARAMETERS:
1356
+ B - array[N,M]:
1357
+ * result=true => overwritten by solution
1358
+ * result=false => filled by zeros
1359
+
1360
+ RETURNS:
1361
+ True, if the system was solved
1362
+ False, for an extremely badly conditioned or exactly singular system
1363
+
1364
+ ! FREE EDITION OF ALGLIB:
1365
+ !
1366
+ ! Free Edition of ALGLIB supports following important features for this
1367
+ ! function:
1368
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1369
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1370
+ !
1371
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1372
+ ! Reference Manual in order to find out how to activate SIMD support
1373
+ ! in ALGLIB.
1374
+
1375
+ ! COMMERCIAL EDITION OF ALGLIB:
1376
+ !
1377
+ ! Commercial Edition of ALGLIB includes following important improvements
1378
+ ! of this function:
1379
+ ! * high-performance native backend with same C# interface (C# version)
1380
+ ! * multithreading support (C++ and C# versions)
1381
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1382
+ ! (C++ and C# versions, x86/x64 platform)
1383
+ !
1384
+ ! We recommend you to read 'Working with commercial version' section of
1385
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1386
+ ! related features provided by commercial edition of ALGLIB.
1387
+
1388
+ -- ALGLIB --
1389
+ Copyright 16.03.2015 by Bochkanov Sergey
1390
+ *************************************************************************/
1391
+ bool cmatrixsolvemfast(const complex_2d_array &a, const ae_int_t n, complex_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
1392
+ bool cmatrixsolvemfast(const complex_2d_array &a, complex_2d_array &b, const xparams _xparams = alglib::xdefault);
1393
+
1394
+
1395
+ /*************************************************************************
1396
+ Complex dense solver for A*x=B with N*N complex matrix A and N*1 complex
1397
+ vectors x and b. "Slow-but-feature-rich" version of the solver.
1398
+
1399
+ Algorithm features:
1400
+ * automatic detection of degenerate cases
1401
+ * condition number estimation
1402
+ * iterative refinement
1403
+ * O(N^3) complexity
1404
+
1405
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
1406
+ ! by ALGLIB. It estimates condition number of linear system
1407
+ ! and performs iterative refinement, which results in
1408
+ ! significant performance penalty when compared with "fast"
1409
+ ! version which just performs LU decomposition and calls
1410
+ ! triangular solver.
1411
+ !
1412
+ ! This performance penalty is especially visible in the
1413
+ ! multithreaded mode, because both condition number estimation
1414
+ ! and iterative refinement are inherently sequential
1415
+ ! calculations.
1416
+ !
1417
+ ! Thus, if you need high performance and if you are pretty sure
1418
+ ! that your system is well conditioned, we strongly recommend
1419
+ ! you to use faster solver, CMatrixSolveFast() function.
1420
+
1421
+ INPUT PARAMETERS
1422
+ A - array[0..N-1,0..N-1], system matrix
1423
+ N - size of A
1424
+ B - array[0..N-1], right part
1425
+
1426
+ OUTPUT PARAMETERS
1427
+ Rep - additional report, following fields are set:
1428
+ * rep.terminationtype >0 for success
1429
+ -3 for badly conditioned or exactly singular matrix
1430
+ * rep.r1 condition number in 1-norm
1431
+ * rep.rinf condition number in inf-norm
1432
+ X - array[N], it contains:
1433
+ * rep.terminationtype>0 => solution
1434
+ * rep.terminationtype=-3 => filled by zeros
1435
+
1436
+ ! FREE EDITION OF ALGLIB:
1437
+ !
1438
+ ! Free Edition of ALGLIB supports following important features for this
1439
+ ! function:
1440
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1441
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1442
+ !
1443
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1444
+ ! Reference Manual in order to find out how to activate SIMD support
1445
+ ! in ALGLIB.
1446
+
1447
+ ! COMMERCIAL EDITION OF ALGLIB:
1448
+ !
1449
+ ! Commercial Edition of ALGLIB includes following important improvements
1450
+ ! of this function:
1451
+ ! * high-performance native backend with same C# interface (C# version)
1452
+ ! * multithreading support (C++ and C# versions)
1453
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1454
+ ! (C++ and C# versions, x86/x64 platform)
1455
+ !
1456
+ ! We recommend you to read 'Working with commercial version' section of
1457
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1458
+ ! related features provided by commercial edition of ALGLIB.
1459
+
1460
+ -- ALGLIB --
1461
+ Copyright 27.01.2010 by Bochkanov Sergey
1462
+ *************************************************************************/
1463
+ void cmatrixsolve(const complex_2d_array &a, const ae_int_t n, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1464
+ void cmatrixsolve(const complex_2d_array &a, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1465
+
1466
+
1467
+ /*************************************************************************
1468
+ Complex dense solver for A*x=B with N*N complex matrix A and N*1 complex
1469
+ vectors x and b. "Fast-but-lightweight" version of the solver.
1470
+
1471
+ Algorithm features:
1472
+ * O(N^3) complexity
1473
+ * no additional time consuming features, just triangular solver
1474
+
1475
+ INPUT PARAMETERS:
1476
+ A - array[0..N-1,0..N-1], system matrix
1477
+ N - size of A
1478
+ B - array[0..N-1], right part
1479
+
1480
+ OUTPUT PARAMETERS:
1481
+ B - array[N]:
1482
+ * result=true => overwritten by solution
1483
+ * result=false => filled by zeros
1484
+
1485
+ RETURNS:
1486
+ True, if the system was solved
1487
+ False, for an extremely badly conditioned or exactly singular system
1488
+
1489
+ ! FREE EDITION OF ALGLIB:
1490
+ !
1491
+ ! Free Edition of ALGLIB supports following important features for this
1492
+ ! function:
1493
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1494
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1495
+ !
1496
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1497
+ ! Reference Manual in order to find out how to activate SIMD support
1498
+ ! in ALGLIB.
1499
+
1500
+ ! COMMERCIAL EDITION OF ALGLIB:
1501
+ !
1502
+ ! Commercial Edition of ALGLIB includes following important improvements
1503
+ ! of this function:
1504
+ ! * high-performance native backend with same C# interface (C# version)
1505
+ ! * multithreading support (C++ and C# versions)
1506
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1507
+ ! (C++ and C# versions, x86/x64 platform)
1508
+ !
1509
+ ! We recommend you to read 'Working with commercial version' section of
1510
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1511
+ ! related features provided by commercial edition of ALGLIB.
1512
+
1513
+ -- ALGLIB --
1514
+ Copyright 27.01.2010 by Bochkanov Sergey
1515
+ *************************************************************************/
1516
+ bool cmatrixsolvefast(const complex_2d_array &a, const ae_int_t n, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
1517
+ bool cmatrixsolvefast(const complex_2d_array &a, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
1518
+
1519
+
1520
+ /*************************************************************************
1521
+ Dense solver for A*X=B with N*N complex A given by its LU decomposition,
1522
+ and N*M matrices X and B (multiple right sides). "Slow-but-feature-rich"
1523
+ version of the solver.
1524
+
1525
+ Algorithm features:
1526
+ * automatic detection of degenerate cases
1527
+ * O(M*N^2) complexity
1528
+ * condition number estimation
1529
+
1530
+ No iterative refinement is provided because exact form of original matrix
1531
+ is not known to subroutine. Use CMatrixSolve or CMatrixMixedSolve if you
1532
+ need iterative refinement.
1533
+
1534
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
1535
+ ! by ALGLIB. It estimates condition number of linear system,
1536
+ ! which results in significant performance penalty when
1537
+ ! compared with "fast" version which just calls triangular
1538
+ ! solver.
1539
+ !
1540
+ ! This performance penalty is especially apparent when you use
1541
+ ! ALGLIB parallel capabilities (condition number estimation is
1542
+ ! inherently sequential). It also becomes significant for
1543
+ ! small-scale problems.
1544
+ !
1545
+ ! In such cases we strongly recommend you to use faster solver,
1546
+ ! CMatrixLUSolveMFast() function.
1547
+
1548
+ INPUT PARAMETERS
1549
+ LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1550
+ P - array[0..N-1], pivots array, RMatrixLU result
1551
+ N - size of A
1552
+ B - array[0..N-1,0..M-1], right part
1553
+ M - right part size
1554
+
1555
+ OUTPUT PARAMETERS
1556
+ Rep - additional report, following fields are set:
1557
+ * rep.terminationtype >0 for success
1558
+ -3 for badly conditioned or exactly singular matrix
1559
+ * rep.r1 condition number in 1-norm
1560
+ * rep.rinf condition number in inf-norm
1561
+ X - array[N,M], it contains:
1562
+ * rep.terminationtype>0 => solution
1563
+ * rep.terminationtype=-3 => filled by zeros
1564
+
1565
+ ! FREE EDITION OF ALGLIB:
1566
+ !
1567
+ ! Free Edition of ALGLIB supports following important features for this
1568
+ ! function:
1569
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1570
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1571
+ !
1572
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1573
+ ! Reference Manual in order to find out how to activate SIMD support
1574
+ ! in ALGLIB.
1575
+
1576
+ ! COMMERCIAL EDITION OF ALGLIB:
1577
+ !
1578
+ ! Commercial Edition of ALGLIB includes following important improvements
1579
+ ! of this function:
1580
+ ! * high-performance native backend with same C# interface (C# version)
1581
+ ! * multithreading support (C++ and C# versions)
1582
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1583
+ ! (C++ and C# versions, x86/x64 platform)
1584
+ !
1585
+ ! We recommend you to read 'Working with commercial version' section of
1586
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1587
+ ! related features provided by commercial edition of ALGLIB.
1588
+
1589
+ -- ALGLIB --
1590
+ Copyright 27.01.2010 by Bochkanov Sergey
1591
+ *************************************************************************/
1592
+ void cmatrixlusolvem(const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const complex_2d_array &b, const ae_int_t m, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1593
+ void cmatrixlusolvem(const complex_2d_array &lua, const integer_1d_array &p, const complex_2d_array &b, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1594
+
1595
+
1596
+ /*************************************************************************
1597
+ Dense solver for A*X=B with N*N complex A given by its LU decomposition,
1598
+ and N*M matrices X and B (multiple right sides). "Fast-but-lightweight"
1599
+ version of the solver.
1600
+
1601
+ Algorithm features:
1602
+ * O(M*N^2) complexity
1603
+ * no additional time-consuming features
1604
+
1605
+ INPUT PARAMETERS
1606
+ LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1607
+ P - array[0..N-1], pivots array, RMatrixLU result
1608
+ N - size of A
1609
+ B - array[0..N-1,0..M-1], right part
1610
+ M - right part size
1611
+
1612
+ OUTPUT PARAMETERS
1613
+ B - array[N,M]:
1614
+ * result=true => overwritten by solution
1615
+ * result=false => filled by zeros
1616
+
1617
+ RETURNS:
1618
+ True, if the system was solved
1619
+ False, for an extremely badly conditioned or exactly singular system
1620
+
1621
+ ! FREE EDITION OF ALGLIB:
1622
+ !
1623
+ ! Free Edition of ALGLIB supports following important features for this
1624
+ ! function:
1625
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1626
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1627
+ !
1628
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1629
+ ! Reference Manual in order to find out how to activate SIMD support
1630
+ ! in ALGLIB.
1631
+
1632
+ ! COMMERCIAL EDITION OF ALGLIB:
1633
+ !
1634
+ ! Commercial Edition of ALGLIB includes following important improvements
1635
+ ! of this function:
1636
+ ! * high-performance native backend with same C# interface (C# version)
1637
+ ! * multithreading support (C++ and C# versions)
1638
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1639
+ ! (C++ and C# versions, x86/x64 platform)
1640
+ !
1641
+ ! We recommend you to read 'Working with commercial version' section of
1642
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1643
+ ! related features provided by commercial edition of ALGLIB.
1644
+
1645
+ -- ALGLIB --
1646
+ Copyright 27.01.2010 by Bochkanov Sergey
1647
+ *************************************************************************/
1648
+ bool cmatrixlusolvemfast(const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, complex_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
1649
+ bool cmatrixlusolvemfast(const complex_2d_array &lua, const integer_1d_array &p, complex_2d_array &b, const xparams _xparams = alglib::xdefault);
1650
+
1651
+
1652
+ /*************************************************************************
1653
+ Complex dense linear solver for A*x=b with complex N*N A given by its LU
1654
+ decomposition and N*1 vectors x and b. This is "slow-but-robust" version
1655
+ of the complex linear solver with additional features which add
1656
+ significant performance overhead. Faster version is CMatrixLUSolveFast()
1657
+ function.
1658
+
1659
+ Algorithm features:
1660
+ * automatic detection of degenerate cases
1661
+ * O(N^2) complexity
1662
+ * condition number estimation
1663
+
1664
+ No iterative refinement is provided because exact form of original matrix
1665
+ is not known to subroutine. Use CMatrixSolve or CMatrixMixedSolve if you
1666
+ need iterative refinement.
1667
+
1668
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
1669
+ ! by ALGLIB. It estimates condition number of linear system,
1670
+ ! which results in 10-15x performance penalty when compared
1671
+ ! with "fast" version which just calls triangular solver.
1672
+ !
1673
+ ! This performance penalty is insignificant when compared with
1674
+ ! cost of large LU decomposition. However, if you call this
1675
+ ! function many times for the same left side, this overhead
1676
+ ! BECOMES significant. It also becomes significant for small-
1677
+ ! scale problems.
1678
+ !
1679
+ ! In such cases we strongly recommend you to use faster solver,
1680
+ ! CMatrixLUSolveFast() function.
1681
+
1682
+ INPUT PARAMETERS
1683
+ LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1684
+ P - array[0..N-1], pivots array, CMatrixLU result
1685
+ N - size of A
1686
+ B - array[0..N-1], right part
1687
+
1688
+ OUTPUT PARAMETERS
1689
+ Rep - additional report, following fields are set:
1690
+ * rep.terminationtype >0 for success
1691
+ -3 for badly conditioned or exactly singular matrix
1692
+ * rep.r1 condition number in 1-norm
1693
+ * rep.rinf condition number in inf-norm
1694
+ X - array[N], it contains:
1695
+ * rep.terminationtype>0 => solution
1696
+ * rep.terminationtype=-3 => filled by zeros
1697
+
1698
+ -- ALGLIB --
1699
+ Copyright 27.01.2010 by Bochkanov Sergey
1700
+ *************************************************************************/
1701
+ void cmatrixlusolve(const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1702
+ void cmatrixlusolve(const complex_2d_array &lua, const integer_1d_array &p, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1703
+
1704
+
1705
+ /*************************************************************************
1706
+ Complex dense linear solver for A*x=b with N*N complex A given by its LU
1707
+ decomposition and N*1 vectors x and b. This is fast lightweight version
1708
+ of solver, which is significantly faster than CMatrixLUSolve(), but does
1709
+ not provide additional information (like condition numbers).
1710
+
1711
+ Algorithm features:
1712
+ * O(N^2) complexity
1713
+ * no additional time-consuming features, just triangular solver
1714
+
1715
+ INPUT PARAMETERS
1716
+ LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1717
+ P - array[0..N-1], pivots array, CMatrixLU result
1718
+ N - size of A
1719
+ B - array[0..N-1], right part
1720
+
1721
+ OUTPUT PARAMETERS
1722
+ B - array[N]:
1723
+ * result=true => overwritten by solution
1724
+ * result=false => filled by zeros
1725
+
1726
+ NOTE: unlike CMatrixLUSolve(), this function does NOT check for
1727
+ near-degeneracy of input matrix. It checks for EXACT degeneracy,
1728
+ because this check is easy to do. However, very badly conditioned
1729
+ matrices may went unnoticed.
1730
+
1731
+
1732
+ -- ALGLIB --
1733
+ Copyright 27.01.2010 by Bochkanov Sergey
1734
+ *************************************************************************/
1735
+ bool cmatrixlusolvefast(const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
1736
+ bool cmatrixlusolvefast(const complex_2d_array &lua, const integer_1d_array &p, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
1737
+
1738
+
1739
+ /*************************************************************************
1740
+ Dense solver. Same as RMatrixMixedSolveM(), but for complex matrices.
1741
+
1742
+ Algorithm features:
1743
+ * automatic detection of degenerate cases
1744
+ * condition number estimation
1745
+ * iterative refinement
1746
+ * O(M*N^2) complexity
1747
+
1748
+ INPUT PARAMETERS
1749
+ A - array[0..N-1,0..N-1], system matrix
1750
+ LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1751
+ P - array[0..N-1], pivots array, CMatrixLU result
1752
+ N - size of A
1753
+ B - array[0..N-1,0..M-1], right part
1754
+ M - right part size
1755
+
1756
+ OUTPUT PARAMETERS
1757
+ Rep - additional report, following fields are set:
1758
+ * rep.terminationtype >0 for success
1759
+ -3 for badly conditioned or exactly singular matrix
1760
+ * rep.r1 condition number in 1-norm
1761
+ * rep.rinf condition number in inf-norm
1762
+ X - array[N,M], it contains:
1763
+ * rep.terminationtype>0 => solution
1764
+ * rep.terminationtype=-3 => filled by zeros
1765
+
1766
+ -- ALGLIB --
1767
+ Copyright 27.01.2010 by Bochkanov Sergey
1768
+ *************************************************************************/
1769
+ void cmatrixmixedsolvem(const complex_2d_array &a, const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const complex_2d_array &b, const ae_int_t m, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1770
+ void cmatrixmixedsolvem(const complex_2d_array &a, const complex_2d_array &lua, const integer_1d_array &p, const complex_2d_array &b, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1771
+
1772
+
1773
+ /*************************************************************************
1774
+ Dense solver. Same as RMatrixMixedSolve(), but for complex matrices.
1775
+
1776
+ Algorithm features:
1777
+ * automatic detection of degenerate cases
1778
+ * condition number estimation
1779
+ * iterative refinement
1780
+ * O(N^2) complexity
1781
+
1782
+ INPUT PARAMETERS
1783
+ A - array[0..N-1,0..N-1], system matrix
1784
+ LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1785
+ P - array[0..N-1], pivots array, CMatrixLU result
1786
+ N - size of A
1787
+ B - array[0..N-1], right part
1788
+
1789
+ OUTPUT PARAMETERS
1790
+ Rep - additional report, following fields are set:
1791
+ * rep.terminationtype >0 for success
1792
+ -3 for badly conditioned or exactly singular matrix
1793
+ * rep.r1 condition number in 1-norm
1794
+ * rep.rinf condition number in inf-norm
1795
+ X - array[N], it contains:
1796
+ * rep.terminationtype>0 => solution
1797
+ * rep.terminationtype=-3 => filled by zeros
1798
+
1799
+ -- ALGLIB --
1800
+ Copyright 27.01.2010 by Bochkanov Sergey
1801
+ *************************************************************************/
1802
+ void cmatrixmixedsolve(const complex_2d_array &a, const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1803
+ void cmatrixmixedsolve(const complex_2d_array &a, const complex_2d_array &lua, const integer_1d_array &p, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1804
+
1805
+
1806
+ /*************************************************************************
1807
+ Dense solver for A*X=B with N*N symmetric positive definite matrix A, and
1808
+ N*M vectors X and B. It is "slow-but-feature-rich" version of the solver.
1809
+
1810
+ Algorithm features:
1811
+ * automatic detection of degenerate cases
1812
+ * condition number estimation
1813
+ * O(N^3+M*N^2) complexity
1814
+ * matrix is represented by its upper or lower triangle
1815
+
1816
+ No iterative refinement is provided because such partial representation of
1817
+ matrix does not allow efficient calculation of extra-precise matrix-vector
1818
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
1819
+ need iterative refinement.
1820
+
1821
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
1822
+ ! by ALGLIB. It estimates condition number of linear system,
1823
+ ! which results in significant performance penalty when
1824
+ ! compared with "fast" version which just performs Cholesky
1825
+ ! decomposition and calls triangular solver.
1826
+ !
1827
+ ! This performance penalty is especially visible in the
1828
+ ! multithreaded mode, because both condition number estimation
1829
+ ! and iterative refinement are inherently sequential
1830
+ ! calculations.
1831
+ !
1832
+ ! Thus, if you need high performance and if you are pretty sure
1833
+ ! that your system is well conditioned, we strongly recommend
1834
+ ! you to use faster solver, SPDMatrixSolveMFast() function.
1835
+
1836
+ INPUT PARAMETERS
1837
+ A - array[0..N-1,0..N-1], system matrix
1838
+ N - size of A
1839
+ IsUpper - what half of A is provided
1840
+ B - array[0..N-1,0..M-1], right part
1841
+ M - right part size
1842
+
1843
+ OUTPUT PARAMETERS
1844
+ Rep - additional report, following fields are set:
1845
+ * rep.terminationtype >0 for success
1846
+ -3 for badly conditioned or indefinite matrix
1847
+ * rep.r1 condition number in 1-norm
1848
+ * rep.rinf condition number in inf-norm
1849
+ X - array[N,M], it contains:
1850
+ * rep.terminationtype>0 => solution
1851
+ * rep.terminationtype=-3 => filled by zeros
1852
+
1853
+ ! FREE EDITION OF ALGLIB:
1854
+ !
1855
+ ! Free Edition of ALGLIB supports following important features for this
1856
+ ! function:
1857
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1858
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1859
+ !
1860
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1861
+ ! Reference Manual in order to find out how to activate SIMD support
1862
+ ! in ALGLIB.
1863
+
1864
+ ! COMMERCIAL EDITION OF ALGLIB:
1865
+ !
1866
+ ! Commercial Edition of ALGLIB includes following important improvements
1867
+ ! of this function:
1868
+ ! * high-performance native backend with same C# interface (C# version)
1869
+ ! * multithreading support (C++ and C# versions)
1870
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1871
+ ! (C++ and C# versions, x86/x64 platform)
1872
+ !
1873
+ ! We recommend you to read 'Working with commercial version' section of
1874
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1875
+ ! related features provided by commercial edition of ALGLIB.
1876
+
1877
+ -- ALGLIB --
1878
+ Copyright 27.01.2010 by Bochkanov Sergey
1879
+ *************************************************************************/
1880
+ void spdmatrixsolvem(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1881
+ void spdmatrixsolvem(const real_2d_array &a, const bool isupper, const real_2d_array &b, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
1882
+
1883
+
1884
+ /*************************************************************************
1885
+ Dense solver for A*X=B with N*N symmetric positive definite matrix A, and
1886
+ N*M vectors X and B. It is "fast-but-lightweight" version of the solver.
1887
+
1888
+ Algorithm features:
1889
+ * O(N^3+M*N^2) complexity
1890
+ * matrix is represented by its upper or lower triangle
1891
+ * no additional time consuming features
1892
+
1893
+ INPUT PARAMETERS
1894
+ A - array[0..N-1,0..N-1], system matrix
1895
+ N - size of A
1896
+ IsUpper - what half of A is provided
1897
+ B - array[0..N-1,0..M-1], right part
1898
+ M - right part size
1899
+
1900
+ OUTPUT PARAMETERS
1901
+ B - array[N,M], it contains:
1902
+ * result=true => overwritten by solution
1903
+ * result=false => filled by zeros
1904
+
1905
+ RETURNS:
1906
+ True, if the system was solved
1907
+ False, for an extremely badly conditioned or exactly singular system
1908
+
1909
+ ! FREE EDITION OF ALGLIB:
1910
+ !
1911
+ ! Free Edition of ALGLIB supports following important features for this
1912
+ ! function:
1913
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1914
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1915
+ !
1916
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1917
+ ! Reference Manual in order to find out how to activate SIMD support
1918
+ ! in ALGLIB.
1919
+
1920
+ ! COMMERCIAL EDITION OF ALGLIB:
1921
+ !
1922
+ ! Commercial Edition of ALGLIB includes following important improvements
1923
+ ! of this function:
1924
+ ! * high-performance native backend with same C# interface (C# version)
1925
+ ! * multithreading support (C++ and C# versions)
1926
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
1927
+ ! (C++ and C# versions, x86/x64 platform)
1928
+ !
1929
+ ! We recommend you to read 'Working with commercial version' section of
1930
+ ! ALGLIB Reference Manual in order to find out how to use performance-
1931
+ ! related features provided by commercial edition of ALGLIB.
1932
+
1933
+ -- ALGLIB --
1934
+ Copyright 17.03.2015 by Bochkanov Sergey
1935
+ *************************************************************************/
1936
+ bool spdmatrixsolvemfast(const real_2d_array &a, const ae_int_t n, const bool isupper, real_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
1937
+ bool spdmatrixsolvemfast(const real_2d_array &a, const bool isupper, real_2d_array &b, const xparams _xparams = alglib::xdefault);
1938
+
1939
+
1940
+ /*************************************************************************
1941
+ Dense linear solver for A*x=b with N*N real symmetric positive definite
1942
+ matrix A, N*1 vectors x and b. "Slow-but-feature-rich" version of the
1943
+ solver.
1944
+
1945
+ Algorithm features:
1946
+ * automatic detection of degenerate cases
1947
+ * condition number estimation
1948
+ * O(N^3) complexity
1949
+ * matrix is represented by its upper or lower triangle
1950
+
1951
+ No iterative refinement is provided because such partial representation of
1952
+ matrix does not allow efficient calculation of extra-precise matrix-vector
1953
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
1954
+ need iterative refinement.
1955
+
1956
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
1957
+ ! by ALGLIB. It estimates condition number of linear system,
1958
+ ! which results in significant performance penalty when
1959
+ ! compared with "fast" version which just performs Cholesky
1960
+ ! decomposition and calls triangular solver.
1961
+ !
1962
+ ! This performance penalty is especially visible in the
1963
+ ! multithreaded mode, because both condition number estimation
1964
+ ! and iterative refinement are inherently sequential
1965
+ ! calculations.
1966
+ !
1967
+ ! Thus, if you need high performance and if you are pretty sure
1968
+ ! that your system is well conditioned, we strongly recommend
1969
+ ! you to use faster solver, SPDMatrixSolveFast() function.
1970
+
1971
+ INPUT PARAMETERS
1972
+ A - array[0..N-1,0..N-1], system matrix
1973
+ N - size of A
1974
+ IsUpper - what half of A is provided
1975
+ B - array[0..N-1], right part
1976
+
1977
+ OUTPUT PARAMETERS
1978
+ Rep - additional report, following fields are set:
1979
+ * rep.terminationtype >0 for success
1980
+ -3 for badly conditioned or indefinite matrix
1981
+ * rep.r1 condition number in 1-norm
1982
+ * rep.rinf condition number in inf-norm
1983
+ X - array[N], it contains:
1984
+ * rep.terminationtype>0 => solution
1985
+ * rep.terminationtype=-3 => filled by zeros
1986
+
1987
+ ! FREE EDITION OF ALGLIB:
1988
+ !
1989
+ ! Free Edition of ALGLIB supports following important features for this
1990
+ ! function:
1991
+ ! * C++ version: x64 SIMD support using C++ intrinsics
1992
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
1993
+ !
1994
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
1995
+ ! Reference Manual in order to find out how to activate SIMD support
1996
+ ! in ALGLIB.
1997
+
1998
+ ! COMMERCIAL EDITION OF ALGLIB:
1999
+ !
2000
+ ! Commercial Edition of ALGLIB includes following important improvements
2001
+ ! of this function:
2002
+ ! * high-performance native backend with same C# interface (C# version)
2003
+ ! * multithreading support (C++ and C# versions)
2004
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
2005
+ ! (C++ and C# versions, x86/x64 platform)
2006
+ !
2007
+ ! We recommend you to read 'Working with commercial version' section of
2008
+ ! ALGLIB Reference Manual in order to find out how to use performance-
2009
+ ! related features provided by commercial edition of ALGLIB.
2010
+
2011
+ -- ALGLIB --
2012
+ Copyright 27.01.2010 by Bochkanov Sergey
2013
+ *************************************************************************/
2014
+ void spdmatrixsolve(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2015
+ void spdmatrixsolve(const real_2d_array &a, const bool isupper, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2016
+
2017
+
2018
+ /*************************************************************************
2019
+ Dense linear solver for A*x=b with N*N real symmetric positive definite
2020
+ matrix A, N*1 vectors x and b. "Fast-but-lightweight" version of the
2021
+ solver.
2022
+
2023
+ Algorithm features:
2024
+ * O(N^3) complexity
2025
+ * matrix is represented by its upper or lower triangle
2026
+ * no additional time consuming features like condition number estimation
2027
+
2028
+ INPUT PARAMETERS
2029
+ A - array[0..N-1,0..N-1], system matrix
2030
+ N - size of A
2031
+ IsUpper - what half of A is provided
2032
+ B - array[0..N-1], right part
2033
+
2034
+ OUTPUT PARAMETERS
2035
+ B - array[N], it contains:
2036
+ * result=true => overwritten by solution
2037
+ * result=false => filled by zeros
2038
+
2039
+ RETURNS:
2040
+ True, if the system was solved
2041
+ False, for an extremely badly conditioned or exactly singular system
2042
+
2043
+ ! FREE EDITION OF ALGLIB:
2044
+ !
2045
+ ! Free Edition of ALGLIB supports following important features for this
2046
+ ! function:
2047
+ ! * C++ version: x64 SIMD support using C++ intrinsics
2048
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
2049
+ !
2050
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
2051
+ ! Reference Manual in order to find out how to activate SIMD support
2052
+ ! in ALGLIB.
2053
+
2054
+ ! COMMERCIAL EDITION OF ALGLIB:
2055
+ !
2056
+ ! Commercial Edition of ALGLIB includes following important improvements
2057
+ ! of this function:
2058
+ ! * high-performance native backend with same C# interface (C# version)
2059
+ ! * multithreading support (C++ and C# versions)
2060
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
2061
+ ! (C++ and C# versions, x86/x64 platform)
2062
+ !
2063
+ ! We recommend you to read 'Working with commercial version' section of
2064
+ ! ALGLIB Reference Manual in order to find out how to use performance-
2065
+ ! related features provided by commercial edition of ALGLIB.
2066
+
2067
+ -- ALGLIB --
2068
+ Copyright 17.03.2015 by Bochkanov Sergey
2069
+ *************************************************************************/
2070
+ bool spdmatrixsolvefast(const real_2d_array &a, const ae_int_t n, const bool isupper, real_1d_array &b, const xparams _xparams = alglib::xdefault);
2071
+ bool spdmatrixsolvefast(const real_2d_array &a, const bool isupper, real_1d_array &b, const xparams _xparams = alglib::xdefault);
2072
+
2073
+
2074
+ /*************************************************************************
2075
+ Dense solver for A*X=B with N*N symmetric positive definite matrix A given
2076
+ by its Cholesky decomposition, and N*M vectors X and B. It is "slow-but-
2077
+ feature-rich" version of the solver which estimates condition number of
2078
+ the system.
2079
+
2080
+ Algorithm features:
2081
+ * automatic detection of degenerate cases
2082
+ * O(M*N^2) complexity
2083
+ * condition number estimation
2084
+ * matrix is represented by its upper or lower triangle
2085
+
2086
+ No iterative refinement is provided because such partial representation of
2087
+ matrix does not allow efficient calculation of extra-precise matrix-vector
2088
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2089
+ need iterative refinement.
2090
+
2091
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
2092
+ ! by ALGLIB. It estimates condition number of linear system,
2093
+ ! which results in significant performance penalty when
2094
+ ! compared with "fast" version which just calls triangular
2095
+ ! solver. Amount of overhead introduced depends on M (the
2096
+ ! larger - the more efficient).
2097
+ !
2098
+ ! This performance penalty is insignificant when compared with
2099
+ ! cost of large LU decomposition. However, if you call this
2100
+ ! function many times for the same left side, this overhead
2101
+ ! BECOMES significant. It also becomes significant for small-
2102
+ ! scale problems (N<50).
2103
+ !
2104
+ ! In such cases we strongly recommend you to use faster solver,
2105
+ ! SPDMatrixCholeskySolveMFast() function.
2106
+
2107
+ INPUT PARAMETERS
2108
+ CHA - array[0..N-1,0..N-1], Cholesky decomposition,
2109
+ SPDMatrixCholesky result
2110
+ N - size of CHA
2111
+ IsUpper - what half of CHA is provided
2112
+ B - array[0..N-1,0..M-1], right part
2113
+ M - right part size
2114
+
2115
+ OUTPUT PARAMETERS
2116
+ Rep - additional report, following fields are set:
2117
+ * rep.terminationtype >0 for success
2118
+ -3 for badly conditioned or indefinite matrix
2119
+ * rep.r1 condition number in 1-norm
2120
+ * rep.rinf condition number in inf-norm
2121
+ X - array[N]:
2122
+ * rep.terminationtype>0 => solution
2123
+ * rep.terminationtype=-3 => filled by zeros
2124
+
2125
+ -- ALGLIB --
2126
+ Copyright 27.01.2010 by Bochkanov Sergey
2127
+ *************************************************************************/
2128
+ void spdmatrixcholeskysolvem(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2129
+ void spdmatrixcholeskysolvem(const real_2d_array &cha, const bool isupper, const real_2d_array &b, real_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2130
+
2131
+
2132
+ /*************************************************************************
2133
+ Dense solver for A*X=B with N*N symmetric positive definite matrix A given
2134
+ by its Cholesky decomposition, and N*M vectors X and B. It is "fast-but-
2135
+ lightweight" version of the solver which just solves linear system,
2136
+ without any additional functions.
2137
+
2138
+ Algorithm features:
2139
+ * O(M*N^2) complexity
2140
+ * matrix is represented by its upper or lower triangle
2141
+ * no additional functionality
2142
+
2143
+ INPUT PARAMETERS
2144
+ CHA - array[N,N], Cholesky decomposition,
2145
+ SPDMatrixCholesky result
2146
+ N - size of CHA
2147
+ IsUpper - what half of CHA is provided
2148
+ B - array[N,M], right part
2149
+ M - right part size
2150
+
2151
+ OUTPUT PARAMETERS
2152
+ B - array[N]:
2153
+ * result=true => overwritten by solution
2154
+ * result=false => filled by zeros
2155
+
2156
+ RETURNS:
2157
+ True, if the system was solved
2158
+ False, for an extremely badly conditioned or exactly singular system
2159
+
2160
+ -- ALGLIB --
2161
+ Copyright 18.03.2015 by Bochkanov Sergey
2162
+ *************************************************************************/
2163
+ bool spdmatrixcholeskysolvemfast(const real_2d_array &cha, const ae_int_t n, const bool isupper, real_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
2164
+ bool spdmatrixcholeskysolvemfast(const real_2d_array &cha, const bool isupper, real_2d_array &b, const xparams _xparams = alglib::xdefault);
2165
+
2166
+
2167
+ /*************************************************************************
2168
+ Dense solver for A*x=b with N*N symmetric positive definite matrix A given
2169
+ by its Cholesky decomposition, and N*1 real vectors x and b. This is "slow-
2170
+ but-feature-rich" version of the solver which, in addition to the
2171
+ solution, performs condition number estimation.
2172
+
2173
+ Algorithm features:
2174
+ * automatic detection of degenerate cases
2175
+ * O(N^2) complexity
2176
+ * condition number estimation
2177
+ * matrix is represented by its upper or lower triangle
2178
+
2179
+ No iterative refinement is provided because such partial representation of
2180
+ matrix does not allow efficient calculation of extra-precise matrix-vector
2181
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2182
+ need iterative refinement.
2183
+
2184
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
2185
+ ! by ALGLIB. It estimates condition number of linear system,
2186
+ ! which results in 10-15x performance penalty when compared
2187
+ ! with "fast" version which just calls triangular solver.
2188
+ !
2189
+ ! This performance penalty is insignificant when compared with
2190
+ ! cost of large LU decomposition. However, if you call this
2191
+ ! function many times for the same left side, this overhead
2192
+ ! BECOMES significant. It also becomes significant for small-
2193
+ ! scale problems (N<50).
2194
+ !
2195
+ ! In such cases we strongly recommend you to use faster solver,
2196
+ ! SPDMatrixCholeskySolveFast() function.
2197
+
2198
+ INPUT PARAMETERS
2199
+ CHA - array[N,N], Cholesky decomposition,
2200
+ SPDMatrixCholesky result
2201
+ N - size of A
2202
+ IsUpper - what half of CHA is provided
2203
+ B - array[N], right part
2204
+
2205
+ OUTPUT PARAMETERS
2206
+ Rep - additional report, following fields are set:
2207
+ * rep.terminationtype >0 for success
2208
+ -3 for badly conditioned or indefinite matrix
2209
+ * rep.r1 condition number in 1-norm
2210
+ * rep.rinf condition number in inf-norm
2211
+ X - array[N]:
2212
+ * rep.terminationtype>0 => solution
2213
+ * rep.terminationtype=-3 => filled by zeros
2214
+
2215
+ -- ALGLIB --
2216
+ Copyright 27.01.2010 by Bochkanov Sergey
2217
+ *************************************************************************/
2218
+ void spdmatrixcholeskysolve(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2219
+ void spdmatrixcholeskysolve(const real_2d_array &cha, const bool isupper, const real_1d_array &b, real_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2220
+
2221
+
2222
+ /*************************************************************************
2223
+ Dense solver for A*x=b with N*N symmetric positive definite matrix A given
2224
+ by its Cholesky decomposition, and N*1 real vectors x and b. This is "fast-
2225
+ but-lightweight" version of the solver.
2226
+
2227
+ Algorithm features:
2228
+ * O(N^2) complexity
2229
+ * matrix is represented by its upper or lower triangle
2230
+ * no additional features
2231
+
2232
+ INPUT PARAMETERS
2233
+ CHA - array[N,N], Cholesky decomposition,
2234
+ SPDMatrixCholesky result
2235
+ N - size of A
2236
+ IsUpper - what half of CHA is provided
2237
+ B - array[N], right part
2238
+
2239
+ OUTPUT PARAMETERS
2240
+ B - array[N]:
2241
+ * result=true => overwritten by solution
2242
+ * result=false => filled by zeros
2243
+
2244
+ RETURNS:
2245
+ True, if the system was solved
2246
+ False, for an extremely badly conditioned or exactly singular system
2247
+
2248
+ -- ALGLIB --
2249
+ Copyright 27.01.2010 by Bochkanov Sergey
2250
+ *************************************************************************/
2251
+ bool spdmatrixcholeskysolvefast(const real_2d_array &cha, const ae_int_t n, const bool isupper, real_1d_array &b, const xparams _xparams = alglib::xdefault);
2252
+ bool spdmatrixcholeskysolvefast(const real_2d_array &cha, const bool isupper, real_1d_array &b, const xparams _xparams = alglib::xdefault);
2253
+
2254
+
2255
+ /*************************************************************************
2256
+ Dense solver for A*X=B, with N*N Hermitian positive definite matrix A and
2257
+ N*M complex matrices X and B. "Slow-but-feature-rich" version of the
2258
+ solver.
2259
+
2260
+ Algorithm features:
2261
+ * automatic detection of degenerate cases
2262
+ * condition number estimation
2263
+ * O(N^3+M*N^2) complexity
2264
+ * matrix is represented by its upper or lower triangle
2265
+
2266
+ No iterative refinement is provided because such partial representation of
2267
+ matrix does not allow efficient calculation of extra-precise matrix-vector
2268
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2269
+ need iterative refinement.
2270
+
2271
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
2272
+ ! by ALGLIB. It estimates condition number of linear system,
2273
+ ! which results in significant performance penalty when
2274
+ ! compared with "fast" version which just calls triangular
2275
+ ! solver.
2276
+ !
2277
+ ! This performance penalty is especially apparent when you use
2278
+ ! ALGLIB parallel capabilities (condition number estimation is
2279
+ ! inherently sequential). It also becomes significant for
2280
+ ! small-scale problems (N<100).
2281
+ !
2282
+ ! In such cases we strongly recommend you to use faster solver,
2283
+ ! HPDMatrixSolveMFast() function.
2284
+
2285
+ INPUT PARAMETERS
2286
+ A - array[0..N-1,0..N-1], system matrix
2287
+ N - size of A
2288
+ IsUpper - what half of A is provided
2289
+ B - array[0..N-1,0..M-1], right part
2290
+ M - right part size
2291
+
2292
+ OUTPUT PARAMETERS
2293
+ Rep - same as in RMatrixSolve
2294
+ X - same as in RMatrixSolve
2295
+
2296
+ ! FREE EDITION OF ALGLIB:
2297
+ !
2298
+ ! Free Edition of ALGLIB supports following important features for this
2299
+ ! function:
2300
+ ! * C++ version: x64 SIMD support using C++ intrinsics
2301
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
2302
+ !
2303
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
2304
+ ! Reference Manual in order to find out how to activate SIMD support
2305
+ ! in ALGLIB.
2306
+
2307
+ ! COMMERCIAL EDITION OF ALGLIB:
2308
+ !
2309
+ ! Commercial Edition of ALGLIB includes following important improvements
2310
+ ! of this function:
2311
+ ! * high-performance native backend with same C# interface (C# version)
2312
+ ! * multithreading support (C++ and C# versions)
2313
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
2314
+ ! (C++ and C# versions, x86/x64 platform)
2315
+ !
2316
+ ! We recommend you to read 'Working with commercial version' section of
2317
+ ! ALGLIB Reference Manual in order to find out how to use performance-
2318
+ ! related features provided by commercial edition of ALGLIB.
2319
+
2320
+ -- ALGLIB --
2321
+ Copyright 27.01.2010 by Bochkanov Sergey
2322
+ *************************************************************************/
2323
+ void hpdmatrixsolvem(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2324
+ void hpdmatrixsolvem(const complex_2d_array &a, const bool isupper, const complex_2d_array &b, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2325
+
2326
+
2327
+ /*************************************************************************
2328
+ Dense solver for A*X=B, with N*N Hermitian positive definite matrix A and
2329
+ N*M complex matrices X and B. "Fast-but-lightweight" version of the solver.
2330
+
2331
+ Algorithm features:
2332
+ * O(N^3+M*N^2) complexity
2333
+ * matrix is represented by its upper or lower triangle
2334
+ * no additional time consuming features like condition number estimation
2335
+
2336
+ INPUT PARAMETERS
2337
+ A - array[0..N-1,0..N-1], system matrix
2338
+ N - size of A
2339
+ IsUpper - what half of A is provided
2340
+ B - array[0..N-1,0..M-1], right part
2341
+ M - right part size
2342
+
2343
+ OUTPUT PARAMETERS
2344
+ B - array[0..N-1]:
2345
+ * result=true => overwritten by solution
2346
+ * result=false => filled by zeros
2347
+
2348
+ RETURNS:
2349
+ True, if the system was solved
2350
+ False, for an extremely badly conditioned or indefinite system
2351
+
2352
+ ! FREE EDITION OF ALGLIB:
2353
+ !
2354
+ ! Free Edition of ALGLIB supports following important features for this
2355
+ ! function:
2356
+ ! * C++ version: x64 SIMD support using C++ intrinsics
2357
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
2358
+ !
2359
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
2360
+ ! Reference Manual in order to find out how to activate SIMD support
2361
+ ! in ALGLIB.
2362
+
2363
+ ! COMMERCIAL EDITION OF ALGLIB:
2364
+ !
2365
+ ! Commercial Edition of ALGLIB includes following important improvements
2366
+ ! of this function:
2367
+ ! * high-performance native backend with same C# interface (C# version)
2368
+ ! * multithreading support (C++ and C# versions)
2369
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
2370
+ ! (C++ and C# versions, x86/x64 platform)
2371
+ !
2372
+ ! We recommend you to read 'Working with commercial version' section of
2373
+ ! ALGLIB Reference Manual in order to find out how to use performance-
2374
+ ! related features provided by commercial edition of ALGLIB.
2375
+
2376
+ -- ALGLIB --
2377
+ Copyright 17.03.2015 by Bochkanov Sergey
2378
+ *************************************************************************/
2379
+ bool hpdmatrixsolvemfast(const complex_2d_array &a, const ae_int_t n, const bool isupper, complex_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
2380
+ bool hpdmatrixsolvemfast(const complex_2d_array &a, const bool isupper, complex_2d_array &b, const xparams _xparams = alglib::xdefault);
2381
+
2382
+
2383
+ /*************************************************************************
2384
+ Dense solver for A*x=b, with N*N Hermitian positive definite matrix A, and
2385
+ N*1 complex vectors x and b. "Slow-but-feature-rich" version of the
2386
+ solver.
2387
+
2388
+ Algorithm features:
2389
+ * automatic detection of degenerate cases
2390
+ * condition number estimation
2391
+ * O(N^3) complexity
2392
+ * matrix is represented by its upper or lower triangle
2393
+
2394
+ No iterative refinement is provided because such partial representation of
2395
+ matrix does not allow efficient calculation of extra-precise matrix-vector
2396
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2397
+ need iterative refinement.
2398
+
2399
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
2400
+ ! by ALGLIB. It estimates condition number of linear system,
2401
+ ! which results in significant performance penalty when
2402
+ ! compared with "fast" version which just performs Cholesky
2403
+ ! decomposition and calls triangular solver.
2404
+ !
2405
+ ! This performance penalty is especially visible in the
2406
+ ! multithreaded mode, because both condition number estimation
2407
+ ! and iterative refinement are inherently sequential
2408
+ ! calculations.
2409
+ !
2410
+ ! Thus, if you need high performance and if you are pretty sure
2411
+ ! that your system is well conditioned, we strongly recommend
2412
+ ! you to use faster solver, HPDMatrixSolveFast() function.
2413
+
2414
+ INPUT PARAMETERS
2415
+ A - array[0..N-1,0..N-1], system matrix
2416
+ N - size of A
2417
+ IsUpper - what half of A is provided
2418
+ B - array[0..N-1], right part
2419
+
2420
+ OUTPUT PARAMETERS
2421
+ Rep - same as in RMatrixSolve
2422
+ X - same as in RMatrixSolve
2423
+
2424
+ ! FREE EDITION OF ALGLIB:
2425
+ !
2426
+ ! Free Edition of ALGLIB supports following important features for this
2427
+ ! function:
2428
+ ! * C++ version: x64 SIMD support using C++ intrinsics
2429
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
2430
+ !
2431
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
2432
+ ! Reference Manual in order to find out how to activate SIMD support
2433
+ ! in ALGLIB.
2434
+
2435
+ ! COMMERCIAL EDITION OF ALGLIB:
2436
+ !
2437
+ ! Commercial Edition of ALGLIB includes following important improvements
2438
+ ! of this function:
2439
+ ! * high-performance native backend with same C# interface (C# version)
2440
+ ! * multithreading support (C++ and C# versions)
2441
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
2442
+ ! (C++ and C# versions, x86/x64 platform)
2443
+ !
2444
+ ! We recommend you to read 'Working with commercial version' section of
2445
+ ! ALGLIB Reference Manual in order to find out how to use performance-
2446
+ ! related features provided by commercial edition of ALGLIB.
2447
+
2448
+ -- ALGLIB --
2449
+ Copyright 27.01.2010 by Bochkanov Sergey
2450
+ *************************************************************************/
2451
+ void hpdmatrixsolve(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2452
+ void hpdmatrixsolve(const complex_2d_array &a, const bool isupper, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2453
+
2454
+
2455
+ /*************************************************************************
2456
+ Dense solver for A*x=b, with N*N Hermitian positive definite matrix A, and
2457
+ N*1 complex vectors x and b. "Fast-but-lightweight" version of the
2458
+ solver without additional functions.
2459
+
2460
+ Algorithm features:
2461
+ * O(N^3) complexity
2462
+ * matrix is represented by its upper or lower triangle
2463
+ * no additional time consuming functions
2464
+
2465
+ INPUT PARAMETERS
2466
+ A - array[0..N-1,0..N-1], system matrix
2467
+ N - size of A
2468
+ IsUpper - what half of A is provided
2469
+ B - array[0..N-1], right part
2470
+
2471
+ OUTPUT PARAMETERS
2472
+ B - array[0..N-1]:
2473
+ * result=true => overwritten by solution
2474
+ * result=false => filled by zeros
2475
+
2476
+ RETURNS:
2477
+ True, if the system was solved
2478
+ False, for an extremely badly conditioned or indefinite system
2479
+
2480
+ ! FREE EDITION OF ALGLIB:
2481
+ !
2482
+ ! Free Edition of ALGLIB supports following important features for this
2483
+ ! function:
2484
+ ! * C++ version: x64 SIMD support using C++ intrinsics
2485
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
2486
+ !
2487
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
2488
+ ! Reference Manual in order to find out how to activate SIMD support
2489
+ ! in ALGLIB.
2490
+
2491
+ ! COMMERCIAL EDITION OF ALGLIB:
2492
+ !
2493
+ ! Commercial Edition of ALGLIB includes following important improvements
2494
+ ! of this function:
2495
+ ! * high-performance native backend with same C# interface (C# version)
2496
+ ! * multithreading support (C++ and C# versions)
2497
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
2498
+ ! (C++ and C# versions, x86/x64 platform)
2499
+ !
2500
+ ! We recommend you to read 'Working with commercial version' section of
2501
+ ! ALGLIB Reference Manual in order to find out how to use performance-
2502
+ ! related features provided by commercial edition of ALGLIB.
2503
+
2504
+ -- ALGLIB --
2505
+ Copyright 17.03.2015 by Bochkanov Sergey
2506
+ *************************************************************************/
2507
+ bool hpdmatrixsolvefast(const complex_2d_array &a, const ae_int_t n, const bool isupper, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
2508
+ bool hpdmatrixsolvefast(const complex_2d_array &a, const bool isupper, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
2509
+
2510
+
2511
+ /*************************************************************************
2512
+ Dense solver for A*X=B with N*N Hermitian positive definite matrix A given
2513
+ by its Cholesky decomposition and N*M complex matrices X and B. This is
2514
+ "slow-but-feature-rich" version of the solver which, in addition to the
2515
+ solution, estimates condition number of the system.
2516
+
2517
+ Algorithm features:
2518
+ * automatic detection of degenerate cases
2519
+ * O(M*N^2) complexity
2520
+ * condition number estimation
2521
+ * matrix is represented by its upper or lower triangle
2522
+
2523
+ No iterative refinement is provided because such partial representation of
2524
+ matrix does not allow efficient calculation of extra-precise matrix-vector
2525
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2526
+ need iterative refinement.
2527
+
2528
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
2529
+ ! by ALGLIB. It estimates condition number of linear system,
2530
+ ! which results in significant performance penalty when
2531
+ ! compared with "fast" version which just calls triangular
2532
+ ! solver. Amount of overhead introduced depends on M (the
2533
+ ! larger - the more efficient).
2534
+ !
2535
+ ! This performance penalty is insignificant when compared with
2536
+ ! cost of large Cholesky decomposition. However, if you call
2537
+ ! this function many times for the same left side, this
2538
+ ! overhead BECOMES significant. It also becomes significant
2539
+ ! for small-scale problems (N<50).
2540
+ !
2541
+ ! In such cases we strongly recommend you to use faster solver,
2542
+ ! HPDMatrixCholeskySolveMFast() function.
2543
+
2544
+
2545
+ INPUT PARAMETERS
2546
+ CHA - array[N,N], Cholesky decomposition,
2547
+ HPDMatrixCholesky result
2548
+ N - size of CHA
2549
+ IsUpper - what half of CHA is provided
2550
+ B - array[N,M], right part
2551
+ M - right part size
2552
+
2553
+ OUTPUT PARAMETERS:
2554
+ Rep - additional report, following fields are set:
2555
+ * rep.terminationtype >0 for success
2556
+ -3 for badly conditioned or indefinite matrix
2557
+ * rep.r1 condition number in 1-norm
2558
+ * rep.rinf condition number in inf-norm
2559
+ X - array[N], it contains:
2560
+ * rep.terminationtype>0 => solution
2561
+ * rep.terminationtype=-3 => filled by zeros
2562
+
2563
+ -- ALGLIB --
2564
+ Copyright 27.01.2010 by Bochkanov Sergey
2565
+ *************************************************************************/
2566
+ void hpdmatrixcholeskysolvem(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2567
+ void hpdmatrixcholeskysolvem(const complex_2d_array &cha, const bool isupper, const complex_2d_array &b, complex_2d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2568
+
2569
+
2570
+ /*************************************************************************
2571
+ Dense solver for A*X=B with N*N Hermitian positive definite matrix A given
2572
+ by its Cholesky decomposition and N*M complex matrices X and B. This is
2573
+ "fast-but-lightweight" version of the solver.
2574
+
2575
+ Algorithm features:
2576
+ * O(M*N^2) complexity
2577
+ * matrix is represented by its upper or lower triangle
2578
+ * no additional time-consuming features
2579
+
2580
+ INPUT PARAMETERS
2581
+ CHA - array[N,N], Cholesky decomposition,
2582
+ HPDMatrixCholesky result
2583
+ N - size of CHA
2584
+ IsUpper - what half of CHA is provided
2585
+ B - array[N,M], right part
2586
+ M - right part size
2587
+
2588
+ OUTPUT PARAMETERS:
2589
+ B - array[N]:
2590
+ * result=true => overwritten by solution
2591
+ * result=false => filled by zeros
2592
+
2593
+ RETURNS:
2594
+ True, if the system was solved
2595
+ False, for an extremely badly conditioned or indefinite system
2596
+
2597
+ -- ALGLIB --
2598
+ Copyright 18.03.2015 by Bochkanov Sergey
2599
+ *************************************************************************/
2600
+ bool hpdmatrixcholeskysolvemfast(const complex_2d_array &cha, const ae_int_t n, const bool isupper, complex_2d_array &b, const ae_int_t m, const xparams _xparams = alglib::xdefault);
2601
+ bool hpdmatrixcholeskysolvemfast(const complex_2d_array &cha, const bool isupper, complex_2d_array &b, const xparams _xparams = alglib::xdefault);
2602
+
2603
+
2604
+ /*************************************************************************
2605
+ Dense solver for A*x=b with N*N Hermitian positive definite matrix A given
2606
+ by its Cholesky decomposition, and N*1 complex vectors x and b. This is
2607
+ "slow-but-feature-rich" version of the solver which estimates condition
2608
+ number of the system.
2609
+
2610
+ Algorithm features:
2611
+ * automatic detection of degenerate cases
2612
+ * O(N^2) complexity
2613
+ * condition number estimation
2614
+ * matrix is represented by its upper or lower triangle
2615
+
2616
+ No iterative refinement is provided because such partial representation of
2617
+ matrix does not allow efficient calculation of extra-precise matrix-vector
2618
+ products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2619
+ need iterative refinement.
2620
+
2621
+ IMPORTANT: ! this function is NOT the most efficient linear solver provided
2622
+ ! by ALGLIB. It estimates condition number of linear system,
2623
+ ! which results in 10-15x performance penalty when compared
2624
+ ! with "fast" version which just calls triangular solver.
2625
+ !
2626
+ ! This performance penalty is insignificant when compared with
2627
+ ! cost of large LU decomposition. However, if you call this
2628
+ ! function many times for the same left side, this overhead
2629
+ ! BECOMES significant. It also becomes significant for small-
2630
+ ! scale problems (N<50).
2631
+ !
2632
+ ! In such cases we strongly recommend you to use faster solver,
2633
+ ! HPDMatrixCholeskySolveFast() function.
2634
+
2635
+ INPUT PARAMETERS
2636
+ CHA - array[0..N-1,0..N-1], Cholesky decomposition,
2637
+ SPDMatrixCholesky result
2638
+ N - size of A
2639
+ IsUpper - what half of CHA is provided
2640
+ B - array[0..N-1], right part
2641
+
2642
+ OUTPUT PARAMETERS
2643
+ Rep - additional report, following fields are set:
2644
+ * rep.terminationtype >0 for success
2645
+ -3 for badly conditioned or indefinite matrix
2646
+ * rep.r1 condition number in 1-norm
2647
+ * rep.rinf condition number in inf-norm
2648
+ X - array[N], it contains:
2649
+ * rep.terminationtype>0 => solution
2650
+ * rep.terminationtype=-3 => filled by zeros
2651
+
2652
+ -- ALGLIB --
2653
+ Copyright 27.01.2010 by Bochkanov Sergey
2654
+ *************************************************************************/
2655
+ void hpdmatrixcholeskysolve(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2656
+ void hpdmatrixcholeskysolve(const complex_2d_array &cha, const bool isupper, const complex_1d_array &b, complex_1d_array &x, densesolverreport &rep, const xparams _xparams = alglib::xdefault);
2657
+
2658
+
2659
+ /*************************************************************************
2660
+ Dense solver for A*x=b with N*N Hermitian positive definite matrix A given
2661
+ by its Cholesky decomposition, and N*1 complex vectors x and b. This is
2662
+ "fast-but-lightweight" version of the solver.
2663
+
2664
+ Algorithm features:
2665
+ * O(N^2) complexity
2666
+ * matrix is represented by its upper or lower triangle
2667
+ * no additional time-consuming features
2668
+
2669
+ INPUT PARAMETERS
2670
+ CHA - array[0..N-1,0..N-1], Cholesky decomposition,
2671
+ SPDMatrixCholesky result
2672
+ N - size of A
2673
+ IsUpper - what half of CHA is provided
2674
+ B - array[0..N-1], right part
2675
+
2676
+ OUTPUT PARAMETERS
2677
+ B - array[N]:
2678
+ * result=true => overwritten by solution
2679
+ * result=false => filled by zeros
2680
+
2681
+ RETURNS:
2682
+ True, if the system was solved
2683
+ False, for an extremely badly conditioned or indefinite system
2684
+
2685
+ -- ALGLIB --
2686
+ Copyright 18.03.2015 by Bochkanov Sergey
2687
+ *************************************************************************/
2688
+ bool hpdmatrixcholeskysolvefast(const complex_2d_array &cha, const ae_int_t n, const bool isupper, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
2689
+ bool hpdmatrixcholeskysolvefast(const complex_2d_array &cha, const bool isupper, complex_1d_array &b, const xparams _xparams = alglib::xdefault);
2690
+
2691
+
2692
+ /*************************************************************************
2693
+ Dense solver.
2694
+
2695
+ This subroutine finds solution of the linear system A*X=B with non-square,
2696
+ possibly degenerate A. System is solved in the least squares sense, and
2697
+ general least squares solution X = X0 + CX*y which minimizes |A*X-B| is
2698
+ returned. If A is non-degenerate, solution in the usual sense is returned.
2699
+
2700
+ Algorithm features:
2701
+ * automatic detection (and correct handling!) of degenerate cases
2702
+ * iterative refinement
2703
+ * O(N^3) complexity
2704
+
2705
+ INPUT PARAMETERS
2706
+ A - array[0..NRows-1,0..NCols-1], system matrix
2707
+ NRows - vertical size of A
2708
+ NCols - horizontal size of A
2709
+ B - array[0..NCols-1], right part
2710
+ Threshold- a number in [0,1]. Singular values beyond Threshold*Largest are
2711
+ considered zero. Set it to 0.0, if you don't understand
2712
+ what it means, so the solver will choose good value on its
2713
+ own.
2714
+
2715
+ OUTPUT PARAMETERS
2716
+ Rep - solver report, see below for more info
2717
+ X - array[0..N-1,0..M-1], it contains:
2718
+ * solution of A*X=B (even for singular A)
2719
+ * zeros, if SVD subroutine failed
2720
+
2721
+ SOLVER REPORT
2722
+
2723
+ Subroutine sets following fields of the Rep structure:
2724
+ * TerminationType is set to:
2725
+ * -4 for SVD failure
2726
+ * >0 for success
2727
+ * R2 reciprocal of condition number: 1/cond(A), 2-norm.
2728
+ * N = NCols
2729
+ * K dim(Null(A))
2730
+ * CX array[0..N-1,0..K-1], kernel of A.
2731
+ Columns of CX store such vectors that A*CX[i]=0.
2732
+
2733
+ ! FREE EDITION OF ALGLIB:
2734
+ !
2735
+ ! Free Edition of ALGLIB supports following important features for this
2736
+ ! function:
2737
+ ! * C++ version: x64 SIMD support using C++ intrinsics
2738
+ ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics
2739
+ !
2740
+ ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB
2741
+ ! Reference Manual in order to find out how to activate SIMD support
2742
+ ! in ALGLIB.
2743
+
2744
+ ! COMMERCIAL EDITION OF ALGLIB:
2745
+ !
2746
+ ! Commercial Edition of ALGLIB includes following important improvements
2747
+ ! of this function:
2748
+ ! * high-performance native backend with same C# interface (C# version)
2749
+ ! * multithreading support (C++ and C# versions)
2750
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
2751
+ ! (C++ and C# versions, x86/x64 platform)
2752
+ !
2753
+ ! We recommend you to read 'Working with commercial version' section of
2754
+ ! ALGLIB Reference Manual in order to find out how to use performance-
2755
+ ! related features provided by commercial edition of ALGLIB.
2756
+
2757
+ -- ALGLIB --
2758
+ Copyright 24.08.2009 by Bochkanov Sergey
2759
+ *************************************************************************/
2760
+ void rmatrixsolvels(const real_2d_array &a, const ae_int_t nrows, const ae_int_t ncols, const real_1d_array &b, const double threshold, real_1d_array &x, densesolverlsreport &rep, const xparams _xparams = alglib::xdefault);
2761
+ void rmatrixsolvels(const real_2d_array &a, const real_1d_array &b, const double threshold, real_1d_array &x, densesolverlsreport &rep, const xparams _xparams = alglib::xdefault);
2762
+ #endif
2763
+
2764
+ #if defined(AE_COMPILE_ITERATIVESPARSE) || !defined(AE_PARTIAL_BUILD)
2765
+ /*************************************************************************
2766
+ Solving sparse symmetric linear system A*x=b using GMRES(k) method. Sparse
2767
+ symmetric A is given by its lower or upper triangle.
2768
+
2769
+ NOTE: use SparseSolveGMRES() to solve system with nonsymmetric A.
2770
+
2771
+ This function provides convenience API for an 'expert' interface provided
2772
+ by SparseSolverState class. Use SparseSolver API if you need advanced
2773
+ functions like providing initial point, using out-of-core API and so on.
2774
+
2775
+ INPUT PARAMETERS:
2776
+ A - sparse symmetric NxN matrix in any sparse storage format.
2777
+ Using CRS format is recommended because it avoids internal
2778
+ conversion.
2779
+ An exception will be generated if A is not NxN matrix
2780
+ (where N is a size specified during solver object
2781
+ creation).
2782
+ IsUpper - whether upper or lower triangle of A is used:
2783
+ * IsUpper=True => only upper triangle is used and lower
2784
+ triangle is not referenced at all
2785
+ * IsUpper=False => only lower triangle is used and upper
2786
+ triangle is not referenced at all
2787
+ B - right part, array[N]
2788
+ K - k parameter for GMRES(k), k>=0. Zero value means that
2789
+ algorithm will choose it automatically.
2790
+ EpsF - stopping condition, EpsF>=0. The algorithm will stop when
2791
+ residual will decrease below EpsF*|B|. Having EpsF=0 means
2792
+ that this stopping condition is ignored.
2793
+ MaxIts - stopping condition, MaxIts>=0. The algorithm will stop
2794
+ after performing MaxIts iterations. Zero value means no
2795
+ limit.
2796
+
2797
+ NOTE: having both EpsF=0 and MaxIts=0 means that stopping criteria will be
2798
+ chosen automatically.
2799
+
2800
+ OUTPUT PARAMETERS:
2801
+ X - array[N], the solution
2802
+ Rep - solution report:
2803
+ * Rep.TerminationType completion code:
2804
+ * -5 CG method was used for a matrix which is not
2805
+ positive definite
2806
+ * -4 overflow/underflow during solution
2807
+ (ill conditioned problem)
2808
+ * 1 ||residual||<=EpsF*||b||
2809
+ * 5 MaxIts steps was taken
2810
+ * 7 rounding errors prevent further progress,
2811
+ best point found is returned
2812
+ * 8 the algorithm was terminated early with
2813
+ SparseSolverRequestTermination() being called
2814
+ from other thread.
2815
+ * Rep.IterationsCount contains iterations count
2816
+ * Rep.NMV contains number of matrix-vector calculations
2817
+ * Rep.R2 contains squared residual
2818
+
2819
+ -- ALGLIB --
2820
+ Copyright 25.09.2021 by Bochkanov Sergey
2821
+ *************************************************************************/
2822
+ void sparsesolvesymmetricgmres(const sparsematrix &a, const bool isupper, const real_1d_array &b, const ae_int_t k, const double epsf, const ae_int_t maxits, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
2823
+
2824
+
2825
+ /*************************************************************************
2826
+ Solving sparse linear system A*x=b using GMRES(k) method.
2827
+
2828
+ This function provides convenience API for an 'expert' interface provided
2829
+ by SparseSolverState class. Use SparseSolver API if you need advanced
2830
+ functions like providing initial point, using out-of-core API and so on.
2831
+
2832
+ INPUT PARAMETERS:
2833
+ A - sparse NxN matrix in any sparse storage format. Using CRS
2834
+ format is recommended because it avoids internal
2835
+ conversion.
2836
+ An exception will be generated if A is not NxN matrix
2837
+ (where N is a size specified during solver object
2838
+ creation).
2839
+ B - right part, array[N]
2840
+ K - k parameter for GMRES(k), k>=0. Zero value means that
2841
+ algorithm will choose it automatically.
2842
+ EpsF - stopping condition, EpsF>=0. The algorithm will stop when
2843
+ residual will decrease below EpsF*|B|. Having EpsF=0 means
2844
+ that this stopping condition is ignored.
2845
+ MaxIts - stopping condition, MaxIts>=0. The algorithm will stop
2846
+ after performing MaxIts iterations. Zero value means no
2847
+ limit.
2848
+
2849
+ NOTE: having both EpsF=0 and MaxIts=0 means that stopping criteria will be
2850
+ chosen automatically.
2851
+
2852
+ OUTPUT PARAMETERS:
2853
+ X - array[N], the solution
2854
+ Rep - solution report:
2855
+ * Rep.TerminationType completion code:
2856
+ * -5 CG method was used for a matrix which is not
2857
+ positive definite
2858
+ * -4 overflow/underflow during solution
2859
+ (ill conditioned problem)
2860
+ * 1 ||residual||<=EpsF*||b||
2861
+ * 5 MaxIts steps was taken
2862
+ * 7 rounding errors prevent further progress,
2863
+ best point found is returned
2864
+ * 8 the algorithm was terminated early with
2865
+ SparseSolverRequestTermination() being called
2866
+ from other thread.
2867
+ * Rep.IterationsCount contains iterations count
2868
+ * Rep.NMV contains number of matrix-vector calculations
2869
+ * Rep.R2 contains squared residual
2870
+
2871
+ -- ALGLIB --
2872
+ Copyright 25.09.2021 by Bochkanov Sergey
2873
+ *************************************************************************/
2874
+ void sparsesolvegmres(const sparsematrix &a, const real_1d_array &b, const ae_int_t k, const double epsf, const ae_int_t maxits, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
2875
+
2876
+
2877
+ /*************************************************************************
2878
+ This function initializes sparse linear iterative solver object.
2879
+
2880
+ This solver can be used to solve nonsymmetric and symmetric positive
2881
+ definite NxN (square) linear systems.
2882
+
2883
+ The solver provides 'expert' API which allows advanced control over
2884
+ algorithms being used, including ability to get progress report, terminate
2885
+ long-running solver from other thread, out-of-core solution and so on.
2886
+
2887
+ NOTE: there are also convenience functions that allows quick one-line
2888
+ access to the solvers:
2889
+ * SparseSolveCG() to solve SPD linear systems
2890
+ * SparseSolveGMRES() to solve unsymmetric linear systems.
2891
+
2892
+ NOTE: if you want to solve MxN (rectangular) linear problem you may use
2893
+ LinLSQR solver provided by ALGLIB.
2894
+
2895
+ USAGE (A is given by the SparseMatrix structure):
2896
+
2897
+ 1. User initializes algorithm state with SparseSolverCreate() call
2898
+ 2. User selects algorithm with one of the SparseSolverSetAlgo???()
2899
+ functions. By default, GMRES(k) is used with automatically chosen k
2900
+ 3. Optionally, user tunes solver parameters, sets starting point, etc.
2901
+ 4. Depending on whether system is symmetric or not, user calls:
2902
+ * SparseSolverSolveSymmetric() for a symmetric system given by its
2903
+ lower or upper triangle
2904
+ * SparseSolverSolve() for a nonsymmetric system or a symmetric one
2905
+ given by the full matrix
2906
+ 5. User calls SparseSolverResults() to get the solution
2907
+
2908
+ It is possible to call SparseSolverSolve???() again to solve another
2909
+ task with same dimensionality but different matrix and/or right part
2910
+ without reinitializing SparseSolverState structure.
2911
+
2912
+ USAGE (out-of-core mode):
2913
+
2914
+ 1. User initializes algorithm state with SparseSolverCreate() call
2915
+ 2. User selects algorithm with one of the SparseSolverSetAlgo???()
2916
+ functions. By default, GMRES(k) is used with automatically chosen k
2917
+ 3. Optionally, user tunes solver parameters, sets starting point, etc.
2918
+ 4. After that user should work with out-of-core interface in a loop
2919
+ like one given below:
2920
+
2921
+ > alglib.sparsesolveroocstart(state)
2922
+ > while alglib.sparsesolverooccontinue(state) do
2923
+ > alglib.sparsesolveroocgetrequestinfo(state, out RequestType)
2924
+ > alglib.sparsesolveroocgetrequestdata(state, out X)
2925
+ > if RequestType=0 then
2926
+ > [calculate Y=A*X, with X=R^N]
2927
+ > alglib.sparsesolveroocsendresult(state, in Y)
2928
+ > alglib.sparsesolveroocstop(state, out X, out Report)
2929
+
2930
+ INPUT PARAMETERS:
2931
+ N - problem dimensionality (fixed at start-up)
2932
+
2933
+ OUTPUT PARAMETERS:
2934
+ State - structure which stores algorithm state
2935
+
2936
+ -- ALGLIB --
2937
+ Copyright 24.09.2021 by Bochkanov Sergey
2938
+ *************************************************************************/
2939
+ void sparsesolvercreate(const ae_int_t n, sparsesolverstate &state, const xparams _xparams = alglib::xdefault);
2940
+
2941
+
2942
+ /*************************************************************************
2943
+ This function sets the solver algorithm to GMRES(k).
2944
+
2945
+ NOTE: if you do not need advanced functionality of the SparseSolver API,
2946
+ you may use convenience functions SparseSolveGMRES() and
2947
+ SparseSolveSymmetricGMRES().
2948
+
2949
+ INPUT PARAMETERS:
2950
+ State - structure which stores algorithm state
2951
+ K - GMRES parameter, K>=0:
2952
+ * recommended values are in 10..100 range
2953
+ * larger values up to N are possible but have little sense
2954
+ - the algorithm will be slower than any dense solver.
2955
+ * values above N are truncated down to N
2956
+ * zero value means that default value is chosen. This
2957
+ value is 50 in the current version, but it may change
2958
+ in future ALGLIB releases.
2959
+
2960
+ -- ALGLIB --
2961
+ Copyright 24.09.2021 by Bochkanov Sergey
2962
+ *************************************************************************/
2963
+ void sparsesolversetalgogmres(sparsesolverstate &state, const ae_int_t k, const xparams _xparams = alglib::xdefault);
2964
+
2965
+
2966
+ /*************************************************************************
2967
+ This function sets starting point.
2968
+ By default, zero starting point is used.
2969
+
2970
+ INPUT PARAMETERS:
2971
+ State - structure which stores algorithm state
2972
+ X - starting point, array[N]
2973
+
2974
+ OUTPUT PARAMETERS:
2975
+ State - new starting point was set
2976
+
2977
+ -- ALGLIB --
2978
+ Copyright 24.09.2021 by Bochkanov Sergey
2979
+ *************************************************************************/
2980
+ void sparsesolversetstartingpoint(sparsesolverstate &state, const real_1d_array &x, const xparams _xparams = alglib::xdefault);
2981
+
2982
+
2983
+ /*************************************************************************
2984
+ This function sets stopping criteria.
2985
+
2986
+ INPUT PARAMETERS:
2987
+ EpsF - algorithm will be stopped if norm of residual is less than
2988
+ EpsF*||b||.
2989
+ MaxIts - algorithm will be stopped if number of iterations is more
2990
+ than MaxIts.
2991
+
2992
+ OUTPUT PARAMETERS:
2993
+ State - structure which stores algorithm state
2994
+
2995
+ NOTES:
2996
+ If both EpsF and MaxIts are zero then small EpsF will be set to small
2997
+ value.
2998
+
2999
+ -- ALGLIB --
3000
+ Copyright 14.11.2011 by Bochkanov Sergey
3001
+ *************************************************************************/
3002
+ void sparsesolversetcond(sparsesolverstate &state, const double epsf, const ae_int_t maxits, const xparams _xparams = alglib::xdefault);
3003
+
3004
+
3005
+ /*************************************************************************
3006
+ Procedure for the solution of A*x=b with sparse symmetric A given by its
3007
+ lower or upper triangle.
3008
+
3009
+ This function will work with any solver algorithm being used, SPD one
3010
+ (like CG) or not (like GMRES). Using unsymmetric solvers (like GMRES) on
3011
+ SPD problems is suboptimal, but still possible.
3012
+
3013
+ NOTE: the solver behavior is ill-defined for a situation when a SPD
3014
+ solver is used on indefinite matrix. It may solve the problem up to
3015
+ desired precision (sometimes, rarely) or return with error code
3016
+ signalling violation of underlying assumptions.
3017
+
3018
+ INPUT PARAMETERS:
3019
+ State - algorithm state
3020
+ A - sparse symmetric NxN matrix in any sparse storage format.
3021
+ Using CRS format is recommended because it avoids internal
3022
+ conversion.
3023
+ An exception will be generated if A is not NxN matrix
3024
+ (where N is a size specified during solver object
3025
+ creation).
3026
+ IsUpper - whether upper or lower triangle of A is used:
3027
+ * IsUpper=True => only upper triangle is used and lower
3028
+ triangle is not referenced at all
3029
+ * IsUpper=False => only lower triangle is used and upper
3030
+ triangle is not referenced at all
3031
+ B - right part, array[N]
3032
+
3033
+ RESULT:
3034
+ This function returns no result.
3035
+ You can get the solution by calling SparseSolverResults()
3036
+
3037
+ -- ALGLIB --
3038
+ Copyright 25.09.2021 by Bochkanov Sergey
3039
+ *************************************************************************/
3040
+ void sparsesolversolvesymmetric(sparsesolverstate &state, const sparsematrix &a, const bool isupper, const real_1d_array &b, const xparams _xparams = alglib::xdefault);
3041
+
3042
+
3043
+ /*************************************************************************
3044
+ Procedure for the solution of A*x=b with sparse nonsymmetric A
3045
+
3046
+ IMPORTANT: this function will work with any solver algorithm being used,
3047
+ symmetric solver like CG, or not. However, using symmetric
3048
+ solvers on nonsymmetric problems is dangerous. It may solve
3049
+ the problem up to desired precision (sometimes, rarely) or
3050
+ terminate with error code signalling violation of underlying
3051
+ assumptions.
3052
+
3053
+ INPUT PARAMETERS:
3054
+ State - algorithm state
3055
+ A - sparse NxN matrix in any sparse storage format.
3056
+ Using CRS format is recommended because it avoids internal
3057
+ conversion.
3058
+ An exception will be generated if A is not NxN matrix
3059
+ (where N is a size specified during solver object
3060
+ creation).
3061
+ B - right part, array[N]
3062
+
3063
+ RESULT:
3064
+ This function returns no result.
3065
+ You can get the solution by calling SparseSolverResults()
3066
+
3067
+ -- ALGLIB --
3068
+ Copyright 25.09.2021 by Bochkanov Sergey
3069
+ *************************************************************************/
3070
+ void sparsesolversolve(sparsesolverstate &state, const sparsematrix &a, const real_1d_array &b, const xparams _xparams = alglib::xdefault);
3071
+
3072
+
3073
+ /*************************************************************************
3074
+ Sparse solver results.
3075
+
3076
+ This function must be called after calling one of the SparseSolverSolve()
3077
+ functions.
3078
+
3079
+ INPUT PARAMETERS:
3080
+ State - algorithm state
3081
+
3082
+ OUTPUT PARAMETERS:
3083
+ X - array[N], solution
3084
+ Rep - solution report:
3085
+ * Rep.TerminationType completion code:
3086
+ * -5 CG method was used for a matrix which is not
3087
+ positive definite
3088
+ * -4 overflow/underflow during solution
3089
+ (ill conditioned problem)
3090
+ * 1 ||residual||<=EpsF*||b||
3091
+ * 5 MaxIts steps was taken
3092
+ * 7 rounding errors prevent further progress,
3093
+ best point found is returned
3094
+ * 8 the algorithm was terminated early with
3095
+ SparseSolverRequestTermination() being called
3096
+ from other thread.
3097
+ * Rep.IterationsCount contains iterations count
3098
+ * Rep.NMV contains number of matrix-vector calculations
3099
+ * Rep.R2 contains squared residual
3100
+ s
3101
+ -- ALGLIB --
3102
+ Copyright 14.11.2011 by Bochkanov Sergey
3103
+ *************************************************************************/
3104
+ void sparsesolverresults(sparsesolverstate &state, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
3105
+
3106
+
3107
+ /*************************************************************************
3108
+ This function turns on/off reporting during out-of-core processing.
3109
+
3110
+ When the solver works in the out-of-core mode, it can be configured to
3111
+ report its progress by returning current location. These location reports
3112
+ are implemented as a special kind of the out-of-core request:
3113
+ * SparseSolverOOCGetRequestInfo() returns -1
3114
+ * SparseSolverOOCGetRequestData() returns current location
3115
+ * SparseSolverOOCGetRequestData1() returns squared norm of the residual
3116
+ * SparseSolverOOCSendResult() shall NOT be called
3117
+
3118
+ This function has no effect when SparseSolverSolve() is used because this
3119
+ function has no method of reporting its progress.
3120
+
3121
+ NOTE: when used with GMRES(k), this function reports progress every k-th
3122
+ iteration.
3123
+
3124
+ INPUT PARAMETERS:
3125
+ State - structure which stores algorithm state
3126
+ NeedXRep- whether iteration reports are needed or not
3127
+
3128
+ -- ALGLIB --
3129
+ Copyright 01.10.2021 by Bochkanov Sergey
3130
+ *************************************************************************/
3131
+ void sparsesolversetxrep(sparsesolverstate &state, const bool needxrep, const xparams _xparams = alglib::xdefault);
3132
+
3133
+
3134
+ /*************************************************************************
3135
+ This function initiates out-of-core mode of the sparse solver. It should
3136
+ be used in conjunction with other out-of-core-related functions of this
3137
+ subspackage in a loop like one given below:
3138
+
3139
+ > alglib.sparsesolveroocstart(state)
3140
+ > while alglib.sparsesolverooccontinue(state) do
3141
+ > alglib.sparsesolveroocgetrequestinfo(state, out RequestType)
3142
+ > alglib.sparsesolveroocgetrequestdata(state, out X)
3143
+ > if RequestType=0 then
3144
+ > [calculate Y=A*X, with X=R^N]
3145
+ > alglib.sparsesolveroocsendresult(state, in Y)
3146
+ > alglib.sparsesolveroocstop(state, out X, out Report)
3147
+
3148
+ INPUT PARAMETERS:
3149
+ State - solver object
3150
+
3151
+ -- ALGLIB --
3152
+ Copyright 24.09.2021 by Bochkanov Sergey
3153
+ *************************************************************************/
3154
+ void sparsesolveroocstart(sparsesolverstate &state, const real_1d_array &b, const xparams _xparams = alglib::xdefault);
3155
+
3156
+
3157
+ /*************************************************************************
3158
+ This function performs iterative solution of the linear system in the
3159
+ out-of-core mode. It should be used in conjunction with other out-of-core-
3160
+ related functions of this subspackage in a loop like one given below:
3161
+
3162
+ > alglib.sparsesolveroocstart(state)
3163
+ > while alglib.sparsesolverooccontinue(state) do
3164
+ > alglib.sparsesolveroocgetrequestinfo(state, out RequestType)
3165
+ > alglib.sparsesolveroocgetrequestdata(state, out X)
3166
+ > if RequestType=0 then
3167
+ > [calculate Y=A*X, with X=R^N]
3168
+ > alglib.sparsesolveroocsendresult(state, in Y)
3169
+ > alglib.sparsesolveroocstop(state, out X, out Report)
3170
+
3171
+ -- ALGLIB --
3172
+ Copyright 24.09.2021 by Bochkanov Sergey
3173
+ *************************************************************************/
3174
+ bool sparsesolverooccontinue(sparsesolverstate &state, const xparams _xparams = alglib::xdefault);
3175
+
3176
+
3177
+ /*************************************************************************
3178
+ This function is used to retrieve information about out-of-core request
3179
+ sent by the solver:
3180
+ * RequestType=0 means that matrix-vector products A*x is requested
3181
+ * RequestType=-1 means that solver reports its progress; this request is
3182
+ returned only when reports are activated wit SparseSolverSetXRep().
3183
+
3184
+ This function returns just request type; in order to get contents of the
3185
+ trial vector, use sparsesolveroocgetrequestdata().
3186
+
3187
+ It should be used in conjunction with other out-of-core-related functions
3188
+ of this subspackage in a loop like one given below:
3189
+
3190
+ > alglib.sparsesolveroocstart(state)
3191
+ > while alglib.sparsesolverooccontinue(state) do
3192
+ > alglib.sparsesolveroocgetrequestinfo(state, out RequestType)
3193
+ > alglib.sparsesolveroocgetrequestdata(state, out X)
3194
+ > if RequestType=0 then
3195
+ > [calculate Y=A*X, with X=R^N]
3196
+ > alglib.sparsesolveroocsendresult(state, in Y)
3197
+ > alglib.sparsesolveroocstop(state, out X, out Report)
3198
+
3199
+ INPUT PARAMETERS:
3200
+ State - solver running in out-of-core mode
3201
+
3202
+ OUTPUT PARAMETERS:
3203
+ RequestType - type of the request to process:
3204
+ * 0 for matrix-vector product A*x, with A being
3205
+ NxN system matrix and X being N-dimensional
3206
+ vector
3207
+ *-1 for location and residual report
3208
+
3209
+
3210
+ -- ALGLIB --
3211
+ Copyright 24.09.2021 by Bochkanov Sergey
3212
+ *************************************************************************/
3213
+ void sparsesolveroocgetrequestinfo(sparsesolverstate &state, ae_int_t &requesttype, const xparams _xparams = alglib::xdefault);
3214
+
3215
+
3216
+ /*************************************************************************
3217
+ This function is used to retrieve vector associated with out-of-core
3218
+ request sent by the solver to user code. Depending on the request type
3219
+ (returned by the SparseSolverOOCGetRequestInfo()) this vector should be
3220
+ multiplied by A or subjected to another processing.
3221
+
3222
+ It should be used in conjunction with other out-of-core-related functions
3223
+ of this subspackage in a loop like one given below:
3224
+
3225
+ > alglib.sparsesolveroocstart(state)
3226
+ > while alglib.sparsesolverooccontinue(state) do
3227
+ > alglib.sparsesolveroocgetrequestinfo(state, out RequestType)
3228
+ > alglib.sparsesolveroocgetrequestdata(state, out X)
3229
+ > if RequestType=0 then
3230
+ > [calculate Y=A*X, with X=R^N]
3231
+ > alglib.sparsesolveroocsendresult(state, in Y)
3232
+ > alglib.sparsesolveroocstop(state, out X, out Report)
3233
+
3234
+ INPUT PARAMETERS:
3235
+ State - solver running in out-of-core mode
3236
+ X - possibly preallocated storage; reallocated if
3237
+ needed, left unchanged, if large enough to store
3238
+ request data.
3239
+
3240
+ OUTPUT PARAMETERS:
3241
+ X - array[N] or larger, leading N elements are filled
3242
+ with vector X.
3243
+
3244
+
3245
+ -- ALGLIB --
3246
+ Copyright 24.09.2021 by Bochkanov Sergey
3247
+ *************************************************************************/
3248
+ void sparsesolveroocgetrequestdata(sparsesolverstate &state, real_1d_array &x, const xparams _xparams = alglib::xdefault);
3249
+
3250
+
3251
+ /*************************************************************************
3252
+ This function is used to retrieve scalar value associated with out-of-core
3253
+ request sent by the solver to user code. In the current ALGLIB version
3254
+ this function is used to retrieve squared residual norm during progress
3255
+ reports.
3256
+
3257
+ INPUT PARAMETERS:
3258
+ State - solver running in out-of-core mode
3259
+
3260
+ OUTPUT PARAMETERS:
3261
+ V - scalar value associated with the current request
3262
+
3263
+
3264
+ -- ALGLIB --
3265
+ Copyright 24.09.2021 by Bochkanov Sergey
3266
+ *************************************************************************/
3267
+ void sparsesolveroocgetrequestdata1(sparsesolverstate &state, double &v, const xparams _xparams = alglib::xdefault);
3268
+
3269
+
3270
+ /*************************************************************************
3271
+ This function is used to send user reply to out-of-core request sent by
3272
+ the solver. Usually it is product A*x for vector X returned by the solver.
3273
+
3274
+ It should be used in conjunction with other out-of-core-related functions
3275
+ of this subspackage in a loop like one given below:
3276
+
3277
+ > alglib.sparsesolveroocstart(state)
3278
+ > while alglib.sparsesolverooccontinue(state) do
3279
+ > alglib.sparsesolveroocgetrequestinfo(state, out RequestType)
3280
+ > alglib.sparsesolveroocgetrequestdata(state, out X)
3281
+ > if RequestType=0 then
3282
+ > [calculate Y=A*X, with X=R^N]
3283
+ > alglib.sparsesolveroocsendresult(state, in Y)
3284
+ > alglib.sparsesolveroocstop(state, out X, out Report)
3285
+
3286
+ INPUT PARAMETERS:
3287
+ State - solver running in out-of-core mode
3288
+ AX - array[N] or larger, leading N elements contain A*x
3289
+
3290
+
3291
+ -- ALGLIB --
3292
+ Copyright 24.09.2021 by Bochkanov Sergey
3293
+ *************************************************************************/
3294
+ void sparsesolveroocsendresult(sparsesolverstate &state, const real_1d_array &ax, const xparams _xparams = alglib::xdefault);
3295
+
3296
+
3297
+ /*************************************************************************
3298
+ This function finalizes out-of-core mode of the linear solver. It should
3299
+ be used in conjunction with other out-of-core-related functions of this
3300
+ subspackage in a loop like one given below:
3301
+
3302
+ > alglib.sparsesolveroocstart(state)
3303
+ > while alglib.sparsesolverooccontinue(state) do
3304
+ > alglib.sparsesolveroocgetrequestinfo(state, out RequestType)
3305
+ > alglib.sparsesolveroocgetrequestdata(state, out X)
3306
+ > if RequestType=0 then
3307
+ > [calculate Y=A*X, with X=R^N]
3308
+ > alglib.sparsesolveroocsendresult(state, in Y)
3309
+ > alglib.sparsesolveroocstop(state, out X, out Report)
3310
+
3311
+ INPUT PARAMETERS:
3312
+ State - solver state
3313
+
3314
+ OUTPUT PARAMETERS:
3315
+ X - array[N], the solution.
3316
+ Zero-filled on the failure (Rep.TerminationType<0).
3317
+ Rep - report with additional info:
3318
+ * Rep.TerminationType completion code:
3319
+ * -5 CG method was used for a matrix which is not
3320
+ positive definite
3321
+ * -4 overflow/underflow during solution
3322
+ (ill conditioned problem)
3323
+ * 1 ||residual||<=EpsF*||b||
3324
+ * 5 MaxIts steps was taken
3325
+ * 7 rounding errors prevent further progress,
3326
+ best point found is returned
3327
+ * 8 the algorithm was terminated early with
3328
+ SparseSolverRequestTermination() being called
3329
+ from other thread.
3330
+ * Rep.IterationsCount contains iterations count
3331
+ * Rep.NMV contains number of matrix-vector calculations
3332
+ * Rep.R2 contains squared residual
3333
+
3334
+ -- ALGLIB --
3335
+ Copyright 24.09.2021 by Bochkanov Sergey
3336
+ *************************************************************************/
3337
+ void sparsesolveroocstop(sparsesolverstate &state, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
3338
+
3339
+
3340
+ /*************************************************************************
3341
+ This subroutine submits request for termination of the running solver. It
3342
+ can be called from some other thread which wants the solver to terminate
3343
+ or when processing an out-of-core request.
3344
+
3345
+ As result, solver stops at point which was "current accepted" when
3346
+ the termination request was submitted and returns error code 8 (successful
3347
+ termination). Such termination is a smooth process which properly
3348
+ deallocates all temporaries.
3349
+
3350
+ INPUT PARAMETERS:
3351
+ State - solver structure
3352
+
3353
+ NOTE: calling this function on solver which is NOT running will have no
3354
+ effect.
3355
+
3356
+ NOTE: multiple calls to this function are possible. First call is counted,
3357
+ subsequent calls are silently ignored.
3358
+
3359
+ NOTE: solver clears termination flag on its start, it means that if some
3360
+ other thread will request termination too soon, its request will went
3361
+ unnoticed.
3362
+
3363
+ -- ALGLIB --
3364
+ Copyright 01.10.2021 by Bochkanov Sergey
3365
+ *************************************************************************/
3366
+ void sparsesolverrequesttermination(sparsesolverstate &state, const xparams _xparams = alglib::xdefault);
3367
+ #endif
3368
+
3369
+ #if defined(AE_COMPILE_LINCG) || !defined(AE_PARTIAL_BUILD)
3370
+ /*************************************************************************
3371
+ This function initializes linear CG Solver. This solver is used to solve
3372
+ symmetric positive definite problems. If you want to solve nonsymmetric
3373
+ (or non-positive definite) problem you may use LinLSQR solver provided by
3374
+ ALGLIB.
3375
+
3376
+ USAGE:
3377
+ 1. User initializes algorithm state with LinCGCreate() call
3378
+ 2. User tunes solver parameters with LinCGSetCond() and other functions
3379
+ 3. Optionally, user sets starting point with LinCGSetStartingPoint()
3380
+ 4. User calls LinCGSolveSparse() function which takes algorithm state and
3381
+ SparseMatrix object.
3382
+ 5. User calls LinCGResults() to get solution
3383
+ 6. Optionally, user may call LinCGSolveSparse() again to solve another
3384
+ problem with different matrix and/or right part without reinitializing
3385
+ LinCGState structure.
3386
+
3387
+ INPUT PARAMETERS:
3388
+ N - problem dimension, N>0
3389
+
3390
+ OUTPUT PARAMETERS:
3391
+ State - structure which stores algorithm state
3392
+
3393
+ -- ALGLIB --
3394
+ Copyright 14.11.2011 by Bochkanov Sergey
3395
+ *************************************************************************/
3396
+ void lincgcreate(const ae_int_t n, lincgstate &state, const xparams _xparams = alglib::xdefault);
3397
+
3398
+
3399
+ /*************************************************************************
3400
+ This function sets starting point.
3401
+ By default, zero starting point is used.
3402
+
3403
+ INPUT PARAMETERS:
3404
+ X - starting point, array[N]
3405
+
3406
+ OUTPUT PARAMETERS:
3407
+ State - structure which stores algorithm state
3408
+
3409
+ -- ALGLIB --
3410
+ Copyright 14.11.2011 by Bochkanov Sergey
3411
+ *************************************************************************/
3412
+ void lincgsetstartingpoint(lincgstate &state, const real_1d_array &x, const xparams _xparams = alglib::xdefault);
3413
+
3414
+
3415
+ /*************************************************************************
3416
+ This function changes preconditioning settings of LinCGSolveSparse()
3417
+ function. By default, SolveSparse() uses diagonal preconditioner, but if
3418
+ you want to use solver without preconditioning, you can call this function
3419
+ which forces solver to use unit matrix for preconditioning.
3420
+
3421
+ INPUT PARAMETERS:
3422
+ State - structure which stores algorithm state
3423
+
3424
+ -- ALGLIB --
3425
+ Copyright 19.11.2012 by Bochkanov Sergey
3426
+ *************************************************************************/
3427
+ void lincgsetprecunit(lincgstate &state, const xparams _xparams = alglib::xdefault);
3428
+
3429
+
3430
+ /*************************************************************************
3431
+ This function changes preconditioning settings of LinCGSolveSparse()
3432
+ function. LinCGSolveSparse() will use diagonal of the system matrix as
3433
+ preconditioner. This preconditioning mode is active by default.
3434
+
3435
+ INPUT PARAMETERS:
3436
+ State - structure which stores algorithm state
3437
+
3438
+ -- ALGLIB --
3439
+ Copyright 19.11.2012 by Bochkanov Sergey
3440
+ *************************************************************************/
3441
+ void lincgsetprecdiag(lincgstate &state, const xparams _xparams = alglib::xdefault);
3442
+
3443
+
3444
+ /*************************************************************************
3445
+ This function sets stopping criteria.
3446
+
3447
+ INPUT PARAMETERS:
3448
+ EpsF - algorithm will be stopped if norm of residual is less than
3449
+ EpsF*||b||.
3450
+ MaxIts - algorithm will be stopped if number of iterations is more
3451
+ than MaxIts.
3452
+
3453
+ OUTPUT PARAMETERS:
3454
+ State - structure which stores algorithm state
3455
+
3456
+ NOTES:
3457
+ If both EpsF and MaxIts are zero then small EpsF will be set to small
3458
+ value.
3459
+
3460
+ -- ALGLIB --
3461
+ Copyright 14.11.2011 by Bochkanov Sergey
3462
+ *************************************************************************/
3463
+ void lincgsetcond(lincgstate &state, const double epsf, const ae_int_t maxits, const xparams _xparams = alglib::xdefault);
3464
+
3465
+
3466
+ /*************************************************************************
3467
+ Procedure for solution of A*x=b with sparse A.
3468
+
3469
+ INPUT PARAMETERS:
3470
+ State - algorithm state
3471
+ A - sparse matrix in the CRS format (you MUST contvert it to
3472
+ CRS format by calling SparseConvertToCRS() function).
3473
+ IsUpper - whether upper or lower triangle of A is used:
3474
+ * IsUpper=True => only upper triangle is used and lower
3475
+ triangle is not referenced at all
3476
+ * IsUpper=False => only lower triangle is used and upper
3477
+ triangle is not referenced at all
3478
+ B - right part, array[N]
3479
+
3480
+ RESULT:
3481
+ This function returns no result.
3482
+ You can get solution by calling LinCGResults()
3483
+
3484
+ NOTE: this function uses lightweight preconditioning - multiplication by
3485
+ inverse of diag(A). If you want, you can turn preconditioning off by
3486
+ calling LinCGSetPrecUnit(). However, preconditioning cost is low and
3487
+ preconditioner is very important for solution of badly scaled
3488
+ problems.
3489
+
3490
+ -- ALGLIB --
3491
+ Copyright 14.11.2011 by Bochkanov Sergey
3492
+ *************************************************************************/
3493
+ void lincgsolvesparse(lincgstate &state, const sparsematrix &a, const bool isupper, const real_1d_array &b, const xparams _xparams = alglib::xdefault);
3494
+
3495
+
3496
+ /*************************************************************************
3497
+ CG-solver: results.
3498
+
3499
+ This function must be called after LinCGSolve
3500
+
3501
+ INPUT PARAMETERS:
3502
+ State - algorithm state
3503
+
3504
+ OUTPUT PARAMETERS:
3505
+ X - array[N], solution
3506
+ Rep - optimization report:
3507
+ * Rep.TerminationType completetion code:
3508
+ * -5 input matrix is either not positive definite,
3509
+ too large or too small
3510
+ * -4 overflow/underflow during solution
3511
+ (ill conditioned problem)
3512
+ * 1 ||residual||<=EpsF*||b||
3513
+ * 5 MaxIts steps was taken
3514
+ * 7 rounding errors prevent further progress,
3515
+ best point found is returned
3516
+ * Rep.IterationsCount contains iterations count
3517
+ * NMV countains number of matrix-vector calculations
3518
+
3519
+ -- ALGLIB --
3520
+ Copyright 14.11.2011 by Bochkanov Sergey
3521
+ *************************************************************************/
3522
+ void lincgresults(const lincgstate &state, real_1d_array &x, lincgreport &rep, const xparams _xparams = alglib::xdefault);
3523
+
3524
+
3525
+ /*************************************************************************
3526
+ This function sets restart frequency. By default, algorithm is restarted
3527
+ after N subsequent iterations.
3528
+
3529
+ -- ALGLIB --
3530
+ Copyright 14.11.2011 by Bochkanov Sergey
3531
+ *************************************************************************/
3532
+ void lincgsetrestartfreq(lincgstate &state, const ae_int_t srf, const xparams _xparams = alglib::xdefault);
3533
+
3534
+
3535
+ /*************************************************************************
3536
+ This function sets frequency of residual recalculations.
3537
+
3538
+ Algorithm updates residual r_k using iterative formula, but recalculates
3539
+ it from scratch after each 10 iterations. It is done to avoid accumulation
3540
+ of numerical errors and to stop algorithm when r_k starts to grow.
3541
+
3542
+ Such low update frequence (1/10) gives very little overhead, but makes
3543
+ algorithm a bit more robust against numerical errors. However, you may
3544
+ change it
3545
+
3546
+ INPUT PARAMETERS:
3547
+ Freq - desired update frequency, Freq>=0.
3548
+ Zero value means that no updates will be done.
3549
+
3550
+ -- ALGLIB --
3551
+ Copyright 14.11.2011 by Bochkanov Sergey
3552
+ *************************************************************************/
3553
+ void lincgsetrupdatefreq(lincgstate &state, const ae_int_t freq, const xparams _xparams = alglib::xdefault);
3554
+
3555
+
3556
+ /*************************************************************************
3557
+ This function turns on/off reporting.
3558
+
3559
+ INPUT PARAMETERS:
3560
+ State - structure which stores algorithm state
3561
+ NeedXRep- whether iteration reports are needed or not
3562
+
3563
+ If NeedXRep is True, algorithm will call rep() callback function if it is
3564
+ provided to MinCGOptimize().
3565
+
3566
+ -- ALGLIB --
3567
+ Copyright 14.11.2011 by Bochkanov Sergey
3568
+ *************************************************************************/
3569
+ void lincgsetxrep(lincgstate &state, const bool needxrep, const xparams _xparams = alglib::xdefault);
3570
+ #endif
3571
+
3572
+ #if defined(AE_COMPILE_LINLSQR) || !defined(AE_PARTIAL_BUILD)
3573
+ /*************************************************************************
3574
+ This function initializes linear LSQR Solver. This solver is used to solve
3575
+ non-symmetric (and, possibly, non-square) problems. Least squares solution
3576
+ is returned for non-compatible systems.
3577
+
3578
+ USAGE:
3579
+ 1. User initializes algorithm state with LinLSQRCreate() call
3580
+ 2. User tunes solver parameters with LinLSQRSetCond() and other functions
3581
+ 3. User calls LinLSQRSolveSparse() function which takes algorithm state
3582
+ and SparseMatrix object.
3583
+ 4. User calls LinLSQRResults() to get solution
3584
+ 5. Optionally, user may call LinLSQRSolveSparse() again to solve another
3585
+ problem with different matrix and/or right part without reinitializing
3586
+ LinLSQRState structure.
3587
+
3588
+ INPUT PARAMETERS:
3589
+ M - number of rows in A
3590
+ N - number of variables, N>0
3591
+
3592
+ OUTPUT PARAMETERS:
3593
+ State - structure which stores algorithm state
3594
+
3595
+ NOTE: see also linlsqrcreatebuf() for version which reuses previously
3596
+ allocated place as much as possible.
3597
+
3598
+ -- ALGLIB --
3599
+ Copyright 30.11.2011 by Bochkanov Sergey
3600
+ *************************************************************************/
3601
+ void linlsqrcreate(const ae_int_t m, const ae_int_t n, linlsqrstate &state, const xparams _xparams = alglib::xdefault);
3602
+
3603
+
3604
+ /*************************************************************************
3605
+ This function initializes linear LSQR Solver. It provides exactly same
3606
+ functionality as linlsqrcreate(), but reuses previously allocated space
3607
+ as much as possible.
3608
+
3609
+ INPUT PARAMETERS:
3610
+ M - number of rows in A
3611
+ N - number of variables, N>0
3612
+
3613
+ OUTPUT PARAMETERS:
3614
+ State - structure which stores algorithm state
3615
+
3616
+ -- ALGLIB --
3617
+ Copyright 14.11.2018 by Bochkanov Sergey
3618
+ *************************************************************************/
3619
+ void linlsqrcreatebuf(const ae_int_t m, const ae_int_t n, linlsqrstate &state, const xparams _xparams = alglib::xdefault);
3620
+
3621
+
3622
+ /*************************************************************************
3623
+ This function changes preconditioning settings of LinLSQQSolveSparse()
3624
+ function. By default, SolveSparse() uses diagonal preconditioner, but if
3625
+ you want to use solver without preconditioning, you can call this function
3626
+ which forces solver to use unit matrix for preconditioning.
3627
+
3628
+ INPUT PARAMETERS:
3629
+ State - structure which stores algorithm state
3630
+
3631
+ -- ALGLIB --
3632
+ Copyright 19.11.2012 by Bochkanov Sergey
3633
+ *************************************************************************/
3634
+ void linlsqrsetprecunit(linlsqrstate &state, const xparams _xparams = alglib::xdefault);
3635
+
3636
+
3637
+ /*************************************************************************
3638
+ This function changes preconditioning settings of LinCGSolveSparse()
3639
+ function. LinCGSolveSparse() will use diagonal of the system matrix as
3640
+ preconditioner. This preconditioning mode is active by default.
3641
+
3642
+ INPUT PARAMETERS:
3643
+ State - structure which stores algorithm state
3644
+
3645
+ -- ALGLIB --
3646
+ Copyright 19.11.2012 by Bochkanov Sergey
3647
+ *************************************************************************/
3648
+ void linlsqrsetprecdiag(linlsqrstate &state, const xparams _xparams = alglib::xdefault);
3649
+
3650
+
3651
+ /*************************************************************************
3652
+ This function sets optional Tikhonov regularization coefficient.
3653
+ It is zero by default.
3654
+
3655
+ INPUT PARAMETERS:
3656
+ LambdaI - regularization factor, LambdaI>=0
3657
+
3658
+ OUTPUT PARAMETERS:
3659
+ State - structure which stores algorithm state
3660
+
3661
+ -- ALGLIB --
3662
+ Copyright 30.11.2011 by Bochkanov Sergey
3663
+ *************************************************************************/
3664
+ void linlsqrsetlambdai(linlsqrstate &state, const double lambdai, const xparams _xparams = alglib::xdefault);
3665
+
3666
+
3667
+ /*************************************************************************
3668
+ Procedure for solution of A*x=b with sparse A.
3669
+
3670
+ INPUT PARAMETERS:
3671
+ State - algorithm state
3672
+ A - sparse M*N matrix in the CRS format (you MUST contvert it
3673
+ to CRS format by calling SparseConvertToCRS() function
3674
+ BEFORE you pass it to this function).
3675
+ B - right part, array[M]
3676
+
3677
+ RESULT:
3678
+ This function returns no result.
3679
+ You can get solution by calling LinCGResults()
3680
+
3681
+ NOTE: this function uses lightweight preconditioning - multiplication by
3682
+ inverse of diag(A). If you want, you can turn preconditioning off by
3683
+ calling LinLSQRSetPrecUnit(). However, preconditioning cost is low
3684
+ and preconditioner is very important for solution of badly scaled
3685
+ problems.
3686
+
3687
+ -- ALGLIB --
3688
+ Copyright 30.11.2011 by Bochkanov Sergey
3689
+ *************************************************************************/
3690
+ void linlsqrsolvesparse(linlsqrstate &state, const sparsematrix &a, const real_1d_array &b, const xparams _xparams = alglib::xdefault);
3691
+
3692
+
3693
+ /*************************************************************************
3694
+ This function sets stopping criteria.
3695
+
3696
+ INPUT PARAMETERS:
3697
+ EpsA - algorithm will be stopped if ||A^T*Rk||/(||A||*||Rk||)<=EpsA.
3698
+ EpsB - algorithm will be stopped if ||Rk||<=EpsB*||B||
3699
+ MaxIts - algorithm will be stopped if number of iterations
3700
+ more than MaxIts.
3701
+
3702
+ OUTPUT PARAMETERS:
3703
+ State - structure which stores algorithm state
3704
+
3705
+ NOTE: if EpsA,EpsB,EpsC and MaxIts are zero then these variables will
3706
+ be setted as default values.
3707
+
3708
+ -- ALGLIB --
3709
+ Copyright 30.11.2011 by Bochkanov Sergey
3710
+ *************************************************************************/
3711
+ void linlsqrsetcond(linlsqrstate &state, const double epsa, const double epsb, const ae_int_t maxits, const xparams _xparams = alglib::xdefault);
3712
+
3713
+
3714
+ /*************************************************************************
3715
+ LSQR solver: results.
3716
+
3717
+ This function must be called after LinLSQRSolve
3718
+
3719
+ INPUT PARAMETERS:
3720
+ State - algorithm state
3721
+
3722
+ OUTPUT PARAMETERS:
3723
+ X - array[N], solution
3724
+ Rep - optimization report:
3725
+ * Rep.TerminationType completetion code:
3726
+ * 1 ||Rk||<=EpsB*||B||
3727
+ * 4 ||A^T*Rk||/(||A||*||Rk||)<=EpsA
3728
+ * 5 MaxIts steps was taken
3729
+ * 7 rounding errors prevent further progress,
3730
+ X contains best point found so far.
3731
+ (sometimes returned on singular systems)
3732
+ * 8 user requested termination via calling
3733
+ linlsqrrequesttermination()
3734
+ * Rep.IterationsCount contains iterations count
3735
+ * NMV countains number of matrix-vector calculations
3736
+
3737
+ -- ALGLIB --
3738
+ Copyright 30.11.2011 by Bochkanov Sergey
3739
+ *************************************************************************/
3740
+ void linlsqrresults(const linlsqrstate &state, real_1d_array &x, linlsqrreport &rep, const xparams _xparams = alglib::xdefault);
3741
+
3742
+
3743
+ /*************************************************************************
3744
+ This function turns on/off reporting.
3745
+
3746
+ INPUT PARAMETERS:
3747
+ State - structure which stores algorithm state
3748
+ NeedXRep- whether iteration reports are needed or not
3749
+
3750
+ If NeedXRep is True, algorithm will call rep() callback function if it is
3751
+ provided to MinCGOptimize().
3752
+
3753
+ -- ALGLIB --
3754
+ Copyright 30.11.2011 by Bochkanov Sergey
3755
+ *************************************************************************/
3756
+ void linlsqrsetxrep(linlsqrstate &state, const bool needxrep, const xparams _xparams = alglib::xdefault);
3757
+
3758
+
3759
+ /*************************************************************************
3760
+ This function is used to peek into LSQR solver and get current iteration
3761
+ counter. You can safely "peek" into the solver from another thread.
3762
+
3763
+ INPUT PARAMETERS:
3764
+ S - solver object
3765
+
3766
+ RESULT:
3767
+ iteration counter, in [0,INF)
3768
+
3769
+ -- ALGLIB --
3770
+ Copyright 21.05.2018 by Bochkanov Sergey
3771
+ *************************************************************************/
3772
+ ae_int_t linlsqrpeekiterationscount(const linlsqrstate &s, const xparams _xparams = alglib::xdefault);
3773
+
3774
+
3775
+ /*************************************************************************
3776
+ This subroutine submits request for termination of the running solver. It
3777
+ can be called from some other thread which wants LSQR solver to terminate
3778
+ (obviously, the thread running LSQR solver can not request termination
3779
+ because it is already busy working on LSQR).
3780
+
3781
+ As result, solver stops at point which was "current accepted" when
3782
+ termination request was submitted and returns error code 8 (successful
3783
+ termination). Such termination is a smooth process which properly
3784
+ deallocates all temporaries.
3785
+
3786
+ INPUT PARAMETERS:
3787
+ State - solver structure
3788
+
3789
+ NOTE: calling this function on solver which is NOT running will have no
3790
+ effect.
3791
+
3792
+ NOTE: multiple calls to this function are possible. First call is counted,
3793
+ subsequent calls are silently ignored.
3794
+
3795
+ NOTE: solver clears termination flag on its start, it means that if some
3796
+ other thread will request termination too soon, its request will went
3797
+ unnoticed.
3798
+
3799
+ -- ALGLIB --
3800
+ Copyright 08.10.2014 by Bochkanov Sergey
3801
+ *************************************************************************/
3802
+ void linlsqrrequesttermination(linlsqrstate &state, const xparams _xparams = alglib::xdefault);
3803
+ #endif
3804
+
3805
+ #if defined(AE_COMPILE_DIRECTSPARSESOLVERS) || !defined(AE_PARTIAL_BUILD)
3806
+ /*************************************************************************
3807
+ Sparse linear solver for A*x=b with N*N sparse real symmetric positive
3808
+ definite matrix A, N*1 vectors x and b.
3809
+
3810
+ This solver converts input matrix to SKS format, performs Cholesky
3811
+ factorization using SKS Cholesky subroutine (works well for limited
3812
+ bandwidth matrices) and uses sparse triangular solvers to get solution of
3813
+ the original system.
3814
+
3815
+ IMPORTANT: this function is intended for low profile (variable band)
3816
+ linear systems with dense or nearly-dense bands. Only in such
3817
+ cases it provides some performance improvement over more
3818
+ general sparsrspdsolve(). If your system has high bandwidth
3819
+ or sparse band, the general sparsrspdsolve() is likely to be
3820
+ more efficient.
3821
+
3822
+ INPUT PARAMETERS
3823
+ A - sparse matrix, must be NxN exactly
3824
+ IsUpper - which half of A is provided (another half is ignored)
3825
+ B - array[0..N-1], right part
3826
+
3827
+ OUTPUT PARAMETERS
3828
+ X - array[N], it contains:
3829
+ * rep.terminationtype>0 => solution
3830
+ * rep.terminationtype=-3 => filled by zeros
3831
+ Rep - solver report, following fields are set:
3832
+ * rep.terminationtype - solver status; >0 for success,
3833
+ set to -3 on failure (degenerate or non-SPD system).
3834
+
3835
+ -- ALGLIB --
3836
+ Copyright 26.12.2017 by Bochkanov Sergey
3837
+ *************************************************************************/
3838
+ void sparsespdsolvesks(const sparsematrix &a, const bool isupper, const real_1d_array &b, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
3839
+
3840
+
3841
+ /*************************************************************************
3842
+ Sparse linear solver for A*x=b with N*N sparse real symmetric positive
3843
+ definite matrix A, N*1 vectors x and b.
3844
+
3845
+ This solver converts input matrix to CRS format, performs Cholesky
3846
+ factorization using supernodal Cholesky decomposition with permutation-
3847
+ reducing ordering and uses sparse triangular solver to get solution of the
3848
+ original system.
3849
+
3850
+ INPUT PARAMETERS
3851
+ A - sparse matrix, must be NxN exactly.
3852
+ Can be stored in any sparse storage format, CRS is preferred.
3853
+ IsUpper - which half of A is provided (another half is ignored).
3854
+ It is better to store the lower triangle because it allows
3855
+ us to avoid one transposition during internal conversion.
3856
+ B - array[N], right part
3857
+
3858
+ OUTPUT PARAMETERS
3859
+ X - array[N], it contains:
3860
+ * rep.terminationtype>0 => solution
3861
+ * rep.terminationtype=-3 => filled by zeros
3862
+ Rep - solver report, following fields are set:
3863
+ * rep.terminationtype - solver status; >0 for success,
3864
+ set to -3 on failure (degenerate or non-SPD system).
3865
+
3866
+ -- ALGLIB --
3867
+ Copyright 26.12.2017 by Bochkanov Sergey
3868
+ *************************************************************************/
3869
+ void sparsespdsolve(const sparsematrix &a, const bool isupper, const real_1d_array &b, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
3870
+
3871
+
3872
+ /*************************************************************************
3873
+ Sparse linear solver for A*x=b with N*N real symmetric positive definite
3874
+ matrix A given by its Cholesky decomposition, and N*1 vectors x and b.
3875
+
3876
+ IMPORTANT: this solver requires input matrix to be in the SKS (Skyline)
3877
+ or CRS (compressed row storage) format. An exception will be
3878
+ generated if you pass matrix in some other format.
3879
+
3880
+ INPUT PARAMETERS
3881
+ A - sparse NxN matrix stored in CRs or SKS format, must be NxN
3882
+ exactly
3883
+ IsUpper - which half of A is provided (another half is ignored)
3884
+ B - array[N], right part
3885
+
3886
+ OUTPUT PARAMETERS
3887
+ X - array[N], it contains:
3888
+ * rep.terminationtype>0 => solution
3889
+ * rep.terminationtype=-3 => filled by zeros
3890
+ Rep - solver report, following fields are set:
3891
+ * rep.terminationtype - solver status; >0 for success,
3892
+ set to -3 on failure (degenerate or non-SPD system).
3893
+
3894
+ -- ALGLIB --
3895
+ Copyright 26.12.2017 by Bochkanov Sergey
3896
+ *************************************************************************/
3897
+ void sparsespdcholeskysolve(const sparsematrix &a, const bool isupper, const real_1d_array &b, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
3898
+
3899
+
3900
+ /*************************************************************************
3901
+ Sparse linear solver for A*x=b with general (nonsymmetric) N*N sparse real
3902
+ matrix A, N*1 vectors x and b.
3903
+
3904
+ This function internally uses several solvers:
3905
+ * supernodal solver with static pivoting applied to a 2N*2N regularized
3906
+ augmented system, followed by iterative refinement. This solver is a
3907
+ recommended option because it provides the best speed and has the lowest
3908
+ memory requirements.
3909
+ * sparse LU with dynamic pivoting for stability. Provides better accuracy
3910
+ at the cost of a significantly lower performance. Recommended only for
3911
+ extremely unstable problems.
3912
+
3913
+ INPUT PARAMETERS
3914
+ A - sparse matrix, must be NxN exactly, any storage format
3915
+ B - array[N], right part
3916
+ SolverType- solver type to use:
3917
+ * 0 use the best solver. It is augmented system in the
3918
+ current version, but may change in future releases
3919
+ * 10 use 'default profile' of the supernodal solver with
3920
+ static pivoting. The 'default' profile is
3921
+ intended for systems with plenty of memory; it is
3922
+ optimized for the best convergence at the cost of
3923
+ increased RAM usage. Recommended option.
3924
+ * 11 use 'limited memory' profile of the supernodal
3925
+ solver with static pivoting. The limited-memory
3926
+ profile is intended for problems with millions of
3927
+ variables. On most systems it has the same
3928
+ convergence as the default profile, having somewhat
3929
+ worse results only for ill-conditioned systems.
3930
+ * 20 use sparse LU with dynamic pivoting for stability.
3931
+ Not intended for large-scale problems.
3932
+
3933
+ OUTPUT PARAMETERS
3934
+ X - array[N], it contains:
3935
+ * rep.terminationtype>0 => solution
3936
+ * rep.terminationtype=-3 => filled by zeros
3937
+ Rep - solver report, following fields are set:
3938
+ * rep.terminationtype - solver status; >0 for success,
3939
+ set to -3 on failure (degenerate system).
3940
+
3941
+ -- ALGLIB --
3942
+ Copyright 18.11.2023 by Bochkanov Sergey
3943
+ *************************************************************************/
3944
+ void sparsesolve(const sparsematrix &a, const real_1d_array &b, const ae_int_t solvertype, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
3945
+ void sparsesolve(const sparsematrix &a, const real_1d_array &b, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
3946
+
3947
+
3948
+ /*************************************************************************
3949
+ Sparse linear least squares solver for A*x=b with general (nonsymmetric)
3950
+ N*N sparse real matrix A, N*1 vectors x and b.
3951
+
3952
+ This function solves a regularized linear least squares problem of the form
3953
+
3954
+ ( )
3955
+ min ( |Ax-b|^2 + reg*|x|^2 ), with reg>=sqrt(MachineAccuracy)
3956
+ ( )
3957
+
3958
+ The function internally uses supernodal solver to solve an augmented-
3959
+ regularized sparse system. The solver, which was initially used to solve
3960
+ sparse square system, can also be used to solve rectangular systems,
3961
+ provided that the system is regularized with regularizing coefficient at
3962
+ least sqrt(MachineAccuracy), which is ~10^8 (double precision).
3963
+
3964
+ It can be used to solve both full rank and rank deficient systems.
3965
+
3966
+ INPUT PARAMETERS
3967
+ A - sparse MxN matrix, any storage format
3968
+ B - array[M], right part
3969
+ Reg - regularization coefficient, Reg>=sqrt(MachineAccuracy),
3970
+ lower values will be silently increased.
3971
+ SolverType- solver type to use:
3972
+ * 0 use the best solver. It is augmented system in the
3973
+ current version, but may change in future releases
3974
+ * 10 use 'default profile' of the supernodal solver with
3975
+ static pivoting. The 'default' profile is
3976
+ intended for systems with plenty of memory; it is
3977
+ optimized for the best convergence at the cost of
3978
+ increased RAM usage. Recommended option.
3979
+ * 11 use 'limited memory' profile of the supernodal
3980
+ solver with static pivoting. The limited-memory
3981
+ profile is intended for problems with millions of
3982
+ variables. On most systems it has the same
3983
+ convergence as the default profile, having somewhat
3984
+ worse results only for ill-conditioned systems.
3985
+
3986
+ OUTPUT PARAMETERS
3987
+ X - array[N], least squares solution
3988
+ Rep - solver report, following fields are set:
3989
+ * rep.terminationtype - solver status; >0 for success.
3990
+
3991
+ Present version of the solver does NOT returns negative
3992
+ completion codes because it does not fail. However,
3993
+ future ALGLIB versions may include solvers which return
3994
+ negative completion codes.
3995
+
3996
+ -- ALGLIB --
3997
+ Copyright 18.11.2023 by Bochkanov Sergey
3998
+ *************************************************************************/
3999
+ void sparsesolvelsreg(const sparsematrix &a, const real_1d_array &b, const double reg, const ae_int_t solvertype, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
4000
+ void sparsesolvelsreg(const sparsematrix &a, const real_1d_array &b, const double reg, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
4001
+
4002
+
4003
+ /*************************************************************************
4004
+ Sparse linear solver for A*x=b with general (nonsymmetric) N*N sparse real
4005
+ matrix A given by its LU factorization, N*1 vectors x and b.
4006
+
4007
+ IMPORTANT: this solver requires input matrix to be in the CRS sparse
4008
+ storage format. An exception will be generated if you pass
4009
+ matrix in some other format (HASH or SKS).
4010
+
4011
+ INPUT PARAMETERS
4012
+ A - LU factorization of the sparse matrix, must be NxN exactly
4013
+ in CRS storage format
4014
+ P, Q - pivot indexes from LU factorization
4015
+ N - size of A, N>0
4016
+ B - array[0..N-1], right part
4017
+
4018
+ OUTPUT PARAMETERS
4019
+ X - array[N], it contains:
4020
+ * rep.terminationtype>0 => solution
4021
+ * rep.terminationtype=-3 => filled by zeros
4022
+ Rep - solver report, following fields are set:
4023
+ * rep.terminationtype - solver status; >0 for success,
4024
+ set to -3 on failure (degenerate system).
4025
+
4026
+ -- ALGLIB --
4027
+ Copyright 26.12.2017 by Bochkanov Sergey
4028
+ *************************************************************************/
4029
+ void sparselusolve(const sparsematrix &a, const integer_1d_array &p, const integer_1d_array &q, const real_1d_array &b, real_1d_array &x, sparsesolverreport &rep, const xparams _xparams = alglib::xdefault);
4030
+ #endif
4031
+
4032
+ #if defined(AE_COMPILE_NLEQ) || !defined(AE_PARTIAL_BUILD)
4033
+ /*************************************************************************
4034
+ LEVENBERG-MARQUARDT-LIKE NONLINEAR SOLVER
4035
+
4036
+ DESCRIPTION:
4037
+ This algorithm solves system of nonlinear equations
4038
+ F[0](x[0], ..., x[n-1]) = 0
4039
+ F[1](x[0], ..., x[n-1]) = 0
4040
+ ...
4041
+ F[M-1](x[0], ..., x[n-1]) = 0
4042
+ with M/N do not necessarily coincide. Algorithm converges quadratically
4043
+ under following conditions:
4044
+ * the solution set XS is nonempty
4045
+ * for some xs in XS there exist such neighbourhood N(xs) that:
4046
+ * vector function F(x) and its Jacobian J(x) are continuously
4047
+ differentiable on N
4048
+ * ||F(x)|| provides local error bound on N, i.e. there exists such
4049
+ c1, that ||F(x)||>c1*distance(x,XS)
4050
+ Note that these conditions are much more weaker than usual non-singularity
4051
+ conditions. For example, algorithm will converge for any affine function
4052
+ F (whether its Jacobian singular or not).
4053
+
4054
+
4055
+ REQUIREMENTS:
4056
+ Algorithm will request following information during its operation:
4057
+ * function vector F[] and Jacobian matrix at given point X
4058
+ * value of merit function f(x)=F[0]^2(x)+...+F[M-1]^2(x) at given point X
4059
+
4060
+
4061
+ USAGE:
4062
+ 1. User initializes algorithm state with NLEQCreateLM() call
4063
+ 2. User tunes solver parameters with NLEQSetCond(), NLEQSetStpMax() and
4064
+ other functions
4065
+ 3. User calls NLEQSolve() function which takes algorithm state and
4066
+ pointers (delegates, etc.) to callback functions which calculate merit
4067
+ function value and Jacobian.
4068
+ 4. User calls NLEQResults() to get solution
4069
+ 5. Optionally, user may call NLEQRestartFrom() to solve another problem
4070
+ with same parameters (N/M) but another starting point and/or another
4071
+ function vector. NLEQRestartFrom() allows to reuse already initialized
4072
+ structure.
4073
+
4074
+
4075
+ INPUT PARAMETERS:
4076
+ N - space dimension, N>1:
4077
+ * if provided, only leading N elements of X are used
4078
+ * if not provided, determined automatically from size of X
4079
+ M - system size
4080
+ X - starting point
4081
+
4082
+
4083
+ OUTPUT PARAMETERS:
4084
+ State - structure which stores algorithm state
4085
+
4086
+
4087
+ NOTES:
4088
+ 1. you may tune stopping conditions with NLEQSetCond() function
4089
+ 2. if target function contains exp() or other fast growing functions, and
4090
+ optimization algorithm makes too large steps which leads to overflow,
4091
+ use NLEQSetStpMax() function to bound algorithm's steps.
4092
+ 3. this algorithm is a slightly modified implementation of the method
4093
+ described in 'Levenberg-Marquardt method for constrained nonlinear
4094
+ equations with strong local convergence properties' by Christian Kanzow
4095
+ Nobuo Yamashita and Masao Fukushima and further developed in 'On the
4096
+ convergence of a New Levenberg-Marquardt Method' by Jin-yan Fan and
4097
+ Ya-Xiang Yuan.
4098
+
4099
+
4100
+ -- ALGLIB --
4101
+ Copyright 20.08.2009 by Bochkanov Sergey
4102
+ *************************************************************************/
4103
+ void nleqcreatelm(const ae_int_t n, const ae_int_t m, const real_1d_array &x, nleqstate &state, const xparams _xparams = alglib::xdefault);
4104
+ void nleqcreatelm(const ae_int_t m, const real_1d_array &x, nleqstate &state, const xparams _xparams = alglib::xdefault);
4105
+
4106
+
4107
+ /*************************************************************************
4108
+ This function sets stopping conditions for the nonlinear solver
4109
+
4110
+ INPUT PARAMETERS:
4111
+ State - structure which stores algorithm state
4112
+ EpsF - >=0
4113
+ The subroutine finishes its work if on k+1-th iteration
4114
+ the condition ||F||<=EpsF is satisfied
4115
+ MaxIts - maximum number of iterations. If MaxIts=0, the number of
4116
+ iterations is unlimited.
4117
+
4118
+ Passing EpsF=0 and MaxIts=0 simultaneously will lead to automatic
4119
+ stopping criterion selection (small EpsF).
4120
+
4121
+ NOTES:
4122
+
4123
+ -- ALGLIB --
4124
+ Copyright 20.08.2010 by Bochkanov Sergey
4125
+ *************************************************************************/
4126
+ void nleqsetcond(nleqstate &state, const double epsf, const ae_int_t maxits, const xparams _xparams = alglib::xdefault);
4127
+
4128
+
4129
+ /*************************************************************************
4130
+ This function turns on/off reporting.
4131
+
4132
+ INPUT PARAMETERS:
4133
+ State - structure which stores algorithm state
4134
+ NeedXRep- whether iteration reports are needed or not
4135
+
4136
+ If NeedXRep is True, algorithm will call rep() callback function if it is
4137
+ provided to NLEQSolve().
4138
+
4139
+ -- ALGLIB --
4140
+ Copyright 20.08.2010 by Bochkanov Sergey
4141
+ *************************************************************************/
4142
+ void nleqsetxrep(nleqstate &state, const bool needxrep, const xparams _xparams = alglib::xdefault);
4143
+
4144
+
4145
+ /*************************************************************************
4146
+ This function sets maximum step length
4147
+
4148
+ INPUT PARAMETERS:
4149
+ State - structure which stores algorithm state
4150
+ StpMax - maximum step length, >=0. Set StpMax to 0.0, if you don't
4151
+ want to limit step length.
4152
+
4153
+ Use this subroutine when target function contains exp() or other fast
4154
+ growing functions, and algorithm makes too large steps which lead to
4155
+ overflow. This function allows us to reject steps that are too large (and
4156
+ therefore expose us to the possible overflow) without actually calculating
4157
+ function value at the x+stp*d.
4158
+
4159
+ -- ALGLIB --
4160
+ Copyright 20.08.2010 by Bochkanov Sergey
4161
+ *************************************************************************/
4162
+ void nleqsetstpmax(nleqstate &state, const double stpmax, const xparams _xparams = alglib::xdefault);
4163
+
4164
+
4165
+ /*************************************************************************
4166
+ This function provides reverse communication interface
4167
+ Reverse communication interface is not documented or recommended to use.
4168
+ See below for functions which provide better documented API
4169
+ *************************************************************************/
4170
+ bool nleqiteration(nleqstate &state, const xparams _xparams = alglib::xdefault);
4171
+
4172
+
4173
+ /*************************************************************************
4174
+ This family of functions is used to launch iterations of nonlinear solver
4175
+
4176
+ These functions accept following parameters:
4177
+ state - algorithm state
4178
+ func - callback which calculates function (or merit function)
4179
+ value func at given point x
4180
+ jac - callback which calculates function vector fi[]
4181
+ and Jacobian jac at given point x
4182
+ rep - optional callback which is called after each iteration
4183
+ can be NULL
4184
+ ptr - optional pointer which is passed to func/grad/hess/jac/rep
4185
+ can be NULL
4186
+
4187
+
4188
+ -- ALGLIB --
4189
+ Copyright 20.03.2009 by Bochkanov Sergey
4190
+
4191
+
4192
+ *************************************************************************/
4193
+ void nleqsolve(nleqstate &state,
4194
+ void (*func)(const real_1d_array &x, double &func, void *ptr),
4195
+ void (*jac)(const real_1d_array &x, real_1d_array &fi, real_2d_array &jac, void *ptr),
4196
+ void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL,
4197
+ void *ptr = NULL,
4198
+ const xparams _xparams = alglib::xdefault);
4199
+
4200
+
4201
+ /*************************************************************************
4202
+ NLEQ solver results
4203
+
4204
+ INPUT PARAMETERS:
4205
+ State - algorithm state.
4206
+
4207
+ OUTPUT PARAMETERS:
4208
+ X - array[0..N-1], solution
4209
+ Rep - optimization report:
4210
+ * Rep.TerminationType completetion code:
4211
+ * -4 ERROR: algorithm has converged to the
4212
+ stationary point Xf which is local minimum of
4213
+ f=F[0]^2+...+F[m-1]^2, but is not solution of
4214
+ nonlinear system.
4215
+ * 1 sqrt(f)<=EpsF.
4216
+ * 5 MaxIts steps was taken
4217
+ * 7 stopping conditions are too stringent,
4218
+ further improvement is impossible
4219
+ * Rep.IterationsCount contains iterations count
4220
+ * NFEV countains number of function calculations
4221
+ * ActiveConstraints contains number of active constraints
4222
+
4223
+ -- ALGLIB --
4224
+ Copyright 20.08.2009 by Bochkanov Sergey
4225
+ *************************************************************************/
4226
+ void nleqresults(const nleqstate &state, real_1d_array &x, nleqreport &rep, const xparams _xparams = alglib::xdefault);
4227
+
4228
+
4229
+ /*************************************************************************
4230
+ NLEQ solver results
4231
+
4232
+ Buffered implementation of NLEQResults(), which uses pre-allocated buffer
4233
+ to store X[]. If buffer size is too small, it resizes buffer. It is
4234
+ intended to be used in the inner cycles of performance critical algorithms
4235
+ where array reallocation penalty is too large to be ignored.
4236
+
4237
+ -- ALGLIB --
4238
+ Copyright 20.08.2009 by Bochkanov Sergey
4239
+ *************************************************************************/
4240
+ void nleqresultsbuf(const nleqstate &state, real_1d_array &x, nleqreport &rep, const xparams _xparams = alglib::xdefault);
4241
+
4242
+
4243
+ /*************************************************************************
4244
+ This subroutine restarts CG algorithm from new point. All optimization
4245
+ parameters are left unchanged.
4246
+
4247
+ This function allows to solve multiple optimization problems (which
4248
+ must have same number of dimensions) without object reallocation penalty.
4249
+
4250
+ INPUT PARAMETERS:
4251
+ State - structure used for reverse communication previously
4252
+ allocated with MinCGCreate call.
4253
+ X - new starting point.
4254
+ BndL - new lower bounds
4255
+ BndU - new upper bounds
4256
+
4257
+ -- ALGLIB --
4258
+ Copyright 30.07.2010 by Bochkanov Sergey
4259
+ *************************************************************************/
4260
+ void nleqrestartfrom(nleqstate &state, const real_1d_array &x, const xparams _xparams = alglib::xdefault);
4261
+ #endif
4262
+ }
4263
+
4264
+ /////////////////////////////////////////////////////////////////////////
4265
+ //
4266
+ // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS)
4267
+ //
4268
+ /////////////////////////////////////////////////////////////////////////
4269
+ namespace alglib_impl
4270
+ {
4271
+ #if defined(AE_COMPILE_POLYNOMIALSOLVER) || !defined(AE_PARTIAL_BUILD)
4272
+ void polynomialsolve(/* Real */ const ae_vector* _a,
4273
+ ae_int_t n,
4274
+ /* Complex */ ae_vector* x,
4275
+ polynomialsolverreport* rep,
4276
+ ae_state *_state);
4277
+ void _polynomialsolverreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
4278
+ void _polynomialsolverreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4279
+ void _polynomialsolverreport_clear(void* _p);
4280
+ void _polynomialsolverreport_destroy(void* _p);
4281
+ #endif
4282
+ #if defined(AE_COMPILE_DIRECTDENSESOLVERS) || !defined(AE_PARTIAL_BUILD)
4283
+ void rmatrixsolve(/* Real */ const ae_matrix* a,
4284
+ ae_int_t n,
4285
+ /* Real */ const ae_vector* b,
4286
+ /* Real */ ae_vector* x,
4287
+ densesolverreport* rep,
4288
+ ae_state *_state);
4289
+ ae_bool rmatrixsolvefast(/* Real */ const ae_matrix* _a,
4290
+ ae_int_t n,
4291
+ /* Real */ ae_vector* b,
4292
+ ae_state *_state);
4293
+ void rmatrixsolvem(/* Real */ const ae_matrix* a,
4294
+ ae_int_t n,
4295
+ /* Real */ const ae_matrix* b,
4296
+ ae_int_t m,
4297
+ ae_bool rfs,
4298
+ /* Real */ ae_matrix* x,
4299
+ densesolverreport* rep,
4300
+ ae_state *_state);
4301
+ ae_bool rmatrixsolvemfast(/* Real */ const ae_matrix* _a,
4302
+ ae_int_t n,
4303
+ /* Real */ ae_matrix* b,
4304
+ ae_int_t m,
4305
+ ae_state *_state);
4306
+ void rmatrixlusolve(/* Real */ const ae_matrix* lua,
4307
+ /* Integer */ const ae_vector* p,
4308
+ ae_int_t n,
4309
+ /* Real */ const ae_vector* b,
4310
+ /* Real */ ae_vector* x,
4311
+ densesolverreport* rep,
4312
+ ae_state *_state);
4313
+ ae_bool rmatrixlusolvefast(/* Real */ const ae_matrix* lua,
4314
+ /* Integer */ const ae_vector* p,
4315
+ ae_int_t n,
4316
+ /* Real */ ae_vector* b,
4317
+ ae_state *_state);
4318
+ void rmatrixlusolvem(/* Real */ const ae_matrix* lua,
4319
+ /* Integer */ const ae_vector* p,
4320
+ ae_int_t n,
4321
+ /* Real */ const ae_matrix* b,
4322
+ ae_int_t m,
4323
+ /* Real */ ae_matrix* x,
4324
+ densesolverreport* rep,
4325
+ ae_state *_state);
4326
+ ae_bool rmatrixlusolvemfast(/* Real */ const ae_matrix* lua,
4327
+ /* Integer */ const ae_vector* p,
4328
+ ae_int_t n,
4329
+ /* Real */ ae_matrix* b,
4330
+ ae_int_t m,
4331
+ ae_state *_state);
4332
+ void rmatrixmixedsolve(/* Real */ const ae_matrix* a,
4333
+ /* Real */ const ae_matrix* lua,
4334
+ /* Integer */ const ae_vector* p,
4335
+ ae_int_t n,
4336
+ /* Real */ const ae_vector* b,
4337
+ /* Real */ ae_vector* x,
4338
+ densesolverreport* rep,
4339
+ ae_state *_state);
4340
+ void rmatrixmixedsolvem(/* Real */ const ae_matrix* a,
4341
+ /* Real */ const ae_matrix* lua,
4342
+ /* Integer */ const ae_vector* p,
4343
+ ae_int_t n,
4344
+ /* Real */ const ae_matrix* b,
4345
+ ae_int_t m,
4346
+ /* Real */ ae_matrix* x,
4347
+ densesolverreport* rep,
4348
+ ae_state *_state);
4349
+ void cmatrixsolvem(/* Complex */ const ae_matrix* a,
4350
+ ae_int_t n,
4351
+ /* Complex */ const ae_matrix* b,
4352
+ ae_int_t m,
4353
+ ae_bool rfs,
4354
+ /* Complex */ ae_matrix* x,
4355
+ densesolverreport* rep,
4356
+ ae_state *_state);
4357
+ ae_bool cmatrixsolvemfast(/* Complex */ const ae_matrix* _a,
4358
+ ae_int_t n,
4359
+ /* Complex */ ae_matrix* b,
4360
+ ae_int_t m,
4361
+ ae_state *_state);
4362
+ void cmatrixsolve(/* Complex */ const ae_matrix* a,
4363
+ ae_int_t n,
4364
+ /* Complex */ const ae_vector* b,
4365
+ /* Complex */ ae_vector* x,
4366
+ densesolverreport* rep,
4367
+ ae_state *_state);
4368
+ ae_bool cmatrixsolvefast(/* Complex */ const ae_matrix* _a,
4369
+ ae_int_t n,
4370
+ /* Complex */ ae_vector* b,
4371
+ ae_state *_state);
4372
+ void cmatrixlusolvem(/* Complex */ const ae_matrix* lua,
4373
+ /* Integer */ const ae_vector* p,
4374
+ ae_int_t n,
4375
+ /* Complex */ const ae_matrix* b,
4376
+ ae_int_t m,
4377
+ /* Complex */ ae_matrix* x,
4378
+ densesolverreport* rep,
4379
+ ae_state *_state);
4380
+ ae_bool cmatrixlusolvemfast(/* Complex */ const ae_matrix* lua,
4381
+ /* Integer */ const ae_vector* p,
4382
+ ae_int_t n,
4383
+ /* Complex */ ae_matrix* b,
4384
+ ae_int_t m,
4385
+ ae_state *_state);
4386
+ void cmatrixlusolve(/* Complex */ const ae_matrix* lua,
4387
+ /* Integer */ const ae_vector* p,
4388
+ ae_int_t n,
4389
+ /* Complex */ const ae_vector* b,
4390
+ /* Complex */ ae_vector* x,
4391
+ densesolverreport* rep,
4392
+ ae_state *_state);
4393
+ ae_bool cmatrixlusolvefast(/* Complex */ const ae_matrix* lua,
4394
+ /* Integer */ const ae_vector* p,
4395
+ ae_int_t n,
4396
+ /* Complex */ ae_vector* b,
4397
+ ae_state *_state);
4398
+ void cmatrixmixedsolvem(/* Complex */ const ae_matrix* a,
4399
+ /* Complex */ const ae_matrix* lua,
4400
+ /* Integer */ const ae_vector* p,
4401
+ ae_int_t n,
4402
+ /* Complex */ const ae_matrix* b,
4403
+ ae_int_t m,
4404
+ /* Complex */ ae_matrix* x,
4405
+ densesolverreport* rep,
4406
+ ae_state *_state);
4407
+ void cmatrixmixedsolve(/* Complex */ const ae_matrix* a,
4408
+ /* Complex */ const ae_matrix* lua,
4409
+ /* Integer */ const ae_vector* p,
4410
+ ae_int_t n,
4411
+ /* Complex */ const ae_vector* b,
4412
+ /* Complex */ ae_vector* x,
4413
+ densesolverreport* rep,
4414
+ ae_state *_state);
4415
+ void spdmatrixsolvem(/* Real */ const ae_matrix* a,
4416
+ ae_int_t n,
4417
+ ae_bool isupper,
4418
+ /* Real */ const ae_matrix* b,
4419
+ ae_int_t m,
4420
+ /* Real */ ae_matrix* x,
4421
+ densesolverreport* rep,
4422
+ ae_state *_state);
4423
+ ae_bool spdmatrixsolvemfast(/* Real */ const ae_matrix* _a,
4424
+ ae_int_t n,
4425
+ ae_bool isupper,
4426
+ /* Real */ ae_matrix* b,
4427
+ ae_int_t m,
4428
+ ae_state *_state);
4429
+ void spdmatrixsolve(/* Real */ const ae_matrix* a,
4430
+ ae_int_t n,
4431
+ ae_bool isupper,
4432
+ /* Real */ const ae_vector* b,
4433
+ /* Real */ ae_vector* x,
4434
+ densesolverreport* rep,
4435
+ ae_state *_state);
4436
+ ae_bool spdmatrixsolvefast(/* Real */ const ae_matrix* _a,
4437
+ ae_int_t n,
4438
+ ae_bool isupper,
4439
+ /* Real */ ae_vector* b,
4440
+ ae_state *_state);
4441
+ void spdmatrixcholeskysolvem(/* Real */ const ae_matrix* cha,
4442
+ ae_int_t n,
4443
+ ae_bool isupper,
4444
+ /* Real */ const ae_matrix* b,
4445
+ ae_int_t m,
4446
+ /* Real */ ae_matrix* x,
4447
+ densesolverreport* rep,
4448
+ ae_state *_state);
4449
+ ae_bool spdmatrixcholeskysolvemfast(/* Real */ const ae_matrix* cha,
4450
+ ae_int_t n,
4451
+ ae_bool isupper,
4452
+ /* Real */ ae_matrix* b,
4453
+ ae_int_t m,
4454
+ ae_state *_state);
4455
+ void spdmatrixcholeskysolve(/* Real */ const ae_matrix* cha,
4456
+ ae_int_t n,
4457
+ ae_bool isupper,
4458
+ /* Real */ const ae_vector* b,
4459
+ /* Real */ ae_vector* x,
4460
+ densesolverreport* rep,
4461
+ ae_state *_state);
4462
+ ae_bool spdmatrixcholeskysolvefast(/* Real */ const ae_matrix* cha,
4463
+ ae_int_t n,
4464
+ ae_bool isupper,
4465
+ /* Real */ ae_vector* b,
4466
+ ae_state *_state);
4467
+ void hpdmatrixsolvem(/* Complex */ const ae_matrix* a,
4468
+ ae_int_t n,
4469
+ ae_bool isupper,
4470
+ /* Complex */ const ae_matrix* b,
4471
+ ae_int_t m,
4472
+ /* Complex */ ae_matrix* x,
4473
+ densesolverreport* rep,
4474
+ ae_state *_state);
4475
+ ae_bool hpdmatrixsolvemfast(/* Complex */ const ae_matrix* _a,
4476
+ ae_int_t n,
4477
+ ae_bool isupper,
4478
+ /* Complex */ ae_matrix* b,
4479
+ ae_int_t m,
4480
+ ae_state *_state);
4481
+ void hpdmatrixsolve(/* Complex */ const ae_matrix* a,
4482
+ ae_int_t n,
4483
+ ae_bool isupper,
4484
+ /* Complex */ const ae_vector* b,
4485
+ /* Complex */ ae_vector* x,
4486
+ densesolverreport* rep,
4487
+ ae_state *_state);
4488
+ ae_bool hpdmatrixsolvefast(/* Complex */ const ae_matrix* _a,
4489
+ ae_int_t n,
4490
+ ae_bool isupper,
4491
+ /* Complex */ ae_vector* b,
4492
+ ae_state *_state);
4493
+ void hpdmatrixcholeskysolvem(/* Complex */ const ae_matrix* cha,
4494
+ ae_int_t n,
4495
+ ae_bool isupper,
4496
+ /* Complex */ const ae_matrix* b,
4497
+ ae_int_t m,
4498
+ /* Complex */ ae_matrix* x,
4499
+ densesolverreport* rep,
4500
+ ae_state *_state);
4501
+ ae_bool hpdmatrixcholeskysolvemfast(/* Complex */ const ae_matrix* cha,
4502
+ ae_int_t n,
4503
+ ae_bool isupper,
4504
+ /* Complex */ ae_matrix* b,
4505
+ ae_int_t m,
4506
+ ae_state *_state);
4507
+ void hpdmatrixcholeskysolve(/* Complex */ const ae_matrix* cha,
4508
+ ae_int_t n,
4509
+ ae_bool isupper,
4510
+ /* Complex */ const ae_vector* b,
4511
+ /* Complex */ ae_vector* x,
4512
+ densesolverreport* rep,
4513
+ ae_state *_state);
4514
+ ae_bool hpdmatrixcholeskysolvefast(/* Complex */ const ae_matrix* cha,
4515
+ ae_int_t n,
4516
+ ae_bool isupper,
4517
+ /* Complex */ ae_vector* b,
4518
+ ae_state *_state);
4519
+ void rmatrixsolvels(/* Real */ const ae_matrix* a,
4520
+ ae_int_t nrows,
4521
+ ae_int_t ncols,
4522
+ /* Real */ const ae_vector* b,
4523
+ double threshold,
4524
+ /* Real */ ae_vector* x,
4525
+ densesolverlsreport* rep,
4526
+ ae_state *_state);
4527
+ void _densesolverreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
4528
+ void _densesolverreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4529
+ void _densesolverreport_clear(void* _p);
4530
+ void _densesolverreport_destroy(void* _p);
4531
+ void _densesolverlsreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
4532
+ void _densesolverlsreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4533
+ void _densesolverlsreport_clear(void* _p);
4534
+ void _densesolverlsreport_destroy(void* _p);
4535
+ #endif
4536
+ #if defined(AE_COMPILE_ITERATIVESPARSE) || !defined(AE_PARTIAL_BUILD)
4537
+ void sparsesolvesymmetricgmres(const sparsematrix* a,
4538
+ ae_bool isupper,
4539
+ /* Real */ const ae_vector* b,
4540
+ ae_int_t k,
4541
+ double epsf,
4542
+ ae_int_t maxits,
4543
+ /* Real */ ae_vector* x,
4544
+ sparsesolverreport* rep,
4545
+ ae_state *_state);
4546
+ void sparsesolvegmres(const sparsematrix* a,
4547
+ /* Real */ const ae_vector* b,
4548
+ ae_int_t k,
4549
+ double epsf,
4550
+ ae_int_t maxits,
4551
+ /* Real */ ae_vector* x,
4552
+ sparsesolverreport* rep,
4553
+ ae_state *_state);
4554
+ void sparsesolvercreate(ae_int_t n,
4555
+ sparsesolverstate* state,
4556
+ ae_state *_state);
4557
+ void sparsesolversetalgogmres(sparsesolverstate* state,
4558
+ ae_int_t k,
4559
+ ae_state *_state);
4560
+ void sparsesolversetstartingpoint(sparsesolverstate* state,
4561
+ /* Real */ const ae_vector* x,
4562
+ ae_state *_state);
4563
+ void sparsesolversetcond(sparsesolverstate* state,
4564
+ double epsf,
4565
+ ae_int_t maxits,
4566
+ ae_state *_state);
4567
+ void sparsesolversolvesymmetric(sparsesolverstate* state,
4568
+ const sparsematrix* a,
4569
+ ae_bool isupper,
4570
+ /* Real */ const ae_vector* b,
4571
+ ae_state *_state);
4572
+ void sparsesolversolve(sparsesolverstate* state,
4573
+ const sparsematrix* a,
4574
+ /* Real */ const ae_vector* b,
4575
+ ae_state *_state);
4576
+ void sparsesolverresults(sparsesolverstate* state,
4577
+ /* Real */ ae_vector* x,
4578
+ sparsesolverreport* rep,
4579
+ ae_state *_state);
4580
+ void sparsesolversetxrep(sparsesolverstate* state,
4581
+ ae_bool needxrep,
4582
+ ae_state *_state);
4583
+ void sparsesolveroocstart(sparsesolverstate* state,
4584
+ /* Real */ const ae_vector* b,
4585
+ ae_state *_state);
4586
+ ae_bool sparsesolverooccontinue(sparsesolverstate* state,
4587
+ ae_state *_state);
4588
+ void sparsesolveroocgetrequestinfo(sparsesolverstate* state,
4589
+ ae_int_t* requesttype,
4590
+ ae_state *_state);
4591
+ void sparsesolveroocgetrequestdata(sparsesolverstate* state,
4592
+ /* Real */ ae_vector* x,
4593
+ ae_state *_state);
4594
+ void sparsesolveroocgetrequestdata1(sparsesolverstate* state,
4595
+ double* v,
4596
+ ae_state *_state);
4597
+ void sparsesolveroocsendresult(sparsesolverstate* state,
4598
+ /* Real */ const ae_vector* ax,
4599
+ ae_state *_state);
4600
+ void sparsesolveroocstop(sparsesolverstate* state,
4601
+ /* Real */ ae_vector* x,
4602
+ sparsesolverreport* rep,
4603
+ ae_state *_state);
4604
+ void sparsesolverrequesttermination(sparsesolverstate* state,
4605
+ ae_state *_state);
4606
+ void initsparsesolverreport(sparsesolverreport* rep, ae_state *_state);
4607
+ void _sparsesolverreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
4608
+ void _sparsesolverreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4609
+ void _sparsesolverreport_clear(void* _p);
4610
+ void _sparsesolverreport_destroy(void* _p);
4611
+ void _sparsesolverstate_init(void* _p, ae_state *_state, ae_bool make_automatic);
4612
+ void _sparsesolverstate_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4613
+ void _sparsesolverstate_clear(void* _p);
4614
+ void _sparsesolverstate_destroy(void* _p);
4615
+ #endif
4616
+ #if defined(AE_COMPILE_LINCG) || !defined(AE_PARTIAL_BUILD)
4617
+ void lincgcreate(ae_int_t n, lincgstate* state, ae_state *_state);
4618
+ void lincgsetstartingpoint(lincgstate* state,
4619
+ /* Real */ const ae_vector* x,
4620
+ ae_state *_state);
4621
+ void lincgsetb(lincgstate* state,
4622
+ /* Real */ const ae_vector* b,
4623
+ ae_state *_state);
4624
+ void lincgsetprecunit(lincgstate* state, ae_state *_state);
4625
+ void lincgsetprecdiag(lincgstate* state, ae_state *_state);
4626
+ void lincgsetcond(lincgstate* state,
4627
+ double epsf,
4628
+ ae_int_t maxits,
4629
+ ae_state *_state);
4630
+ ae_bool lincgiteration(lincgstate* state, ae_state *_state);
4631
+ void lincgsolvesparse(lincgstate* state,
4632
+ const sparsematrix* a,
4633
+ ae_bool isupper,
4634
+ /* Real */ const ae_vector* b,
4635
+ ae_state *_state);
4636
+ void lincgresults(const lincgstate* state,
4637
+ /* Real */ ae_vector* x,
4638
+ lincgreport* rep,
4639
+ ae_state *_state);
4640
+ void lincgsetrestartfreq(lincgstate* state,
4641
+ ae_int_t srf,
4642
+ ae_state *_state);
4643
+ void lincgsetrupdatefreq(lincgstate* state,
4644
+ ae_int_t freq,
4645
+ ae_state *_state);
4646
+ void lincgsetxrep(lincgstate* state, ae_bool needxrep, ae_state *_state);
4647
+ void lincgrestart(lincgstate* state, ae_state *_state);
4648
+ void _lincgstate_init(void* _p, ae_state *_state, ae_bool make_automatic);
4649
+ void _lincgstate_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4650
+ void _lincgstate_clear(void* _p);
4651
+ void _lincgstate_destroy(void* _p);
4652
+ void _lincgreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
4653
+ void _lincgreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4654
+ void _lincgreport_clear(void* _p);
4655
+ void _lincgreport_destroy(void* _p);
4656
+ #endif
4657
+ #if defined(AE_COMPILE_LINLSQR) || !defined(AE_PARTIAL_BUILD)
4658
+ void linlsqrcreate(ae_int_t m,
4659
+ ae_int_t n,
4660
+ linlsqrstate* state,
4661
+ ae_state *_state);
4662
+ void linlsqrcreatebuf(ae_int_t m,
4663
+ ae_int_t n,
4664
+ linlsqrstate* state,
4665
+ ae_state *_state);
4666
+ void linlsqrsetb(linlsqrstate* state,
4667
+ /* Real */ const ae_vector* b,
4668
+ ae_state *_state);
4669
+ void linlsqrsetprecunit(linlsqrstate* state, ae_state *_state);
4670
+ void linlsqrsetprecdiag(linlsqrstate* state, ae_state *_state);
4671
+ void linlsqrsetlambdai(linlsqrstate* state,
4672
+ double lambdai,
4673
+ ae_state *_state);
4674
+ ae_bool linlsqriteration(linlsqrstate* state, ae_state *_state);
4675
+ void linlsqrsolvesparse(linlsqrstate* state,
4676
+ const sparsematrix* a,
4677
+ /* Real */ const ae_vector* b,
4678
+ ae_state *_state);
4679
+ void linlsqrsetcond(linlsqrstate* state,
4680
+ double epsa,
4681
+ double epsb,
4682
+ ae_int_t maxits,
4683
+ ae_state *_state);
4684
+ void linlsqrresults(const linlsqrstate* state,
4685
+ /* Real */ ae_vector* x,
4686
+ linlsqrreport* rep,
4687
+ ae_state *_state);
4688
+ void linlsqrsetxrep(linlsqrstate* state,
4689
+ ae_bool needxrep,
4690
+ ae_state *_state);
4691
+ void linlsqrrestart(linlsqrstate* state, ae_state *_state);
4692
+ ae_int_t linlsqrpeekiterationscount(const linlsqrstate* s,
4693
+ ae_state *_state);
4694
+ void linlsqrrequesttermination(linlsqrstate* state, ae_state *_state);
4695
+ void _linlsqrstate_init(void* _p, ae_state *_state, ae_bool make_automatic);
4696
+ void _linlsqrstate_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4697
+ void _linlsqrstate_clear(void* _p);
4698
+ void _linlsqrstate_destroy(void* _p);
4699
+ void _linlsqrreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
4700
+ void _linlsqrreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4701
+ void _linlsqrreport_clear(void* _p);
4702
+ void _linlsqrreport_destroy(void* _p);
4703
+ #endif
4704
+ #if defined(AE_COMPILE_DIRECTSPARSESOLVERS) || !defined(AE_PARTIAL_BUILD)
4705
+ void sparsespdsolvesks(const sparsematrix* a,
4706
+ ae_bool isupper,
4707
+ /* Real */ const ae_vector* b,
4708
+ /* Real */ ae_vector* x,
4709
+ sparsesolverreport* rep,
4710
+ ae_state *_state);
4711
+ void sparsespdsolve(const sparsematrix* a,
4712
+ ae_bool isupper,
4713
+ /* Real */ const ae_vector* b,
4714
+ /* Real */ ae_vector* x,
4715
+ sparsesolverreport* rep,
4716
+ ae_state *_state);
4717
+ void sparsespdcholeskysolve(const sparsematrix* a,
4718
+ ae_bool isupper,
4719
+ /* Real */ const ae_vector* b,
4720
+ /* Real */ ae_vector* x,
4721
+ sparsesolverreport* rep,
4722
+ ae_state *_state);
4723
+ void sparsesolve(const sparsematrix* a,
4724
+ /* Real */ const ae_vector* b,
4725
+ ae_int_t solvertype,
4726
+ /* Real */ ae_vector* x,
4727
+ sparsesolverreport* rep,
4728
+ ae_state *_state);
4729
+ void sparsesolvelsreg(const sparsematrix* a,
4730
+ /* Real */ const ae_vector* b,
4731
+ double reg,
4732
+ ae_int_t solvertype,
4733
+ /* Real */ ae_vector* x,
4734
+ sparsesolverreport* rep,
4735
+ ae_state *_state);
4736
+ void sparselusolve(const sparsematrix* a,
4737
+ /* Integer */ const ae_vector* p,
4738
+ /* Integer */ const ae_vector* q,
4739
+ /* Real */ const ae_vector* b,
4740
+ /* Real */ ae_vector* x,
4741
+ sparsesolverreport* rep,
4742
+ ae_state *_state);
4743
+ #endif
4744
+ #if defined(AE_COMPILE_NLEQ) || !defined(AE_PARTIAL_BUILD)
4745
+ void nleqcreatelm(ae_int_t n,
4746
+ ae_int_t m,
4747
+ /* Real */ const ae_vector* x,
4748
+ nleqstate* state,
4749
+ ae_state *_state);
4750
+ void nleqsetcond(nleqstate* state,
4751
+ double epsf,
4752
+ ae_int_t maxits,
4753
+ ae_state *_state);
4754
+ void nleqsetxrep(nleqstate* state, ae_bool needxrep, ae_state *_state);
4755
+ void nleqsetstpmax(nleqstate* state, double stpmax, ae_state *_state);
4756
+ ae_bool nleqiteration(nleqstate* state, ae_state *_state);
4757
+ void nleqresults(const nleqstate* state,
4758
+ /* Real */ ae_vector* x,
4759
+ nleqreport* rep,
4760
+ ae_state *_state);
4761
+ void nleqresultsbuf(const nleqstate* state,
4762
+ /* Real */ ae_vector* x,
4763
+ nleqreport* rep,
4764
+ ae_state *_state);
4765
+ void nleqrestartfrom(nleqstate* state,
4766
+ /* Real */ const ae_vector* x,
4767
+ ae_state *_state);
4768
+ void nleqsetprotocolv1(nleqstate* state, ae_state *_state);
4769
+ void _nleqstate_init(void* _p, ae_state *_state, ae_bool make_automatic);
4770
+ void _nleqstate_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4771
+ void _nleqstate_clear(void* _p);
4772
+ void _nleqstate_destroy(void* _p);
4773
+ void _nleqreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
4774
+ void _nleqreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
4775
+ void _nleqreport_clear(void* _p);
4776
+ void _nleqreport_destroy(void* _p);
4777
+ #endif
4778
+
4779
+ }
4780
+ #endif
4781
+