Class documentation of Concepts

Loading...
Searching...
No Matches
solvers.h
1/*************************************************************************
2ALGLIB 3.11.0 (source code generated 2017-05-11)
3Copyright (c) Sergey Bochkanov (ALGLIB project).
4
5>>> SOURCE LICENSE >>>
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation (www.fsf.org); either version 2 of the
9License, or (at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16A copy of the GNU General Public License is available at
17http://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 "linalg.h"
25#include "alglibmisc.h"
26
28//
29// THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (DATATYPES)
30//
32namespace alglib_impl
33{
34typedef struct
35{
36 double r1;
37 double rinf;
39typedef struct
40{
41 double r2;
42 ae_matrix cx;
43 ae_int_t n;
44 ae_int_t k;
46typedef struct
47{
49 ae_vector rx;
50 ae_vector b;
51 ae_int_t n;
52 ae_int_t m;
53 ae_int_t prectype;
54 ae_vector ui;
55 ae_vector uip1;
56 ae_vector vi;
57 ae_vector vip1;
58 ae_vector omegai;
59 ae_vector omegaip1;
60 double alphai;
61 double alphaip1;
62 double betai;
63 double betaip1;
64 double phibari;
65 double phibarip1;
66 double phii;
67 double rhobari;
68 double rhobarip1;
69 double rhoi;
70 double ci;
71 double si;
72 double theta;
73 double lambdai;
74 ae_vector d;
75 double anorm;
76 double bnorm2;
77 double dnorm;
78 double r2;
79 ae_vector x;
80 ae_vector mv;
81 ae_vector mtv;
82 double epsa;
83 double epsb;
84 double epsc;
85 ae_int_t maxits;
86 ae_bool xrep;
87 ae_bool xupdated;
88 ae_bool needmv;
89 ae_bool needmtv;
90 ae_bool needmv2;
91 ae_bool needvmv;
92 ae_bool needprec;
93 ae_int_t repiterationscount;
94 ae_int_t repnmv;
95 ae_int_t repterminationtype;
96 ae_bool running;
97 ae_vector tmpd;
98 ae_vector tmpx;
99 rcommstate rstate;
101typedef struct
102{
103 ae_int_t iterationscount;
104 ae_int_t nmv;
105 ae_int_t terminationtype;
107typedef struct
108{
109 double maxerr;
111typedef struct
112{
113 ae_int_t n;
114 ae_int_t m;
115 double epsf;
116 ae_int_t maxits;
117 ae_bool xrep;
118 double stpmax;
119 ae_vector x;
120 double f;
121 ae_vector fi;
122 ae_matrix j;
123 ae_bool needf;
124 ae_bool needfij;
125 ae_bool xupdated;
126 rcommstate rstate;
127 ae_int_t repiterationscount;
128 ae_int_t repnfunc;
129 ae_int_t repnjac;
130 ae_int_t repterminationtype;
131 ae_vector xbase;
132 double fbase;
133 double fprev;
134 ae_vector candstep;
135 ae_vector rightpart;
136 ae_vector cgbuf;
137} nleqstate;
138typedef struct
139{
140 ae_int_t iterationscount;
141 ae_int_t nfunc;
142 ae_int_t njac;
143 ae_int_t terminationtype;
144} nleqreport;
145typedef struct
146{
147 ae_vector rx;
148 ae_vector b;
149 ae_int_t n;
150 ae_int_t prectype;
151 ae_vector cx;
152 ae_vector cr;
153 ae_vector cz;
154 ae_vector p;
155 ae_vector r;
156 ae_vector z;
157 double alpha;
158 double beta;
159 double r2;
160 double meritfunction;
161 ae_vector x;
162 ae_vector mv;
163 ae_vector pv;
164 double vmv;
165 ae_vector startx;
166 double epsf;
167 ae_int_t maxits;
168 ae_int_t itsbeforerestart;
169 ae_int_t itsbeforerupdate;
170 ae_bool xrep;
171 ae_bool xupdated;
172 ae_bool needmv;
173 ae_bool needmtv;
174 ae_bool needmv2;
175 ae_bool needvmv;
176 ae_bool needprec;
177 ae_int_t repiterationscount;
178 ae_int_t repnmv;
179 ae_int_t repterminationtype;
180 ae_bool running;
181 ae_vector tmpd;
182 rcommstate rstate;
183} lincgstate;
184typedef struct
185{
186 ae_int_t iterationscount;
187 ae_int_t nmv;
188 ae_int_t terminationtype;
189 double r2;
191
192}
193
195//
196// THIS SECTION CONTAINS C++ INTERFACE
197//
199namespace alglib
200{
201
202/*************************************************************************
203
204*************************************************************************/
218{
219public:
222 densesolverreport& operator=(const densesolverreport &rhs);
223 virtual ~densesolverreport();
224 double &r1;
225 double &rinf;
226
227};
228
229
230/*************************************************************************
231
232*************************************************************************/
246{
247public:
250 densesolverlsreport& operator=(const densesolverlsreport &rhs);
251 virtual ~densesolverlsreport();
252 double &r2;
253 real_2d_array cx;
254 ae_int_t &n;
255 ae_int_t &k;
256
257};
258
259/*************************************************************************
260This object stores state of the LinLSQR method.
261
262You should use ALGLIB functions to work with this object.
263*************************************************************************/
265{
266public:
269 _linlsqrstate_owner& operator=(const _linlsqrstate_owner &rhs);
270 virtual ~_linlsqrstate_owner();
272 alglib_impl::linlsqrstate* c_ptr() const;
273protected:
275};
277{
278public:
279 linlsqrstate();
280 linlsqrstate(const linlsqrstate &rhs);
281 linlsqrstate& operator=(const linlsqrstate &rhs);
282 virtual ~linlsqrstate();
283
284};
285
286
287/*************************************************************************
288
289*************************************************************************/
291{
292public:
295 _linlsqrreport_owner& operator=(const _linlsqrreport_owner &rhs);
296 virtual ~_linlsqrreport_owner();
298 alglib_impl::linlsqrreport* c_ptr() const;
299protected:
301};
303{
304public:
306 linlsqrreport(const linlsqrreport &rhs);
307 linlsqrreport& operator=(const linlsqrreport &rhs);
308 virtual ~linlsqrreport();
309 ae_int_t &iterationscount;
310 ae_int_t &nmv;
311 ae_int_t &terminationtype;
312
313};
314
315/*************************************************************************
316
317*************************************************************************/
331{
332public:
335 polynomialsolverreport& operator=(const polynomialsolverreport &rhs);
336 virtual ~polynomialsolverreport();
337 double &maxerr;
338
339};
340
341/*************************************************************************
342
343*************************************************************************/
345{
346public:
349 _nleqstate_owner& operator=(const _nleqstate_owner &rhs);
350 virtual ~_nleqstate_owner();
351 alglib_impl::nleqstate* c_ptr();
352 alglib_impl::nleqstate* c_ptr() const;
353protected:
354 alglib_impl::nleqstate *p_struct;
355};
357{
358public:
359 nleqstate();
360 nleqstate(const nleqstate &rhs);
361 nleqstate& operator=(const nleqstate &rhs);
362 virtual ~nleqstate();
363 ae_bool &needf;
364 ae_bool &needfij;
365 ae_bool &xupdated;
366 double &f;
367 real_1d_array fi;
370
371};
372
373
374/*************************************************************************
375
376*************************************************************************/
378{
379public:
382 _nleqreport_owner& operator=(const _nleqreport_owner &rhs);
383 virtual ~_nleqreport_owner();
385 alglib_impl::nleqreport* c_ptr() const;
386protected:
387 alglib_impl::nleqreport *p_struct;
388};
390{
391public:
392 nleqreport();
393 nleqreport(const nleqreport &rhs);
394 nleqreport& operator=(const nleqreport &rhs);
395 virtual ~nleqreport();
396 ae_int_t &iterationscount;
397 ae_int_t &nfunc;
398 ae_int_t &njac;
399 ae_int_t &terminationtype;
400
401};
402
403/*************************************************************************
404This object stores state of the linear CG method.
405
406You should use ALGLIB functions to work with this object.
407Never try to access its fields directly!
408*************************************************************************/
410{
411public:
414 _lincgstate_owner& operator=(const _lincgstate_owner &rhs);
415 virtual ~_lincgstate_owner();
417 alglib_impl::lincgstate* c_ptr() const;
418protected:
419 alglib_impl::lincgstate *p_struct;
420};
422{
423public:
424 lincgstate();
425 lincgstate(const lincgstate &rhs);
426 lincgstate& operator=(const lincgstate &rhs);
427 virtual ~lincgstate();
428
429};
430
431
432/*************************************************************************
433
434*************************************************************************/
436{
437public:
440 _lincgreport_owner& operator=(const _lincgreport_owner &rhs);
441 virtual ~_lincgreport_owner();
443 alglib_impl::lincgreport* c_ptr() const;
444protected:
445 alglib_impl::lincgreport *p_struct;
446};
448{
449public:
450 lincgreport();
451 lincgreport(const lincgreport &rhs);
452 lincgreport& operator=(const lincgreport &rhs);
453 virtual ~lincgreport();
454 ae_int_t &iterationscount;
455 ae_int_t &nmv;
456 ae_int_t &terminationtype;
457 double &r2;
458
459};
460
461/*************************************************************************
462Dense solver for A*x=b with N*N real matrix A and N*1 real vectorx x and
463b. This is "slow-but-feature rich" version of the linear solver. Faster
464version is RMatrixSolveFast() function.
465
466Algorithm features:
467* automatic detection of degenerate cases
468* condition number estimation
469* iterative refinement
470* O(N^3) complexity
471
472IMPORTANT: ! this function is NOT the most efficient linear solver provided
473 ! by ALGLIB. It estimates condition number of linear system
474 ! and performs iterative refinement, which results in
475 ! significant performance penalty when compared with "fast"
476 ! version which just performs LU decomposition and calls
477 ! triangular solver.
478 !
479 ! This performance penalty is especially visible in the
480 ! multithreaded mode, because both condition number estimation
481 ! and iterative refinement are inherently sequential
482 ! calculations. It also very significant on small matrices.
483 !
484 ! Thus, if you need high performance and if you are pretty sure
485 ! that your system is well conditioned, we strongly recommend
486 ! you to use faster solver, RMatrixSolveFast() function.
487
488COMMERCIAL EDITION OF ALGLIB:
489
490 ! Commercial version of ALGLIB includes two important improvements of
491 ! this function, which can be used from C++ and C#:
492 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
493 ! * multicore support
494 !
495 ! Intel MKL gives approximately constant (with respect to number of
496 ! worker threads) acceleration factor which depends on CPU being used,
497 ! problem size and "baseline" ALGLIB edition which is used for
498 ! comparison.
499 !
500 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
501 ! * about 2-3x faster than ALGLIB for C++ without MKL
502 ! * about 7-10x faster than "pure C#" edition of ALGLIB
503 ! Difference in performance will be more striking on newer CPU's with
504 ! support for newer SIMD instructions. Generally, MKL accelerates any
505 ! problem whose size is at least 128, with best efficiency achieved for
506 ! N's larger than 512.
507 !
508 ! Commercial edition of ALGLIB also supports multithreaded acceleration
509 ! of this function. We should note that LU decomposition is harder to
510 ! parallelize than, say, matrix-matrix product - this algorithm has
511 ! many internal synchronization points which can not be avoided. However
512 ! parallelism starts to be profitable starting from N=1024, achieving
513 ! near-linear speedup for N=4096 or higher.
514 !
515 ! In order to use multicore features you have to:
516 ! * use commercial version of ALGLIB
517 ! * call this function with "smp_" prefix, which indicates that
518 ! multicore code will be used (for multicore support)
519 !
520 ! We recommend you to read 'Working with commercial version' section of
521 ! ALGLIB Reference Manual in order to find out how to use performance-
522 ! related features provided by commercial edition of ALGLIB.
523
524INPUT PARAMETERS
525 A - array[0..N-1,0..N-1], system matrix
526 N - size of A
527 B - array[0..N-1], right part
528
529OUTPUT PARAMETERS
530 Info - return code:
531 * -3 matrix is very badly conditioned or exactly singular.
532 * -1 N<=0 was passed
533 * 1 task is solved (but matrix A may be ill-conditioned,
534 check R1/RInf parameters for condition numbers).
535 Rep - additional report, following fields are set:
536 * rep.r1 condition number in 1-norm
537 * rep.rinf condition number in inf-norm
538 X - array[N], it contains:
539 * info>0 => solution
540 * info=-3 => filled by zeros
541
542 -- ALGLIB --
543 Copyright 27.01.2010 by Bochkanov Sergey
544*************************************************************************/
545void rmatrixsolve(const real_2d_array &a, const ae_int_t n, const real_1d_array &b, ae_int_t &info, densesolverreport &rep, real_1d_array &x);
546void smp_rmatrixsolve(const real_2d_array &a, const ae_int_t n, const real_1d_array &b, ae_int_t &info, densesolverreport &rep, real_1d_array &x);
547
548
549/*************************************************************************
550Dense solver.
551
552This subroutine solves a system A*x=b, where A is NxN non-denegerate
553real matrix, x and b are vectors. This is a "fast" version of linear
554solver which does NOT provide any additional functions like condition
555number estimation or iterative refinement.
556
557Algorithm features:
558* efficient algorithm O(N^3) complexity
559* no performance overhead from additional functionality
560
561If you need condition number estimation or iterative refinement, use more
562feature-rich version - RMatrixSolve().
563
564COMMERCIAL EDITION OF ALGLIB:
565
566 ! Commercial version of ALGLIB includes two important improvements of
567 ! this function, which can be used from C++ and C#:
568 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
569 ! * multicore support
570 !
571 ! Intel MKL gives approximately constant (with respect to number of
572 ! worker threads) acceleration factor which depends on CPU being used,
573 ! problem size and "baseline" ALGLIB edition which is used for
574 ! comparison.
575 !
576 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
577 ! * about 2-3x faster than ALGLIB for C++ without MKL
578 ! * about 7-10x faster than "pure C#" edition of ALGLIB
579 ! Difference in performance will be more striking on newer CPU's with
580 ! support for newer SIMD instructions. Generally, MKL accelerates any
581 ! problem whose size is at least 128, with best efficiency achieved for
582 ! N's larger than 512.
583 !
584 ! Commercial edition of ALGLIB also supports multithreaded acceleration
585 ! of this function. We should note that LU decomposition is harder to
586 ! parallelize than, say, matrix-matrix product - this algorithm has
587 ! many internal synchronization points which can not be avoided. However
588 ! parallelism starts to be profitable starting from N=1024, achieving
589 ! near-linear speedup for N=4096 or higher.
590 !
591 ! In order to use multicore features you have to:
592 ! * use commercial version of ALGLIB
593 ! * call this function with "smp_" prefix, which indicates that
594 ! multicore code will be used (for multicore support)
595 !
596 ! We recommend you to read 'Working with commercial version' section of
597 ! ALGLIB Reference Manual in order to find out how to use performance-
598 ! related features provided by commercial edition of ALGLIB.
599
600INPUT PARAMETERS
601 A - array[0..N-1,0..N-1], system matrix
602 N - size of A
603 B - array[0..N-1], right part
604
605OUTPUT PARAMETERS
606 Info - return code:
607 * -3 matrix is exactly singular (ill conditioned matrices
608 are not recognized).
609 * -1 N<=0 was passed
610 * 1 task is solved
611 B - array[N]:
612 * info>0 => overwritten by solution
613 * info=-3 => filled by zeros
614
615 -- ALGLIB --
616 Copyright 16.03.2015 by Bochkanov Sergey
617*************************************************************************/
618void rmatrixsolvefast(const real_2d_array &a, const ae_int_t n, const real_1d_array &b, ae_int_t &info);
619void smp_rmatrixsolvefast(const real_2d_array &a, const ae_int_t n, const real_1d_array &b, ae_int_t &info);
620
621
622/*************************************************************************
623Dense solver.
624
625Similar to RMatrixSolve() but solves task with multiple right parts (where
626b and x are NxM matrices). This is "slow-but-robust" version of linear
627solver with additional functionality like condition number estimation.
628There also exists faster version - RMatrixSolveMFast().
629
630Algorithm features:
631* automatic detection of degenerate cases
632* condition number estimation
633* optional iterative refinement
634* O(N^3+M*N^2) complexity
635
636IMPORTANT: ! this function is NOT the most efficient linear solver provided
637 ! by ALGLIB. It estimates condition number of linear system
638 ! and performs iterative refinement, which results in
639 ! significant performance penalty when compared with "fast"
640 ! version which just performs LU decomposition and calls
641 ! triangular solver.
642 !
643 ! This performance penalty is especially visible in the
644 ! multithreaded mode, because both condition number estimation
645 ! and iterative refinement are inherently sequential
646 ! calculations. It also very significant on small matrices.
647 !
648 ! Thus, if you need high performance and if you are pretty sure
649 ! that your system is well conditioned, we strongly recommend
650 ! you to use faster solver, RMatrixSolveMFast() function.
651
652COMMERCIAL EDITION OF ALGLIB:
653
654 ! Commercial version of ALGLIB includes two important improvements of
655 ! this function, which can be used from C++ and C#:
656 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
657 ! * multicore support
658 !
659 ! Intel MKL gives approximately constant (with respect to number of
660 ! worker threads) acceleration factor which depends on CPU being used,
661 ! problem size and "baseline" ALGLIB edition which is used for
662 ! comparison.
663 !
664 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
665 ! * about 2-3x faster than ALGLIB for C++ without MKL
666 ! * about 7-10x faster than "pure C#" edition of ALGLIB
667 ! Difference in performance will be more striking on newer CPU's with
668 ! support for newer SIMD instructions. Generally, MKL accelerates any
669 ! problem whose size is at least 128, with best efficiency achieved for
670 ! N's larger than 512.
671 !
672 ! Commercial edition of ALGLIB also supports multithreaded acceleration
673 ! of this function. We should note that LU decomposition is harder to
674 ! parallelize than, say, matrix-matrix product - this algorithm has
675 ! many internal synchronization points which can not be avoided. However
676 ! parallelism starts to be profitable starting from N=1024, achieving
677 ! near-linear speedup for N=4096 or higher.
678 !
679 ! In order to use multicore features you have to:
680 ! * use commercial version of ALGLIB
681 ! * call this function with "smp_" prefix, which indicates that
682 ! multicore code will be used (for multicore support)
683 !
684 ! We recommend you to read 'Working with commercial version' section of
685 ! ALGLIB Reference Manual in order to find out how to use performance-
686 ! related features provided by commercial edition of ALGLIB.
687
688INPUT PARAMETERS
689 A - array[0..N-1,0..N-1], system matrix
690 N - size of A
691 B - array[0..N-1,0..M-1], right part
692 M - right part size
693 RFS - iterative refinement switch:
694 * True - refinement is used.
695 Less performance, more precision.
696 * False - refinement is not used.
697 More performance, less precision.
698
699OUTPUT PARAMETERS
700 Info - return code:
701 * -3 A is ill conditioned or singular.
702 X is filled by zeros in such cases.
703 * -1 N<=0 was passed
704 * 1 task is solved (but matrix A may be ill-conditioned,
705 check R1/RInf parameters for condition numbers).
706 Rep - additional report, following fields are set:
707 * rep.r1 condition number in 1-norm
708 * rep.rinf condition number in inf-norm
709 X - array[N], it contains:
710 * info>0 => solution
711 * info=-3 => filled by zeros
712
713
714 -- ALGLIB --
715 Copyright 27.01.2010 by Bochkanov Sergey
716*************************************************************************/
717void rmatrixsolvem(const real_2d_array &a, const ae_int_t n, const real_2d_array &b, const ae_int_t m, const bool rfs, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
718void smp_rmatrixsolvem(const real_2d_array &a, const ae_int_t n, const real_2d_array &b, const ae_int_t m, const bool rfs, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
719
720
721/*************************************************************************
722Dense solver.
723
724Similar to RMatrixSolve() but solves task with multiple right parts (where
725b and x are NxM matrices). This is "fast" version of linear solver which
726does NOT offer additional functions like condition number estimation or
727iterative refinement.
728
729Algorithm features:
730* O(N^3+M*N^2) complexity
731* no additional functionality, highest performance
732
733COMMERCIAL EDITION OF ALGLIB:
734
735 ! Commercial version of ALGLIB includes two important improvements of
736 ! this function, which can be used from C++ and C#:
737 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
738 ! * multicore support
739 !
740 ! Intel MKL gives approximately constant (with respect to number of
741 ! worker threads) acceleration factor which depends on CPU being used,
742 ! problem size and "baseline" ALGLIB edition which is used for
743 ! comparison.
744 !
745 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
746 ! * about 2-3x faster than ALGLIB for C++ without MKL
747 ! * about 7-10x faster than "pure C#" edition of ALGLIB
748 ! Difference in performance will be more striking on newer CPU's with
749 ! support for newer SIMD instructions. Generally, MKL accelerates any
750 ! problem whose size is at least 128, with best efficiency achieved for
751 ! N's larger than 512.
752 !
753 ! Commercial edition of ALGLIB also supports multithreaded acceleration
754 ! of this function. We should note that LU decomposition is harder to
755 ! parallelize than, say, matrix-matrix product - this algorithm has
756 ! many internal synchronization points which can not be avoided. However
757 ! parallelism starts to be profitable starting from N=1024, achieving
758 ! near-linear speedup for N=4096 or higher.
759 !
760 ! In order to use multicore features you have to:
761 ! * use commercial version of ALGLIB
762 ! * call this function with "smp_" prefix, which indicates that
763 ! multicore code will be used (for multicore support)
764 !
765 ! We recommend you to read 'Working with commercial version' section of
766 ! ALGLIB Reference Manual in order to find out how to use performance-
767 ! related features provided by commercial edition of ALGLIB.
768
769INPUT PARAMETERS
770 A - array[0..N-1,0..N-1], system matrix
771 N - size of A
772 B - array[0..N-1,0..M-1], right part
773 M - right part size
774 RFS - iterative refinement switch:
775 * True - refinement is used.
776 Less performance, more precision.
777 * False - refinement is not used.
778 More performance, less precision.
779
780OUTPUT PARAMETERS
781 Info - return code:
782 * -3 matrix is exactly singular (ill conditioned matrices
783 are not recognized).
784 X is filled by zeros in such cases.
785 * -1 N<=0 was passed
786 * 1 task is solved
787 Rep - additional report, following fields are set:
788 * rep.r1 condition number in 1-norm
789 * rep.rinf condition number in inf-norm
790 B - array[N]:
791 * info>0 => overwritten by solution
792 * info=-3 => filled by zeros
793
794
795 -- ALGLIB --
796 Copyright 27.01.2010 by Bochkanov Sergey
797*************************************************************************/
798void rmatrixsolvemfast(const real_2d_array &a, const ae_int_t n, const real_2d_array &b, const ae_int_t m, ae_int_t &info);
799void smp_rmatrixsolvemfast(const real_2d_array &a, const ae_int_t n, const real_2d_array &b, const ae_int_t m, ae_int_t &info);
800
801
802/*************************************************************************
803Dense solver.
804
805This subroutine solves a system A*x=b, where A is NxN non-denegerate
806real matrix given by its LU decomposition, x and b are real vectors. This
807is "slow-but-robust" version of the linear LU-based solver. Faster version
808is RMatrixLUSolveFast() function.
809
810Algorithm features:
811* automatic detection of degenerate cases
812* O(N^2) complexity
813* condition number estimation
814
815No iterative refinement is provided because exact form of original matrix
816is not known to subroutine. Use RMatrixSolve or RMatrixMixedSolve if you
817need iterative refinement.
818
819IMPORTANT: ! this function is NOT the most efficient linear solver provided
820 ! by ALGLIB. It estimates condition number of linear system,
821 ! which results in 10-15x performance penalty when compared
822 ! with "fast" version which just calls triangular solver.
823 !
824 ! This performance penalty is insignificant when compared with
825 ! cost of large LU decomposition. However, if you call this
826 ! function many times for the same left side, this overhead
827 ! BECOMES significant. It also becomes significant for small-
828 ! scale problems.
829 !
830 ! In such cases we strongly recommend you to use faster solver,
831 ! RMatrixLUSolveFast() function.
832
833INPUT PARAMETERS
834 LUA - array[N,N], LU decomposition, RMatrixLU result
835 P - array[N], pivots array, RMatrixLU result
836 N - size of A
837 B - array[N], right part
838
839OUTPUT PARAMETERS
840 Info - return code:
841 * -3 matrix is very badly conditioned or exactly singular.
842 * -1 N<=0 was passed
843 * 1 task is solved (but matrix A may be ill-conditioned,
844 check R1/RInf parameters for condition numbers).
845 Rep - additional report, following fields are set:
846 * rep.r1 condition number in 1-norm
847 * rep.rinf condition number in inf-norm
848 X - array[N], it contains:
849 * info>0 => solution
850 * info=-3 => filled by zeros
851
852
853 -- ALGLIB --
854 Copyright 27.01.2010 by Bochkanov Sergey
855*************************************************************************/
856void rmatrixlusolve(const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const real_1d_array &b, ae_int_t &info, densesolverreport &rep, real_1d_array &x);
857
858
859/*************************************************************************
860Dense solver.
861
862This subroutine solves a system A*x=b, where A is NxN non-denegerate
863real matrix given by its LU decomposition, x and b are real vectors. This
864is "fast-without-any-checks" version of the linear LU-based solver. Slower
865but more robust version is RMatrixLUSolve() function.
866
867Algorithm features:
868* O(N^2) complexity
869* fast algorithm without ANY additional checks, just triangular solver
870
871INPUT PARAMETERS
872 LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
873 P - array[0..N-1], pivots array, RMatrixLU result
874 N - size of A
875 B - array[0..N-1], right part
876
877OUTPUT PARAMETERS
878 Info - return code:
879 * -3 matrix is exactly singular (ill conditioned matrices
880 are not recognized).
881 X is filled by zeros in such cases.
882 * -1 N<=0 was passed
883 * 1 task is solved
884 B - array[N]:
885 * info>0 => overwritten by solution
886 * info=-3 => filled by zeros
887
888 -- ALGLIB --
889 Copyright 18.03.2015 by Bochkanov Sergey
890*************************************************************************/
891void rmatrixlusolvefast(const real_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const real_1d_array &b, ae_int_t &info);
892
893
894/*************************************************************************
895Dense solver.
896
897Similar to RMatrixLUSolve() but solves task with multiple right parts
898(where b and x are NxM matrices). This is "robust-but-slow" version of
899LU-based solver which performs additional checks for non-degeneracy of
900inputs (condition number estimation). If you need best performance, use
901"fast-without-any-checks" version, RMatrixLUSolveMFast().
902
903Algorithm features:
904* automatic detection of degenerate cases
905* O(M*N^2) complexity
906* condition number estimation
907
908No iterative refinement is provided because exact form of original matrix
909is not known to subroutine. Use RMatrixSolve or RMatrixMixedSolve if you
910need iterative refinement.
911
912IMPORTANT: ! this function is NOT the most efficient linear solver provided
913 ! by ALGLIB. It estimates condition number of linear system,
914 ! which results in significant performance penalty when
915 ! compared with "fast" version which just calls triangular
916 ! solver.
917 !
918 ! This performance penalty is especially apparent when you use
919 ! ALGLIB parallel capabilities (condition number estimation is
920 ! inherently sequential). It also becomes significant for
921 ! small-scale problems.
922 !
923 ! In such cases we strongly recommend you to use faster solver,
924 ! RMatrixLUSolveMFast() function.
925
926COMMERCIAL EDITION OF ALGLIB:
927
928 ! Commercial version of ALGLIB includes two important improvements of
929 ! this function, which can be used from C++ and C#:
930 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
931 ! * multicore support
932 !
933 ! Intel MKL gives approximately constant (with respect to number of
934 ! worker threads) acceleration factor which depends on CPU being used,
935 ! problem size and "baseline" ALGLIB edition which is used for
936 ! comparison.
937 !
938 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
939 ! * about 2-3x faster than ALGLIB for C++ without MKL
940 ! * about 7-10x faster than "pure C#" edition of ALGLIB
941 ! Difference in performance will be more striking on newer CPU's with
942 ! support for newer SIMD instructions. Generally, MKL accelerates any
943 ! problem whose size is at least 128, with best efficiency achieved for
944 ! N's larger than 512.
945 !
946 ! Commercial edition of ALGLIB also supports multithreaded acceleration
947 ! of this function. Triangular solver is relatively easy to parallelize.
948 ! However, parallelization will be efficient only for large number of
949 ! right parts M.
950 !
951 ! In order to use multicore features you have to:
952 ! * use commercial version of ALGLIB
953 ! * call this function with "smp_" prefix, which indicates that
954 ! multicore code will be used (for multicore support)
955 !
956 ! We recommend you to read 'Working with commercial version' section of
957 ! ALGLIB Reference Manual in order to find out how to use performance-
958 ! related features provided by commercial edition of ALGLIB.
959
960INPUT PARAMETERS
961 LUA - array[N,N], LU decomposition, RMatrixLU result
962 P - array[N], pivots array, RMatrixLU result
963 N - size of A
964 B - array[0..N-1,0..M-1], right part
965 M - right part size
966
967OUTPUT PARAMETERS
968 Info - return code:
969 * -3 matrix is very badly conditioned or exactly singular.
970 X is filled by zeros in such cases.
971 * -1 N<=0 was passed
972 * 1 task is solved (but matrix A may be ill-conditioned,
973 check R1/RInf parameters for condition numbers).
974 Rep - additional report, following fields are set:
975 * rep.r1 condition number in 1-norm
976 * rep.rinf condition number in inf-norm
977 X - array[N,M], it contains:
978 * info>0 => solution
979 * info=-3 => filled by zeros
980
981
982 -- ALGLIB --
983 Copyright 27.01.2010 by Bochkanov Sergey
984*************************************************************************/
985void 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, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
986void smp_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, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
987
988
989/*************************************************************************
990Dense solver.
991
992Similar to RMatrixLUSolve() but solves task with multiple right parts,
993where b and x are NxM matrices. This is "fast-without-any-checks" version
994of LU-based solver. It does not estimate condition number of a system,
995so it is extremely fast. If you need better detection of near-degenerate
996cases, use RMatrixLUSolveM() function.
997
998Algorithm features:
999* O(M*N^2) complexity
1000* fast algorithm without ANY additional checks, just triangular solver
1001
1002COMMERCIAL EDITION OF ALGLIB:
1003
1004 ! Commercial version of ALGLIB includes two important improvements of
1005 ! this function, which can be used from C++ and C#:
1006 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1007 ! * multicore support
1008 !
1009 ! Intel MKL gives approximately constant (with respect to number of
1010 ! worker threads) acceleration factor which depends on CPU being used,
1011 ! problem size and "baseline" ALGLIB edition which is used for
1012 ! comparison.
1013 !
1014 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1015 ! * about 2-3x faster than ALGLIB for C++ without MKL
1016 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1017 ! Difference in performance will be more striking on newer CPU's with
1018 ! support for newer SIMD instructions. Generally, MKL accelerates any
1019 ! problem whose size is at least 128, with best efficiency achieved for
1020 ! N's larger than 512.
1021 !
1022 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1023 ! of this function. Triangular solver is relatively easy to parallelize.
1024 ! However, parallelization will be efficient only for large number of
1025 ! right parts M.
1026 !
1027 ! In order to use multicore features you have to:
1028 ! * use commercial version of ALGLIB
1029 ! * call this function with "smp_" prefix, which indicates that
1030 ! multicore code will be used (for multicore support)
1031 !
1032 ! We recommend you to read 'Working with commercial version' section of
1033 ! ALGLIB Reference Manual in order to find out how to use performance-
1034 ! related features provided by commercial edition of ALGLIB.
1035
1036INPUT PARAMETERS:
1037 LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1038 P - array[0..N-1], pivots array, RMatrixLU result
1039 N - size of A
1040 B - array[0..N-1,0..M-1], right part
1041 M - right part size
1042
1043OUTPUT PARAMETERS:
1044 Info - return code:
1045 * -3 matrix is exactly singular (ill conditioned matrices
1046 are not recognized).
1047 * -1 N<=0 was passed
1048 * 1 task is solved
1049 B - array[N,M]:
1050 * info>0 => overwritten by solution
1051 * info=-3 => filled by zeros
1052
1053 -- ALGLIB --
1054 Copyright 18.03.2015 by Bochkanov Sergey
1055*************************************************************************/
1056void rmatrixlusolvemfast(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, ae_int_t &info);
1057void smp_rmatrixlusolvemfast(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, ae_int_t &info);
1058
1059
1060/*************************************************************************
1061Dense solver.
1062
1063This subroutine solves a system A*x=b, where BOTH ORIGINAL A AND ITS
1064LU DECOMPOSITION ARE KNOWN. You can use it if for some reasons you have
1065both A and its LU decomposition.
1066
1067Algorithm features:
1068* automatic detection of degenerate cases
1069* condition number estimation
1070* iterative refinement
1071* O(N^2) complexity
1072
1073INPUT PARAMETERS
1074 A - array[0..N-1,0..N-1], system matrix
1075 LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1076 P - array[0..N-1], pivots array, RMatrixLU result
1077 N - size of A
1078 B - array[0..N-1], right part
1079
1080OUTPUT PARAMETERS
1081 Info - return code:
1082 * -3 matrix is very badly conditioned or exactly singular.
1083 * -1 N<=0 was passed
1084 * 1 task is solved (but matrix A may be ill-conditioned,
1085 check R1/RInf parameters for condition numbers).
1086 Rep - additional report, following fields are set:
1087 * rep.r1 condition number in 1-norm
1088 * rep.rinf condition number in inf-norm
1089 X - array[N], it contains:
1090 * info>0 => solution
1091 * info=-3 => filled by zeros
1092
1093 -- ALGLIB --
1094 Copyright 27.01.2010 by Bochkanov Sergey
1095*************************************************************************/
1096void 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, ae_int_t &info, densesolverreport &rep, real_1d_array &x);
1097
1098
1099/*************************************************************************
1100Dense solver.
1101
1102Similar to RMatrixMixedSolve() but solves task with multiple right parts
1103(where b and x are NxM matrices).
1104
1105Algorithm features:
1106* automatic detection of degenerate cases
1107* condition number estimation
1108* iterative refinement
1109* O(M*N^2) complexity
1110
1111INPUT PARAMETERS
1112 A - array[0..N-1,0..N-1], system matrix
1113 LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1114 P - array[0..N-1], pivots array, RMatrixLU result
1115 N - size of A
1116 B - array[0..N-1,0..M-1], right part
1117 M - right part size
1118
1119OUTPUT PARAMETERS
1120 Info - return code:
1121 * -3 matrix is very badly conditioned or exactly singular.
1122 * -1 N<=0 was passed
1123 * 1 task is solved (but matrix A may be ill-conditioned,
1124 check R1/RInf parameters for condition numbers).
1125 Rep - additional report, following fields are set:
1126 * rep.r1 condition number in 1-norm
1127 * rep.rinf condition number in inf-norm
1128 X - array[N,M], it contains:
1129 * info>0 => solution
1130 * info=-3 => filled by zeros
1131
1132 -- ALGLIB --
1133 Copyright 27.01.2010 by Bochkanov Sergey
1134*************************************************************************/
1135void 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, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
1136
1137
1138/*************************************************************************
1139Complex dense solver for A*X=B with N*N complex matrix A, N*M complex
1140matrices X and B. "Slow-but-feature-rich" version which provides
1141additional functions, at the cost of slower performance. Faster version
1142may be invoked with CMatrixSolveMFast() function.
1143
1144Algorithm features:
1145* automatic detection of degenerate cases
1146* condition number estimation
1147* iterative refinement
1148* O(N^3+M*N^2) complexity
1149
1150IMPORTANT: ! this function is NOT the most efficient linear solver provided
1151 ! by ALGLIB. It estimates condition number of linear system
1152 ! and performs iterative refinement, which results in
1153 ! significant performance penalty when compared with "fast"
1154 ! version which just performs LU decomposition and calls
1155 ! triangular solver.
1156 !
1157 ! This performance penalty is especially visible in the
1158 ! multithreaded mode, because both condition number estimation
1159 ! and iterative refinement are inherently sequential
1160 ! calculations.
1161 !
1162 ! Thus, if you need high performance and if you are pretty sure
1163 ! that your system is well conditioned, we strongly recommend
1164 ! you to use faster solver, CMatrixSolveMFast() function.
1165
1166COMMERCIAL EDITION OF ALGLIB:
1167
1168 ! Commercial version of ALGLIB includes two important improvements of
1169 ! this function, which can be used from C++ and C#:
1170 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1171 ! * multicore support
1172 !
1173 ! Intel MKL gives approximately constant (with respect to number of
1174 ! worker threads) acceleration factor which depends on CPU being used,
1175 ! problem size and "baseline" ALGLIB edition which is used for
1176 ! comparison.
1177 !
1178 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1179 ! * about 2-3x faster than ALGLIB for C++ without MKL
1180 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1181 ! Difference in performance will be more striking on newer CPU's with
1182 ! support for newer SIMD instructions. Generally, MKL accelerates any
1183 ! problem whose size is at least 128, with best efficiency achieved for
1184 ! N's larger than 512.
1185 !
1186 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1187 ! of this function. We should note that LU decomposition is harder to
1188 ! parallelize than, say, matrix-matrix product - this algorithm has
1189 ! many internal synchronization points which can not be avoided. However
1190 ! parallelism starts to be profitable starting from N=1024, achieving
1191 ! near-linear speedup for N=4096 or higher.
1192 !
1193 ! In order to use multicore features you have to:
1194 ! * use commercial version of ALGLIB
1195 ! * call this function with "smp_" prefix, which indicates that
1196 ! multicore code will be used (for multicore support)
1197 !
1198 ! We recommend you to read 'Working with commercial version' section of
1199 ! ALGLIB Reference Manual in order to find out how to use performance-
1200 ! related features provided by commercial edition of ALGLIB.
1201
1202INPUT PARAMETERS
1203 A - array[0..N-1,0..N-1], system matrix
1204 N - size of A
1205 B - array[0..N-1,0..M-1], right part
1206 M - right part size
1207 RFS - iterative refinement switch:
1208 * True - refinement is used.
1209 Less performance, more precision.
1210 * False - refinement is not used.
1211 More performance, less precision.
1212
1213OUTPUT PARAMETERS
1214 Info - return code:
1215 * -3 matrix is very badly conditioned or exactly singular.
1216 X is filled by zeros in such cases.
1217 * -1 N<=0 was passed
1218 * 1 task is solved (but matrix A may be ill-conditioned,
1219 check R1/RInf parameters for condition numbers).
1220 Rep - additional report, following fields are set:
1221 * rep.r1 condition number in 1-norm
1222 * rep.rinf condition number in inf-norm
1223 X - array[N,M], it contains:
1224 * info>0 => solution
1225 * info=-3 => filled by zeros
1226
1227 -- ALGLIB --
1228 Copyright 27.01.2010 by Bochkanov Sergey
1229*************************************************************************/
1230void cmatrixsolvem(const complex_2d_array &a, const ae_int_t n, const complex_2d_array &b, const ae_int_t m, const bool rfs, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
1231void smp_cmatrixsolvem(const complex_2d_array &a, const ae_int_t n, const complex_2d_array &b, const ae_int_t m, const bool rfs, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
1232
1233
1234/*************************************************************************
1235Complex dense solver for A*X=B with N*N complex matrix A, N*M complex
1236matrices X and B. "Fast-but-lightweight" version which provides just
1237triangular solver - and no additional functions like iterative refinement
1238or condition number estimation.
1239
1240Algorithm features:
1241* O(N^3+M*N^2) complexity
1242* no additional time consuming functions
1243
1244COMMERCIAL EDITION OF ALGLIB:
1245
1246 ! Commercial version of ALGLIB includes two important improvements of
1247 ! this function, which can be used from C++ and C#:
1248 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1249 ! * multicore support
1250 !
1251 ! Intel MKL gives approximately constant (with respect to number of
1252 ! worker threads) acceleration factor which depends on CPU being used,
1253 ! problem size and "baseline" ALGLIB edition which is used for
1254 ! comparison.
1255 !
1256 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1257 ! * about 2-3x faster than ALGLIB for C++ without MKL
1258 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1259 ! Difference in performance will be more striking on newer CPU's with
1260 ! support for newer SIMD instructions. Generally, MKL accelerates any
1261 ! problem whose size is at least 128, with best efficiency achieved for
1262 ! N's larger than 512.
1263 !
1264 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1265 ! of this function. We should note that LU decomposition is harder to
1266 ! parallelize than, say, matrix-matrix product - this algorithm has
1267 ! many internal synchronization points which can not be avoided. However
1268 ! parallelism starts to be profitable starting from N=1024, achieving
1269 ! near-linear speedup for N=4096 or higher.
1270 !
1271 ! In order to use multicore features you have to:
1272 ! * use commercial version of ALGLIB
1273 ! * call this function with "smp_" prefix, which indicates that
1274 ! multicore code will be used (for multicore support)
1275 !
1276 ! We recommend you to read 'Working with commercial version' section of
1277 ! ALGLIB Reference Manual in order to find out how to use performance-
1278 ! related features provided by commercial edition of ALGLIB.
1279
1280INPUT PARAMETERS
1281 A - array[0..N-1,0..N-1], system matrix
1282 N - size of A
1283 B - array[0..N-1,0..M-1], right part
1284 M - right part size
1285
1286OUTPUT PARAMETERS:
1287 Info - return code:
1288 * -3 matrix is exactly singular (ill conditioned matrices
1289 are not recognized).
1290 * -1 N<=0 was passed
1291 * 1 task is solved
1292 B - array[N,M]:
1293 * info>0 => overwritten by solution
1294 * info=-3 => filled by zeros
1295
1296 -- ALGLIB --
1297 Copyright 16.03.2015 by Bochkanov Sergey
1298*************************************************************************/
1299void cmatrixsolvemfast(const complex_2d_array &a, const ae_int_t n, const complex_2d_array &b, const ae_int_t m, ae_int_t &info);
1300void smp_cmatrixsolvemfast(const complex_2d_array &a, const ae_int_t n, const complex_2d_array &b, const ae_int_t m, ae_int_t &info);
1301
1302
1303/*************************************************************************
1304Complex dense solver for A*x=B with N*N complex matrix A and N*1 complex
1305vectors x and b. "Slow-but-feature-rich" version of the solver.
1306
1307Algorithm features:
1308* automatic detection of degenerate cases
1309* condition number estimation
1310* iterative refinement
1311* O(N^3) complexity
1312
1313IMPORTANT: ! this function is NOT the most efficient linear solver provided
1314 ! by ALGLIB. It estimates condition number of linear system
1315 ! and performs iterative refinement, which results in
1316 ! significant performance penalty when compared with "fast"
1317 ! version which just performs LU decomposition and calls
1318 ! triangular solver.
1319 !
1320 ! This performance penalty is especially visible in the
1321 ! multithreaded mode, because both condition number estimation
1322 ! and iterative refinement are inherently sequential
1323 ! calculations.
1324 !
1325 ! Thus, if you need high performance and if you are pretty sure
1326 ! that your system is well conditioned, we strongly recommend
1327 ! you to use faster solver, CMatrixSolveFast() function.
1328
1329COMMERCIAL EDITION OF ALGLIB:
1330
1331 ! Commercial version of ALGLIB includes two important improvements of
1332 ! this function, which can be used from C++ and C#:
1333 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1334 ! * multicore support
1335 !
1336 ! Intel MKL gives approximately constant (with respect to number of
1337 ! worker threads) acceleration factor which depends on CPU being used,
1338 ! problem size and "baseline" ALGLIB edition which is used for
1339 ! comparison.
1340 !
1341 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1342 ! * about 2-3x faster than ALGLIB for C++ without MKL
1343 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1344 ! Difference in performance will be more striking on newer CPU's with
1345 ! support for newer SIMD instructions. Generally, MKL accelerates any
1346 ! problem whose size is at least 128, with best efficiency achieved for
1347 ! N's larger than 512.
1348 !
1349 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1350 ! of this function. We should note that LU decomposition is harder to
1351 ! parallelize than, say, matrix-matrix product - this algorithm has
1352 ! many internal synchronization points which can not be avoided. However
1353 ! parallelism starts to be profitable starting from N=1024, achieving
1354 ! near-linear speedup for N=4096 or higher.
1355 !
1356 ! In order to use multicore features you have to:
1357 ! * use commercial version of ALGLIB
1358 ! * call this function with "smp_" prefix, which indicates that
1359 ! multicore code will be used (for multicore support)
1360 !
1361 ! We recommend you to read 'Working with commercial version' section of
1362 ! ALGLIB Reference Manual in order to find out how to use performance-
1363 ! related features provided by commercial edition of ALGLIB.
1364
1365INPUT PARAMETERS
1366 A - array[0..N-1,0..N-1], system matrix
1367 N - size of A
1368 B - array[0..N-1], right part
1369
1370OUTPUT PARAMETERS
1371 Info - return code:
1372 * -3 matrix is very badly conditioned or exactly singular.
1373 * -1 N<=0 was passed
1374 * 1 task is solved (but matrix A may be ill-conditioned,
1375 check R1/RInf parameters for condition numbers).
1376 Rep - additional report, following fields are set:
1377 * rep.r1 condition number in 1-norm
1378 * rep.rinf condition number in inf-norm
1379 X - array[N], it contains:
1380 * info>0 => solution
1381 * info=-3 => filled by zeros
1382
1383 -- ALGLIB --
1384 Copyright 27.01.2010 by Bochkanov Sergey
1385*************************************************************************/
1386void cmatrixsolve(const complex_2d_array &a, const ae_int_t n, const complex_1d_array &b, ae_int_t &info, densesolverreport &rep, complex_1d_array &x);
1387void smp_cmatrixsolve(const complex_2d_array &a, const ae_int_t n, const complex_1d_array &b, ae_int_t &info, densesolverreport &rep, complex_1d_array &x);
1388
1389
1390/*************************************************************************
1391Complex dense solver for A*x=B with N*N complex matrix A and N*1 complex
1392vectors x and b. "Fast-but-lightweight" version of the solver.
1393
1394Algorithm features:
1395* O(N^3) complexity
1396* no additional time consuming features, just triangular solver
1397
1398COMMERCIAL EDITION OF ALGLIB:
1399
1400 ! Commercial version of ALGLIB includes two important improvements of
1401 ! this function, which can be used from C++ and C#:
1402 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1403 ! * multicore support
1404 !
1405 ! Intel MKL gives approximately constant (with respect to number of
1406 ! worker threads) acceleration factor which depends on CPU being used,
1407 ! problem size and "baseline" ALGLIB edition which is used for
1408 ! comparison.
1409 !
1410 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1411 ! * about 2-3x faster than ALGLIB for C++ without MKL
1412 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1413 ! Difference in performance will be more striking on newer CPU's with
1414 ! support for newer SIMD instructions. Generally, MKL accelerates any
1415 ! problem whose size is at least 128, with best efficiency achieved for
1416 ! N's larger than 512.
1417 !
1418 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1419 ! of this function. We should note that LU decomposition is harder to
1420 ! parallelize than, say, matrix-matrix product - this algorithm has
1421 ! many internal synchronization points which can not be avoided. However
1422 ! parallelism starts to be profitable starting from N=1024, achieving
1423 ! near-linear speedup for N=4096 or higher.
1424 !
1425 ! In order to use multicore features you have to:
1426 ! * use commercial version of ALGLIB
1427 ! * call this function with "smp_" prefix, which indicates that
1428 ! multicore code will be used (for multicore support)
1429 !
1430 ! We recommend you to read 'Working with commercial version' section of
1431 ! ALGLIB Reference Manual in order to find out how to use performance-
1432 ! related features provided by commercial edition of ALGLIB.
1433
1434INPUT PARAMETERS:
1435 A - array[0..N-1,0..N-1], system matrix
1436 N - size of A
1437 B - array[0..N-1], right part
1438
1439OUTPUT PARAMETERS:
1440 Info - return code:
1441 * -3 matrix is exactly singular (ill conditioned matrices
1442 are not recognized).
1443 * -1 N<=0 was passed
1444 * 1 task is solved
1445 B - array[N]:
1446 * info>0 => overwritten by solution
1447 * info=-3 => filled by zeros
1448
1449 -- ALGLIB --
1450 Copyright 27.01.2010 by Bochkanov Sergey
1451*************************************************************************/
1452void cmatrixsolvefast(const complex_2d_array &a, const ae_int_t n, const complex_1d_array &b, ae_int_t &info);
1453void smp_cmatrixsolvefast(const complex_2d_array &a, const ae_int_t n, const complex_1d_array &b, ae_int_t &info);
1454
1455
1456/*************************************************************************
1457Dense solver for A*X=B with N*N complex A given by its LU decomposition,
1458and N*M matrices X and B (multiple right sides). "Slow-but-feature-rich"
1459version of the solver.
1460
1461Algorithm features:
1462* automatic detection of degenerate cases
1463* O(M*N^2) complexity
1464* condition number estimation
1465
1466No iterative refinement is provided because exact form of original matrix
1467is not known to subroutine. Use CMatrixSolve or CMatrixMixedSolve if you
1468need iterative refinement.
1469
1470IMPORTANT: ! this function is NOT the most efficient linear solver provided
1471 ! by ALGLIB. It estimates condition number of linear system,
1472 ! which results in significant performance penalty when
1473 ! compared with "fast" version which just calls triangular
1474 ! solver.
1475 !
1476 ! This performance penalty is especially apparent when you use
1477 ! ALGLIB parallel capabilities (condition number estimation is
1478 ! inherently sequential). It also becomes significant for
1479 ! small-scale problems.
1480 !
1481 ! In such cases we strongly recommend you to use faster solver,
1482 ! CMatrixLUSolveMFast() function.
1483
1484COMMERCIAL EDITION OF ALGLIB:
1485
1486 ! Commercial version of ALGLIB includes two important improvements of
1487 ! this function, which can be used from C++ and C#:
1488 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1489 ! * multicore support
1490 !
1491 ! Intel MKL gives approximately constant (with respect to number of
1492 ! worker threads) acceleration factor which depends on CPU being used,
1493 ! problem size and "baseline" ALGLIB edition which is used for
1494 ! comparison.
1495 !
1496 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1497 ! * about 2-3x faster than ALGLIB for C++ without MKL
1498 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1499 ! Difference in performance will be more striking on newer CPU's with
1500 ! support for newer SIMD instructions. Generally, MKL accelerates any
1501 ! problem whose size is at least 128, with best efficiency achieved for
1502 ! N's larger than 512.
1503 !
1504 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1505 ! of this function. Triangular solver is relatively easy to parallelize.
1506 ! However, parallelization will be efficient only for large number of
1507 ! right parts M.
1508 !
1509 ! In order to use multicore features you have to:
1510 ! * use commercial version of ALGLIB
1511 ! * call this function with "smp_" prefix, which indicates that
1512 ! multicore code will be used (for multicore support)
1513 !
1514 ! We recommend you to read 'Working with commercial version' section of
1515 ! ALGLIB Reference Manual in order to find out how to use performance-
1516 ! related features provided by commercial edition of ALGLIB.
1517
1518INPUT PARAMETERS
1519 LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1520 P - array[0..N-1], pivots array, RMatrixLU result
1521 N - size of A
1522 B - array[0..N-1,0..M-1], right part
1523 M - right part size
1524
1525OUTPUT PARAMETERS
1526 Info - return code:
1527 * -3 matrix is very badly conditioned or exactly singular.
1528 * -1 N<=0 was passed
1529 * 1 task is solved (but matrix A may be ill-conditioned,
1530 check R1/RInf parameters for condition numbers).
1531 Rep - additional report, following fields are set:
1532 * rep.r1 condition number in 1-norm
1533 * rep.rinf condition number in inf-norm
1534 X - array[N,M], it contains:
1535 * info>0 => solution
1536 * info=-3 => filled by zeros
1537
1538 -- ALGLIB --
1539 Copyright 27.01.2010 by Bochkanov Sergey
1540*************************************************************************/
1541void 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, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
1542void smp_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, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
1543
1544
1545/*************************************************************************
1546Dense solver for A*X=B with N*N complex A given by its LU decomposition,
1547and N*M matrices X and B (multiple right sides). "Fast-but-lightweight"
1548version of the solver.
1549
1550Algorithm features:
1551* O(M*N^2) complexity
1552* no additional time-consuming features
1553
1554COMMERCIAL EDITION OF ALGLIB:
1555
1556 ! Commercial version of ALGLIB includes two important improvements of
1557 ! this function, which can be used from C++ and C#:
1558 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1559 ! * multicore support
1560 !
1561 ! Intel MKL gives approximately constant (with respect to number of
1562 ! worker threads) acceleration factor which depends on CPU being used,
1563 ! problem size and "baseline" ALGLIB edition which is used for
1564 ! comparison.
1565 !
1566 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1567 ! * about 2-3x faster than ALGLIB for C++ without MKL
1568 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1569 ! Difference in performance will be more striking on newer CPU's with
1570 ! support for newer SIMD instructions. Generally, MKL accelerates any
1571 ! problem whose size is at least 128, with best efficiency achieved for
1572 ! N's larger than 512.
1573 !
1574 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1575 ! of this function. Triangular solver is relatively easy to parallelize.
1576 ! However, parallelization will be efficient only for large number of
1577 ! right parts M.
1578 !
1579 ! In order to use multicore features you have to:
1580 ! * use commercial version of ALGLIB
1581 ! * call this function with "smp_" prefix, which indicates that
1582 ! multicore code will be used (for multicore support)
1583 !
1584 ! We recommend you to read 'Working with commercial version' section of
1585 ! ALGLIB Reference Manual in order to find out how to use performance-
1586 ! related features provided by commercial edition of ALGLIB.
1587
1588INPUT PARAMETERS
1589 LUA - array[0..N-1,0..N-1], LU decomposition, RMatrixLU result
1590 P - array[0..N-1], pivots array, RMatrixLU result
1591 N - size of A
1592 B - array[0..N-1,0..M-1], right part
1593 M - right part size
1594
1595OUTPUT PARAMETERS
1596 Info - return code:
1597 * -3 matrix is exactly singular (ill conditioned matrices
1598 are not recognized).
1599 * -1 N<=0 was passed
1600 * 1 task is solved
1601 B - array[N,M]:
1602 * info>0 => overwritten by solution
1603 * info=-3 => filled by zeros
1604
1605
1606 -- ALGLIB --
1607 Copyright 27.01.2010 by Bochkanov Sergey
1608*************************************************************************/
1609void cmatrixlusolvemfast(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, ae_int_t &info);
1610void smp_cmatrixlusolvemfast(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, ae_int_t &info);
1611
1612
1613/*************************************************************************
1614Complex dense linear solver for A*x=b with complex N*N A given by its LU
1615decomposition and N*1 vectors x and b. This is "slow-but-robust" version
1616of the complex linear solver with additional features which add
1617significant performance overhead. Faster version is CMatrixLUSolveFast()
1618function.
1619
1620Algorithm features:
1621* automatic detection of degenerate cases
1622* O(N^2) complexity
1623* condition number estimation
1624
1625No iterative refinement is provided because exact form of original matrix
1626is not known to subroutine. Use CMatrixSolve or CMatrixMixedSolve if you
1627need iterative refinement.
1628
1629IMPORTANT: ! this function is NOT the most efficient linear solver provided
1630 ! by ALGLIB. It estimates condition number of linear system,
1631 ! which results in 10-15x performance penalty when compared
1632 ! with "fast" version which just calls triangular solver.
1633 !
1634 ! This performance penalty is insignificant when compared with
1635 ! cost of large LU decomposition. However, if you call this
1636 ! function many times for the same left side, this overhead
1637 ! BECOMES significant. It also becomes significant for small-
1638 ! scale problems.
1639 !
1640 ! In such cases we strongly recommend you to use faster solver,
1641 ! CMatrixLUSolveFast() function.
1642
1643INPUT PARAMETERS
1644 LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1645 P - array[0..N-1], pivots array, CMatrixLU result
1646 N - size of A
1647 B - array[0..N-1], right part
1648
1649OUTPUT PARAMETERS
1650 Info - return code:
1651 * -3 matrix is very badly conditioned or exactly singular.
1652 * -1 N<=0 was passed
1653 * 1 task is solved (but matrix A may be ill-conditioned,
1654 check R1/RInf parameters for condition numbers).
1655 Rep - additional report, following fields are set:
1656 * rep.r1 condition number in 1-norm
1657 * rep.rinf condition number in inf-norm
1658 X - array[N], it contains:
1659 * info>0 => solution
1660 * info=-3 => filled by zeros
1661
1662 -- ALGLIB --
1663 Copyright 27.01.2010 by Bochkanov Sergey
1664*************************************************************************/
1665void cmatrixlusolve(const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const complex_1d_array &b, ae_int_t &info, densesolverreport &rep, complex_1d_array &x);
1666
1667
1668/*************************************************************************
1669Complex dense linear solver for A*x=b with N*N complex A given by its LU
1670decomposition and N*1 vectors x and b. This is fast lightweight version
1671of solver, which is significantly faster than CMatrixLUSolve(), but does
1672not provide additional information (like condition numbers).
1673
1674Algorithm features:
1675* O(N^2) complexity
1676* no additional time-consuming features, just triangular solver
1677
1678INPUT PARAMETERS
1679 LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1680 P - array[0..N-1], pivots array, CMatrixLU result
1681 N - size of A
1682 B - array[0..N-1], right part
1683
1684OUTPUT PARAMETERS
1685 Info - return code:
1686 * -3 matrix is exactly singular (ill conditioned matrices
1687 are not recognized).
1688 * -1 N<=0 was passed
1689 * 1 task is solved
1690 B - array[N]:
1691 * info>0 => overwritten by solution
1692 * info=-3 => filled by zeros
1693
1694NOTE: unlike CMatrixLUSolve(), this function does NOT check for
1695 near-degeneracy of input matrix. It checks for EXACT degeneracy,
1696 because this check is easy to do. However, very badly conditioned
1697 matrices may went unnoticed.
1698
1699
1700 -- ALGLIB --
1701 Copyright 27.01.2010 by Bochkanov Sergey
1702*************************************************************************/
1703void cmatrixlusolvefast(const complex_2d_array &lua, const integer_1d_array &p, const ae_int_t n, const complex_1d_array &b, ae_int_t &info);
1704
1705
1706/*************************************************************************
1707Dense solver. Same as RMatrixMixedSolveM(), but for complex matrices.
1708
1709Algorithm features:
1710* automatic detection of degenerate cases
1711* condition number estimation
1712* iterative refinement
1713* O(M*N^2) complexity
1714
1715INPUT PARAMETERS
1716 A - array[0..N-1,0..N-1], system matrix
1717 LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1718 P - array[0..N-1], pivots array, CMatrixLU result
1719 N - size of A
1720 B - array[0..N-1,0..M-1], right part
1721 M - right part size
1722
1723OUTPUT PARAMETERS
1724 Info - return code:
1725 * -3 matrix is very badly conditioned or exactly singular.
1726 * -1 N<=0 was passed
1727 * 1 task is solved (but matrix A may be ill-conditioned,
1728 check R1/RInf parameters for condition numbers).
1729 Rep - additional report, following fields are set:
1730 * rep.r1 condition number in 1-norm
1731 * rep.rinf condition number in inf-norm
1732 X - array[N,M], it contains:
1733 * info>0 => solution
1734 * info=-3 => filled by zeros
1735
1736 -- ALGLIB --
1737 Copyright 27.01.2010 by Bochkanov Sergey
1738*************************************************************************/
1739void 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, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
1740
1741
1742/*************************************************************************
1743Dense solver. Same as RMatrixMixedSolve(), but for complex matrices.
1744
1745Algorithm features:
1746* automatic detection of degenerate cases
1747* condition number estimation
1748* iterative refinement
1749* O(N^2) complexity
1750
1751INPUT PARAMETERS
1752 A - array[0..N-1,0..N-1], system matrix
1753 LUA - array[0..N-1,0..N-1], LU decomposition, CMatrixLU result
1754 P - array[0..N-1], pivots array, CMatrixLU result
1755 N - size of A
1756 B - array[0..N-1], right part
1757
1758OUTPUT PARAMETERS
1759 Info - return code:
1760 * -3 matrix is very badly conditioned or exactly singular.
1761 * -1 N<=0 was passed
1762 * 1 task is solved (but matrix A may be ill-conditioned,
1763 check R1/RInf parameters for condition numbers).
1764 Rep - additional report, following fields are set:
1765 * rep.r1 condition number in 1-norm
1766 * rep.rinf condition number in inf-norm
1767 X - array[N], it contains:
1768 * info>0 => solution
1769 * info=-3 => filled by zeros
1770
1771 -- ALGLIB --
1772 Copyright 27.01.2010 by Bochkanov Sergey
1773*************************************************************************/
1774void 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, ae_int_t &info, densesolverreport &rep, complex_1d_array &x);
1775
1776
1777/*************************************************************************
1778Dense solver for A*X=B with N*N symmetric positive definite matrix A, and
1779N*M vectors X and B. It is "slow-but-feature-rich" version of the solver.
1780
1781Algorithm features:
1782* automatic detection of degenerate cases
1783* condition number estimation
1784* O(N^3+M*N^2) complexity
1785* matrix is represented by its upper or lower triangle
1786
1787No iterative refinement is provided because such partial representation of
1788matrix does not allow efficient calculation of extra-precise matrix-vector
1789products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
1790need iterative refinement.
1791
1792IMPORTANT: ! this function is NOT the most efficient linear solver provided
1793 ! by ALGLIB. It estimates condition number of linear system,
1794 ! which results in significant performance penalty when
1795 ! compared with "fast" version which just performs Cholesky
1796 ! decomposition and calls triangular solver.
1797 !
1798 ! This performance penalty is especially visible in the
1799 ! multithreaded mode, because both condition number estimation
1800 ! and iterative refinement are inherently sequential
1801 ! calculations.
1802 !
1803 ! Thus, if you need high performance and if you are pretty sure
1804 ! that your system is well conditioned, we strongly recommend
1805 ! you to use faster solver, SPDMatrixSolveMFast() function.
1806
1807COMMERCIAL EDITION OF ALGLIB:
1808
1809 ! Commercial version of ALGLIB includes two important improvements of
1810 ! this function, which can be used from C++ and C#:
1811 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1812 ! * multicore support
1813 !
1814 ! Intel MKL gives approximately constant (with respect to number of
1815 ! worker threads) acceleration factor which depends on CPU being used,
1816 ! problem size and "baseline" ALGLIB edition which is used for
1817 ! comparison.
1818 !
1819 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1820 ! * about 2-3x faster than ALGLIB for C++ without MKL
1821 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1822 ! Difference in performance will be more striking on newer CPU's with
1823 ! support for newer SIMD instructions. Generally, MKL accelerates any
1824 ! problem whose size is at least 128, with best efficiency achieved for
1825 ! N's larger than 512.
1826 !
1827 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1828 ! of this function. We should note that Cholesky decomposition is harder
1829 ! to parallelize than, say, matrix-matrix product - this algorithm has
1830 ! several synchronization points which can not be avoided. However,
1831 ! parallelism starts to be profitable starting from N=500.
1832 !
1833 ! In order to use multicore features you have to:
1834 ! * use commercial version of ALGLIB
1835 ! * call this function with "smp_" prefix, which indicates that
1836 ! multicore code will be used (for multicore support)
1837 !
1838 ! We recommend you to read 'Working with commercial version' section of
1839 ! ALGLIB Reference Manual in order to find out how to use performance-
1840 ! related features provided by commercial edition of ALGLIB.
1841
1842INPUT PARAMETERS
1843 A - array[0..N-1,0..N-1], system matrix
1844 N - size of A
1845 IsUpper - what half of A is provided
1846 B - array[0..N-1,0..M-1], right part
1847 M - right part size
1848
1849OUTPUT PARAMETERS
1850 Info - return code:
1851 * -3 matrix is very badly conditioned or non-SPD.
1852 * -1 N<=0 was passed
1853 * 1 task is solved (but matrix A may be ill-conditioned,
1854 check R1/RInf parameters for condition numbers).
1855 Rep - additional report, following fields are set:
1856 * rep.r1 condition number in 1-norm
1857 * rep.rinf condition number in inf-norm
1858 X - array[N,M], it contains:
1859 * info>0 => solution
1860 * info=-3 => filled by zeros
1861
1862 -- ALGLIB --
1863 Copyright 27.01.2010 by Bochkanov Sergey
1864*************************************************************************/
1865void spdmatrixsolvem(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
1866void smp_spdmatrixsolvem(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
1867
1868
1869/*************************************************************************
1870Dense solver for A*X=B with N*N symmetric positive definite matrix A, and
1871N*M vectors X and B. It is "fast-but-lightweight" version of the solver.
1872
1873Algorithm features:
1874* O(N^3+M*N^2) complexity
1875* matrix is represented by its upper or lower triangle
1876* no additional time consuming features
1877
1878COMMERCIAL EDITION OF ALGLIB:
1879
1880 ! Commercial version of ALGLIB includes two important improvements of
1881 ! this function, which can be used from C++ and C#:
1882 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1883 ! * multicore support
1884 !
1885 ! Intel MKL gives approximately constant (with respect to number of
1886 ! worker threads) acceleration factor which depends on CPU being used,
1887 ! problem size and "baseline" ALGLIB edition which is used for
1888 ! comparison.
1889 !
1890 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1891 ! * about 2-3x faster than ALGLIB for C++ without MKL
1892 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1893 ! Difference in performance will be more striking on newer CPU's with
1894 ! support for newer SIMD instructions. Generally, MKL accelerates any
1895 ! problem whose size is at least 128, with best efficiency achieved for
1896 ! N's larger than 512.
1897 !
1898 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1899 ! of this function. We should note that Cholesky decomposition is harder
1900 ! to parallelize than, say, matrix-matrix product - this algorithm has
1901 ! several synchronization points which can not be avoided. However,
1902 ! parallelism starts to be profitable starting from N=500.
1903 !
1904 ! In order to use multicore features you have to:
1905 ! * use commercial version of ALGLIB
1906 ! * call this function with "smp_" prefix, which indicates that
1907 ! multicore code will be used (for multicore support)
1908 !
1909 ! We recommend you to read 'Working with commercial version' section of
1910 ! ALGLIB Reference Manual in order to find out how to use performance-
1911 ! related features provided by commercial edition of ALGLIB.
1912
1913INPUT PARAMETERS
1914 A - array[0..N-1,0..N-1], system matrix
1915 N - size of A
1916 IsUpper - what half of A is provided
1917 B - array[0..N-1,0..M-1], right part
1918 M - right part size
1919
1920OUTPUT PARAMETERS
1921 Info - return code:
1922 * -3 A is is exactly singular
1923 * -1 N<=0 was passed
1924 * 1 task was solved
1925 B - array[N,M], it contains:
1926 * info>0 => solution
1927 * info=-3 => filled by zeros
1928
1929 -- ALGLIB --
1930 Copyright 17.03.2015 by Bochkanov Sergey
1931*************************************************************************/
1932void spdmatrixsolvemfast(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info);
1933void smp_spdmatrixsolvemfast(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info);
1934
1935
1936/*************************************************************************
1937Dense linear solver for A*x=b with N*N real symmetric positive definite
1938matrix A, N*1 vectors x and b. "Slow-but-feature-rich" version of the
1939solver.
1940
1941Algorithm features:
1942* automatic detection of degenerate cases
1943* condition number estimation
1944* O(N^3) complexity
1945* matrix is represented by its upper or lower triangle
1946
1947No iterative refinement is provided because such partial representation of
1948matrix does not allow efficient calculation of extra-precise matrix-vector
1949products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
1950need iterative refinement.
1951
1952IMPORTANT: ! this function is NOT the most efficient linear solver provided
1953 ! by ALGLIB. It estimates condition number of linear system,
1954 ! which results in significant performance penalty when
1955 ! compared with "fast" version which just performs Cholesky
1956 ! decomposition and calls triangular solver.
1957 !
1958 ! This performance penalty is especially visible in the
1959 ! multithreaded mode, because both condition number estimation
1960 ! and iterative refinement are inherently sequential
1961 ! calculations.
1962 !
1963 ! Thus, if you need high performance and if you are pretty sure
1964 ! that your system is well conditioned, we strongly recommend
1965 ! you to use faster solver, SPDMatrixSolveFast() function.
1966
1967COMMERCIAL EDITION OF ALGLIB:
1968
1969 ! Commercial version of ALGLIB includes two important improvements of
1970 ! this function, which can be used from C++ and C#:
1971 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
1972 ! * multicore support
1973 !
1974 ! Intel MKL gives approximately constant (with respect to number of
1975 ! worker threads) acceleration factor which depends on CPU being used,
1976 ! problem size and "baseline" ALGLIB edition which is used for
1977 ! comparison.
1978 !
1979 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
1980 ! * about 2-3x faster than ALGLIB for C++ without MKL
1981 ! * about 7-10x faster than "pure C#" edition of ALGLIB
1982 ! Difference in performance will be more striking on newer CPU's with
1983 ! support for newer SIMD instructions. Generally, MKL accelerates any
1984 ! problem whose size is at least 128, with best efficiency achieved for
1985 ! N's larger than 512.
1986 !
1987 ! Commercial edition of ALGLIB also supports multithreaded acceleration
1988 ! of this function. We should note that Cholesky decomposition is harder
1989 ! to parallelize than, say, matrix-matrix product - this algorithm has
1990 ! several synchronization points which can not be avoided. However,
1991 ! parallelism starts to be profitable starting from N=500.
1992 !
1993 ! In order to use multicore features you have to:
1994 ! * use commercial version of ALGLIB
1995 ! * call this function with "smp_" prefix, which indicates that
1996 ! multicore code will be used (for multicore support)
1997 !
1998 ! We recommend you to read 'Working with commercial version' section of
1999 ! ALGLIB Reference Manual in order to find out how to use performance-
2000 ! related features provided by commercial edition of ALGLIB.
2001
2002INPUT PARAMETERS
2003 A - array[0..N-1,0..N-1], system matrix
2004 N - size of A
2005 IsUpper - what half of A is provided
2006 B - array[0..N-1], right part
2007
2008OUTPUT PARAMETERS
2009 Info - return code:
2010 * -3 matrix is very badly conditioned or non-SPD.
2011 * -1 N<=0 was passed
2012 * 1 task is solved (but matrix A may be ill-conditioned,
2013 check R1/RInf parameters for condition numbers).
2014 Rep - additional report, following fields are set:
2015 * rep.r1 condition number in 1-norm
2016 * rep.rinf condition number in inf-norm
2017 X - array[N], it contains:
2018 * info>0 => solution
2019 * info=-3 => filled by zeros
2020
2021 -- ALGLIB --
2022 Copyright 27.01.2010 by Bochkanov Sergey
2023*************************************************************************/
2024void spdmatrixsolve(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &b, ae_int_t &info, densesolverreport &rep, real_1d_array &x);
2025void smp_spdmatrixsolve(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &b, ae_int_t &info, densesolverreport &rep, real_1d_array &x);
2026
2027
2028/*************************************************************************
2029Dense linear solver for A*x=b with N*N real symmetric positive definite
2030matrix A, N*1 vectors x and b. "Fast-but-lightweight" version of the
2031solver.
2032
2033Algorithm features:
2034* O(N^3) complexity
2035* matrix is represented by its upper or lower triangle
2036* no additional time consuming features like condition number estimation
2037
2038COMMERCIAL EDITION OF ALGLIB:
2039
2040 ! Commercial version of ALGLIB includes two important improvements of
2041 ! this function, which can be used from C++ and C#:
2042 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
2043 ! * multicore support
2044 !
2045 ! Intel MKL gives approximately constant (with respect to number of
2046 ! worker threads) acceleration factor which depends on CPU being used,
2047 ! problem size and "baseline" ALGLIB edition which is used for
2048 ! comparison.
2049 !
2050 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
2051 ! * about 2-3x faster than ALGLIB for C++ without MKL
2052 ! * about 7-10x faster than "pure C#" edition of ALGLIB
2053 ! Difference in performance will be more striking on newer CPU's with
2054 ! support for newer SIMD instructions. Generally, MKL accelerates any
2055 ! problem whose size is at least 128, with best efficiency achieved for
2056 ! N's larger than 512.
2057 !
2058 ! Commercial edition of ALGLIB also supports multithreaded acceleration
2059 ! of this function. We should note that Cholesky decomposition is harder
2060 ! to parallelize than, say, matrix-matrix product - this algorithm has
2061 ! several synchronization points which can not be avoided. However,
2062 ! parallelism starts to be profitable starting from N=500.
2063 !
2064 ! In order to use multicore features you have to:
2065 ! * use commercial version of ALGLIB
2066 ! * call this function with "smp_" prefix, which indicates that
2067 ! multicore code will be used (for multicore support)
2068 !
2069 ! We recommend you to read 'Working with commercial version' section of
2070 ! ALGLIB Reference Manual in order to find out how to use performance-
2071 ! related features provided by commercial edition of ALGLIB.
2072
2073INPUT PARAMETERS
2074 A - array[0..N-1,0..N-1], system matrix
2075 N - size of A
2076 IsUpper - what half of A is provided
2077 B - array[0..N-1], right part
2078
2079OUTPUT PARAMETERS
2080 Info - return code:
2081 * -3 A is is exactly singular or non-SPD
2082 * -1 N<=0 was passed
2083 * 1 task was solved
2084 B - array[N], it contains:
2085 * info>0 => solution
2086 * info=-3 => filled by zeros
2087
2088 -- ALGLIB --
2089 Copyright 17.03.2015 by Bochkanov Sergey
2090*************************************************************************/
2091void spdmatrixsolvefast(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &b, ae_int_t &info);
2092void smp_spdmatrixsolvefast(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &b, ae_int_t &info);
2093
2094
2095/*************************************************************************
2096Dense solver for A*X=B with N*N symmetric positive definite matrix A given
2097by its Cholesky decomposition, and N*M vectors X and B. It is "slow-but-
2098feature-rich" version of the solver which estimates condition number of
2099the system.
2100
2101Algorithm features:
2102* automatic detection of degenerate cases
2103* O(M*N^2) complexity
2104* condition number estimation
2105* matrix is represented by its upper or lower triangle
2106
2107No iterative refinement is provided because such partial representation of
2108matrix does not allow efficient calculation of extra-precise matrix-vector
2109products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2110need iterative refinement.
2111
2112IMPORTANT: ! this function is NOT the most efficient linear solver provided
2113 ! by ALGLIB. It estimates condition number of linear system,
2114 ! which results in significant performance penalty when
2115 ! compared with "fast" version which just calls triangular
2116 ! solver. Amount of overhead introduced depends on M (the
2117 ! larger - the more efficient).
2118 !
2119 ! This performance penalty is insignificant when compared with
2120 ! cost of large LU decomposition. However, if you call this
2121 ! function many times for the same left side, this overhead
2122 ! BECOMES significant. It also becomes significant for small-
2123 ! scale problems (N<50).
2124 !
2125 ! In such cases we strongly recommend you to use faster solver,
2126 ! SPDMatrixCholeskySolveMFast() function.
2127
2128INPUT PARAMETERS
2129 CHA - array[0..N-1,0..N-1], Cholesky decomposition,
2130 SPDMatrixCholesky result
2131 N - size of CHA
2132 IsUpper - what half of CHA is provided
2133 B - array[0..N-1,0..M-1], right part
2134 M - right part size
2135
2136OUTPUT PARAMETERS
2137 Info - return code:
2138 * -3 A is is exactly singular or badly conditioned
2139 X is filled by zeros in such cases.
2140 * -1 N<=0 was passed
2141 * 1 task was solved
2142 Rep - additional report, following fields are set:
2143 * rep.r1 condition number in 1-norm
2144 * rep.rinf condition number in inf-norm
2145 X - array[N]:
2146 * for info>0 contains solution
2147 * for info=-3 filled by zeros
2148
2149 -- ALGLIB --
2150 Copyright 27.01.2010 by Bochkanov Sergey
2151*************************************************************************/
2152void spdmatrixcholeskysolvem(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
2153void smp_spdmatrixcholeskysolvem(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, real_2d_array &x);
2154
2155
2156/*************************************************************************
2157Dense solver for A*X=B with N*N symmetric positive definite matrix A given
2158by its Cholesky decomposition, and N*M vectors X and B. It is "fast-but-
2159lightweight" version of the solver which just solves linear system,
2160without any additional functions.
2161
2162Algorithm features:
2163* O(M*N^2) complexity
2164* matrix is represented by its upper or lower triangle
2165* no additional functionality
2166
2167INPUT PARAMETERS
2168 CHA - array[N,N], Cholesky decomposition,
2169 SPDMatrixCholesky result
2170 N - size of CHA
2171 IsUpper - what half of CHA is provided
2172 B - array[N,M], right part
2173 M - right part size
2174
2175OUTPUT PARAMETERS
2176 Info - return code:
2177 * -3 A is is exactly singular or badly conditioned
2178 X is filled by zeros in such cases.
2179 * -1 N<=0 was passed
2180 * 1 task was solved
2181 B - array[N]:
2182 * for info>0 overwritten by solution
2183 * for info=-3 filled by zeros
2184
2185 -- ALGLIB --
2186 Copyright 18.03.2015 by Bochkanov Sergey
2187*************************************************************************/
2188void spdmatrixcholeskysolvemfast(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info);
2189void smp_spdmatrixcholeskysolvemfast(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_2d_array &b, const ae_int_t m, ae_int_t &info);
2190
2191
2192/*************************************************************************
2193Dense solver for A*x=b with N*N symmetric positive definite matrix A given
2194by its Cholesky decomposition, and N*1 real vectors x and b. This is "slow-
2195but-feature-rich" version of the solver which, in addition to the
2196solution, performs condition number estimation.
2197
2198Algorithm features:
2199* automatic detection of degenerate cases
2200* O(N^2) complexity
2201* condition number estimation
2202* matrix is represented by its upper or lower triangle
2203
2204No iterative refinement is provided because such partial representation of
2205matrix does not allow efficient calculation of extra-precise matrix-vector
2206products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2207need iterative refinement.
2208
2209IMPORTANT: ! this function is NOT the most efficient linear solver provided
2210 ! by ALGLIB. It estimates condition number of linear system,
2211 ! which results in 10-15x performance penalty when compared
2212 ! with "fast" version which just calls triangular solver.
2213 !
2214 ! This performance penalty is insignificant when compared with
2215 ! cost of large LU decomposition. However, if you call this
2216 ! function many times for the same left side, this overhead
2217 ! BECOMES significant. It also becomes significant for small-
2218 ! scale problems (N<50).
2219 !
2220 ! In such cases we strongly recommend you to use faster solver,
2221 ! SPDMatrixCholeskySolveFast() function.
2222
2223INPUT PARAMETERS
2224 CHA - array[N,N], Cholesky decomposition,
2225 SPDMatrixCholesky result
2226 N - size of A
2227 IsUpper - what half of CHA is provided
2228 B - array[N], right part
2229
2230OUTPUT PARAMETERS
2231 Info - return code:
2232 * -3 A is is exactly singular or ill conditioned
2233 X is filled by zeros in such cases.
2234 * -1 N<=0 was passed
2235 * 1 task is solved
2236 Rep - additional report, following fields are set:
2237 * rep.r1 condition number in 1-norm
2238 * rep.rinf condition number in inf-norm
2239 X - array[N]:
2240 * for info>0 - solution
2241 * for info=-3 - filled by zeros
2242
2243 -- ALGLIB --
2244 Copyright 27.01.2010 by Bochkanov Sergey
2245*************************************************************************/
2246void spdmatrixcholeskysolve(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_1d_array &b, ae_int_t &info, densesolverreport &rep, real_1d_array &x);
2247
2248
2249/*************************************************************************
2250Dense solver for A*x=b with N*N symmetric positive definite matrix A given
2251by its Cholesky decomposition, and N*1 real vectors x and b. This is "fast-
2252but-lightweight" version of the solver.
2253
2254Algorithm features:
2255* O(N^2) complexity
2256* matrix is represented by its upper or lower triangle
2257* no additional features
2258
2259INPUT PARAMETERS
2260 CHA - array[N,N], Cholesky decomposition,
2261 SPDMatrixCholesky result
2262 N - size of A
2263 IsUpper - what half of CHA is provided
2264 B - array[N], right part
2265
2266OUTPUT PARAMETERS
2267 Info - return code:
2268 * -3 A is is exactly singular or ill conditioned
2269 X is filled by zeros in such cases.
2270 * -1 N<=0 was passed
2271 * 1 task is solved
2272 B - array[N]:
2273 * for info>0 - overwritten by solution
2274 * for info=-3 - filled by zeros
2275
2276 -- ALGLIB --
2277 Copyright 27.01.2010 by Bochkanov Sergey
2278*************************************************************************/
2279void spdmatrixcholeskysolvefast(const real_2d_array &cha, const ae_int_t n, const bool isupper, const real_1d_array &b, ae_int_t &info);
2280
2281
2282/*************************************************************************
2283Dense solver for A*X=B, with N*N Hermitian positive definite matrix A and
2284N*M complex matrices X and B. "Slow-but-feature-rich" version of the
2285solver.
2286
2287Algorithm features:
2288* automatic detection of degenerate cases
2289* condition number estimation
2290* O(N^3+M*N^2) complexity
2291* matrix is represented by its upper or lower triangle
2292
2293No iterative refinement is provided because such partial representation of
2294matrix does not allow efficient calculation of extra-precise matrix-vector
2295products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2296need iterative refinement.
2297
2298IMPORTANT: ! this function is NOT the most efficient linear solver provided
2299 ! by ALGLIB. It estimates condition number of linear system,
2300 ! which results in significant performance penalty when
2301 ! compared with "fast" version which just calls triangular
2302 ! solver.
2303 !
2304 ! This performance penalty is especially apparent when you use
2305 ! ALGLIB parallel capabilities (condition number estimation is
2306 ! inherently sequential). It also becomes significant for
2307 ! small-scale problems (N<100).
2308 !
2309 ! In such cases we strongly recommend you to use faster solver,
2310 ! HPDMatrixSolveMFast() function.
2311
2312COMMERCIAL EDITION OF ALGLIB:
2313
2314 ! Commercial version of ALGLIB includes two important improvements of
2315 ! this function, which can be used from C++ and C#:
2316 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
2317 ! * multicore support
2318 !
2319 ! Intel MKL gives approximately constant (with respect to number of
2320 ! worker threads) acceleration factor which depends on CPU being used,
2321 ! problem size and "baseline" ALGLIB edition which is used for
2322 ! comparison.
2323 !
2324 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
2325 ! * about 2-3x faster than ALGLIB for C++ without MKL
2326 ! * about 7-10x faster than "pure C#" edition of ALGLIB
2327 ! Difference in performance will be more striking on newer CPU's with
2328 ! support for newer SIMD instructions. Generally, MKL accelerates any
2329 ! problem whose size is at least 128, with best efficiency achieved for
2330 ! N's larger than 512.
2331 !
2332 ! Commercial edition of ALGLIB also supports multithreaded acceleration
2333 ! of this function. We should note that Cholesky decomposition is harder
2334 ! to parallelize than, say, matrix-matrix product - this algorithm has
2335 ! several synchronization points which can not be avoided. However,
2336 ! parallelism starts to be profitable starting from N=500.
2337 !
2338 ! In order to use multicore features you have to:
2339 ! * use commercial version of ALGLIB
2340 ! * call this function with "smp_" prefix, which indicates that
2341 ! multicore code will be used (for multicore support)
2342 !
2343 ! We recommend you to read 'Working with commercial version' section of
2344 ! ALGLIB Reference Manual in order to find out how to use performance-
2345 ! related features provided by commercial edition of ALGLIB.
2346
2347INPUT PARAMETERS
2348 A - array[0..N-1,0..N-1], system matrix
2349 N - size of A
2350 IsUpper - what half of A is provided
2351 B - array[0..N-1,0..M-1], right part
2352 M - right part size
2353
2354OUTPUT PARAMETERS
2355 Info - same as in RMatrixSolve.
2356 Returns -3 for non-HPD matrices.
2357 Rep - same as in RMatrixSolve
2358 X - same as in RMatrixSolve
2359
2360 -- ALGLIB --
2361 Copyright 27.01.2010 by Bochkanov Sergey
2362*************************************************************************/
2363void hpdmatrixsolvem(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
2364void smp_hpdmatrixsolvem(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
2365
2366
2367/*************************************************************************
2368Dense solver for A*X=B, with N*N Hermitian positive definite matrix A and
2369N*M complex matrices X and B. "Fast-but-lightweight" version of the solver.
2370
2371Algorithm features:
2372* O(N^3+M*N^2) complexity
2373* matrix is represented by its upper or lower triangle
2374* no additional time consuming features like condition number estimation
2375
2376COMMERCIAL EDITION OF ALGLIB:
2377
2378 ! Commercial version of ALGLIB includes two important improvements of
2379 ! this function, which can be used from C++ and C#:
2380 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
2381 ! * multicore support
2382 !
2383 ! Intel MKL gives approximately constant (with respect to number of
2384 ! worker threads) acceleration factor which depends on CPU being used,
2385 ! problem size and "baseline" ALGLIB edition which is used for
2386 ! comparison.
2387 !
2388 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
2389 ! * about 2-3x faster than ALGLIB for C++ without MKL
2390 ! * about 7-10x faster than "pure C#" edition of ALGLIB
2391 ! Difference in performance will be more striking on newer CPU's with
2392 ! support for newer SIMD instructions. Generally, MKL accelerates any
2393 ! problem whose size is at least 128, with best efficiency achieved for
2394 ! N's larger than 512.
2395 !
2396 ! Commercial edition of ALGLIB also supports multithreaded acceleration
2397 ! of this function. We should note that Cholesky decomposition is harder
2398 ! to parallelize than, say, matrix-matrix product - this algorithm has
2399 ! several synchronization points which can not be avoided. However,
2400 ! parallelism starts to be profitable starting from N=500.
2401 !
2402 ! In order to use multicore features you have to:
2403 ! * use commercial version of ALGLIB
2404 ! * call this function with "smp_" prefix, which indicates that
2405 ! multicore code will be used (for multicore support)
2406 !
2407 ! We recommend you to read 'Working with commercial version' section of
2408 ! ALGLIB Reference Manual in order to find out how to use performance-
2409 ! related features provided by commercial edition of ALGLIB.
2410
2411INPUT PARAMETERS
2412 A - array[0..N-1,0..N-1], system matrix
2413 N - size of A
2414 IsUpper - what half of A is provided
2415 B - array[0..N-1,0..M-1], right part
2416 M - right part size
2417
2418OUTPUT PARAMETERS
2419 Info - return code:
2420 * -3 A is is exactly singular or is not positive definite.
2421 B is filled by zeros in such cases.
2422 * -1 N<=0 was passed
2423 * 1 task is solved
2424 B - array[0..N-1]:
2425 * overwritten by solution
2426 * zeros, if problem was not solved
2427
2428 -- ALGLIB --
2429 Copyright 17.03.2015 by Bochkanov Sergey
2430*************************************************************************/
2431void hpdmatrixsolvemfast(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info);
2432void smp_hpdmatrixsolvemfast(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info);
2433
2434
2435/*************************************************************************
2436Dense solver for A*x=b, with N*N Hermitian positive definite matrix A, and
2437N*1 complex vectors x and b. "Slow-but-feature-rich" version of the
2438solver.
2439
2440Algorithm features:
2441* automatic detection of degenerate cases
2442* condition number estimation
2443* O(N^3) complexity
2444* matrix is represented by its upper or lower triangle
2445
2446No iterative refinement is provided because such partial representation of
2447matrix does not allow efficient calculation of extra-precise matrix-vector
2448products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2449need iterative refinement.
2450
2451IMPORTANT: ! this function is NOT the most efficient linear solver provided
2452 ! by ALGLIB. It estimates condition number of linear system,
2453 ! which results in significant performance penalty when
2454 ! compared with "fast" version which just performs Cholesky
2455 ! decomposition and calls triangular solver.
2456 !
2457 ! This performance penalty is especially visible in the
2458 ! multithreaded mode, because both condition number estimation
2459 ! and iterative refinement are inherently sequential
2460 ! calculations.
2461 !
2462 ! Thus, if you need high performance and if you are pretty sure
2463 ! that your system is well conditioned, we strongly recommend
2464 ! you to use faster solver, HPDMatrixSolveFast() function.
2465
2466COMMERCIAL EDITION OF ALGLIB:
2467
2468 ! Commercial version of ALGLIB includes two important improvements of
2469 ! this function, which can be used from C++ and C#:
2470 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
2471 ! * multicore support
2472 !
2473 ! Intel MKL gives approximately constant (with respect to number of
2474 ! worker threads) acceleration factor which depends on CPU being used,
2475 ! problem size and "baseline" ALGLIB edition which is used for
2476 ! comparison.
2477 !
2478 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
2479 ! * about 2-3x faster than ALGLIB for C++ without MKL
2480 ! * about 7-10x faster than "pure C#" edition of ALGLIB
2481 ! Difference in performance will be more striking on newer CPU's with
2482 ! support for newer SIMD instructions. Generally, MKL accelerates any
2483 ! problem whose size is at least 128, with best efficiency achieved for
2484 ! N's larger than 512.
2485 !
2486 ! Commercial edition of ALGLIB also supports multithreaded acceleration
2487 ! of this function. We should note that Cholesky decomposition is harder
2488 ! to parallelize than, say, matrix-matrix product - this algorithm has
2489 ! several synchronization points which can not be avoided. However,
2490 ! parallelism starts to be profitable starting from N=500.
2491 !
2492 ! In order to use multicore features you have to:
2493 ! * use commercial version of ALGLIB
2494 ! * call this function with "smp_" prefix, which indicates that
2495 ! multicore code will be used (for multicore support)
2496 !
2497 ! We recommend you to read 'Working with commercial version' section of
2498 ! ALGLIB Reference Manual in order to find out how to use performance-
2499 ! related features provided by commercial edition of ALGLIB.
2500
2501INPUT PARAMETERS
2502 A - array[0..N-1,0..N-1], system matrix
2503 N - size of A
2504 IsUpper - what half of A is provided
2505 B - array[0..N-1], right part
2506
2507OUTPUT PARAMETERS
2508 Info - same as in RMatrixSolve
2509 Returns -3 for non-HPD matrices.
2510 Rep - same as in RMatrixSolve
2511 X - same as in RMatrixSolve
2512
2513 -- ALGLIB --
2514 Copyright 27.01.2010 by Bochkanov Sergey
2515*************************************************************************/
2516void hpdmatrixsolve(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_1d_array &b, ae_int_t &info, densesolverreport &rep, complex_1d_array &x);
2517void smp_hpdmatrixsolve(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_1d_array &b, ae_int_t &info, densesolverreport &rep, complex_1d_array &x);
2518
2519
2520/*************************************************************************
2521Dense solver for A*x=b, with N*N Hermitian positive definite matrix A, and
2522N*1 complex vectors x and b. "Fast-but-lightweight" version of the
2523solver without additional functions.
2524
2525Algorithm features:
2526* O(N^3) complexity
2527* matrix is represented by its upper or lower triangle
2528* no additional time consuming functions
2529
2530COMMERCIAL EDITION OF ALGLIB:
2531
2532 ! Commercial version of ALGLIB includes two important improvements of
2533 ! this function, which can be used from C++ and C#:
2534 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
2535 ! * multicore support
2536 !
2537 ! Intel MKL gives approximately constant (with respect to number of
2538 ! worker threads) acceleration factor which depends on CPU being used,
2539 ! problem size and "baseline" ALGLIB edition which is used for
2540 ! comparison.
2541 !
2542 ! Say, on SSE2-capable CPU with N=1024, HPC ALGLIB will be:
2543 ! * about 2-3x faster than ALGLIB for C++ without MKL
2544 ! * about 7-10x faster than "pure C#" edition of ALGLIB
2545 ! Difference in performance will be more striking on newer CPU's with
2546 ! support for newer SIMD instructions. Generally, MKL accelerates any
2547 ! problem whose size is at least 128, with best efficiency achieved for
2548 ! N's larger than 512.
2549 !
2550 ! Commercial edition of ALGLIB also supports multithreaded acceleration
2551 ! of this function. We should note that Cholesky decomposition is harder
2552 ! to parallelize than, say, matrix-matrix product - this algorithm has
2553 ! several synchronization points which can not be avoided. However,
2554 ! parallelism starts to be profitable starting from N=500.
2555 !
2556 ! In order to use multicore features you have to:
2557 ! * use commercial version of ALGLIB
2558 ! * call this function with "smp_" prefix, which indicates that
2559 ! multicore code will be used (for multicore support)
2560 !
2561 ! We recommend you to read 'Working with commercial version' section of
2562 ! ALGLIB Reference Manual in order to find out how to use performance-
2563 ! related features provided by commercial edition of ALGLIB.
2564
2565INPUT PARAMETERS
2566 A - array[0..N-1,0..N-1], system matrix
2567 N - size of A
2568 IsUpper - what half of A is provided
2569 B - array[0..N-1], right part
2570
2571OUTPUT PARAMETERS
2572 Info - return code:
2573 * -3 A is is exactly singular or not positive definite
2574 X is filled by zeros in such cases.
2575 * -1 N<=0 was passed
2576 * 1 task was solved
2577 B - array[0..N-1]:
2578 * overwritten by solution
2579 * zeros, if A is exactly singular (diagonal of its LU
2580 decomposition has exact zeros).
2581
2582 -- ALGLIB --
2583 Copyright 17.03.2015 by Bochkanov Sergey
2584*************************************************************************/
2585void hpdmatrixsolvefast(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_1d_array &b, ae_int_t &info);
2586void smp_hpdmatrixsolvefast(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_1d_array &b, ae_int_t &info);
2587
2588
2589/*************************************************************************
2590Dense solver for A*X=B with N*N Hermitian positive definite matrix A given
2591by its Cholesky decomposition and N*M complex matrices X and B. This is
2592"slow-but-feature-rich" version of the solver which, in addition to the
2593solution, estimates condition number of the system.
2594
2595Algorithm features:
2596* automatic detection of degenerate cases
2597* O(M*N^2) complexity
2598* condition number estimation
2599* matrix is represented by its upper or lower triangle
2600
2601No iterative refinement is provided because such partial representation of
2602matrix does not allow efficient calculation of extra-precise matrix-vector
2603products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2604need iterative refinement.
2605
2606IMPORTANT: ! this function is NOT the most efficient linear solver provided
2607 ! by ALGLIB. It estimates condition number of linear system,
2608 ! which results in significant performance penalty when
2609 ! compared with "fast" version which just calls triangular
2610 ! solver. Amount of overhead introduced depends on M (the
2611 ! larger - the more efficient).
2612 !
2613 ! This performance penalty is insignificant when compared with
2614 ! cost of large Cholesky decomposition. However, if you call
2615 ! this function many times for the same left side, this
2616 ! overhead BECOMES significant. It also becomes significant
2617 ! for small-scale problems (N<50).
2618 !
2619 ! In such cases we strongly recommend you to use faster solver,
2620 ! HPDMatrixCholeskySolveMFast() function.
2621
2622
2623INPUT PARAMETERS
2624 CHA - array[N,N], Cholesky decomposition,
2625 HPDMatrixCholesky result
2626 N - size of CHA
2627 IsUpper - what half of CHA is provided
2628 B - array[N,M], right part
2629 M - right part size
2630
2631OUTPUT PARAMETERS:
2632 Info - return code:
2633 * -3 A is singular, or VERY close to singular.
2634 X is filled by zeros in such cases.
2635 * -1 N<=0 was passed
2636 * 1 task was solved
2637 Rep - additional report, following fields are set:
2638 * rep.r1 condition number in 1-norm
2639 * rep.rinf condition number in inf-norm
2640 X - array[N]:
2641 * for info>0 contains solution
2642 * for info=-3 filled by zeros
2643
2644 -- ALGLIB --
2645 Copyright 27.01.2010 by Bochkanov Sergey
2646*************************************************************************/
2647void hpdmatrixcholeskysolvem(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
2648void smp_hpdmatrixcholeskysolvem(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info, densesolverreport &rep, complex_2d_array &x);
2649
2650
2651/*************************************************************************
2652Dense solver for A*X=B with N*N Hermitian positive definite matrix A given
2653by its Cholesky decomposition and N*M complex matrices X and B. This is
2654"fast-but-lightweight" version of the solver.
2655
2656Algorithm features:
2657* O(M*N^2) complexity
2658* matrix is represented by its upper or lower triangle
2659* no additional time-consuming features
2660
2661INPUT PARAMETERS
2662 CHA - array[N,N], Cholesky decomposition,
2663 HPDMatrixCholesky result
2664 N - size of CHA
2665 IsUpper - what half of CHA is provided
2666 B - array[N,M], right part
2667 M - right part size
2668
2669OUTPUT PARAMETERS:
2670 Info - return code:
2671 * -3 A is singular, or VERY close to singular.
2672 X is filled by zeros in such cases.
2673 * -1 N<=0 was passed
2674 * 1 task was solved
2675 B - array[N]:
2676 * for info>0 overwritten by solution
2677 * for info=-3 filled by zeros
2678
2679 -- ALGLIB --
2680 Copyright 18.03.2015 by Bochkanov Sergey
2681*************************************************************************/
2682void hpdmatrixcholeskysolvemfast(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info);
2683void smp_hpdmatrixcholeskysolvemfast(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_2d_array &b, const ae_int_t m, ae_int_t &info);
2684
2685
2686/*************************************************************************
2687Dense solver for A*x=b with N*N Hermitian positive definite matrix A given
2688by its Cholesky decomposition, and N*1 complex vectors x and b. This is
2689"slow-but-feature-rich" version of the solver which estimates condition
2690number of the system.
2691
2692Algorithm features:
2693* automatic detection of degenerate cases
2694* O(N^2) complexity
2695* condition number estimation
2696* matrix is represented by its upper or lower triangle
2697
2698No iterative refinement is provided because such partial representation of
2699matrix does not allow efficient calculation of extra-precise matrix-vector
2700products for large matrices. Use RMatrixSolve or RMatrixMixedSolve if you
2701need iterative refinement.
2702
2703IMPORTANT: ! this function is NOT the most efficient linear solver provided
2704 ! by ALGLIB. It estimates condition number of linear system,
2705 ! which results in 10-15x performance penalty when compared
2706 ! with "fast" version which just calls triangular solver.
2707 !
2708 ! This performance penalty is insignificant when compared with
2709 ! cost of large LU decomposition. However, if you call this
2710 ! function many times for the same left side, this overhead
2711 ! BECOMES significant. It also becomes significant for small-
2712 ! scale problems (N<50).
2713 !
2714 ! In such cases we strongly recommend you to use faster solver,
2715 ! HPDMatrixCholeskySolveFast() function.
2716
2717INPUT PARAMETERS
2718 CHA - array[0..N-1,0..N-1], Cholesky decomposition,
2719 SPDMatrixCholesky result
2720 N - size of A
2721 IsUpper - what half of CHA is provided
2722 B - array[0..N-1], right part
2723
2724OUTPUT PARAMETERS
2725 Info - return code:
2726 * -3 A is is exactly singular or ill conditioned
2727 X is filled by zeros in such cases.
2728 * -1 N<=0 was passed
2729 * 1 task is solved
2730 Rep - additional report, following fields are set:
2731 * rep.r1 condition number in 1-norm
2732 * rep.rinf condition number in inf-norm
2733 X - array[N]:
2734 * for info>0 - solution
2735 * for info=-3 - filled by zeros
2736
2737 -- ALGLIB --
2738 Copyright 27.01.2010 by Bochkanov Sergey
2739*************************************************************************/
2740void hpdmatrixcholeskysolve(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_1d_array &b, ae_int_t &info, densesolverreport &rep, complex_1d_array &x);
2741
2742
2743/*************************************************************************
2744Dense solver for A*x=b with N*N Hermitian positive definite matrix A given
2745by its Cholesky decomposition, and N*1 complex vectors x and b. This is
2746"fast-but-lightweight" version of the solver.
2747
2748Algorithm features:
2749* O(N^2) complexity
2750* matrix is represented by its upper or lower triangle
2751* no additional time-consuming features
2752
2753INPUT PARAMETERS
2754 CHA - array[0..N-1,0..N-1], Cholesky decomposition,
2755 SPDMatrixCholesky result
2756 N - size of A
2757 IsUpper - what half of CHA is provided
2758 B - array[0..N-1], right part
2759
2760OUTPUT PARAMETERS
2761 Info - return code:
2762 * -3 A is is exactly singular or ill conditioned
2763 B is filled by zeros in such cases.
2764 * -1 N<=0 was passed
2765 * 1 task is solved
2766 B - array[N]:
2767 * for info>0 - overwritten by solution
2768 * for info=-3 - filled by zeros
2769
2770 -- ALGLIB --
2771 Copyright 18.03.2015 by Bochkanov Sergey
2772*************************************************************************/
2773void hpdmatrixcholeskysolvefast(const complex_2d_array &cha, const ae_int_t n, const bool isupper, const complex_1d_array &b, ae_int_t &info);
2774
2775
2776/*************************************************************************
2777Dense solver.
2778
2779This subroutine finds solution of the linear system A*X=B with non-square,
2780possibly degenerate A. System is solved in the least squares sense, and
2781general least squares solution X = X0 + CX*y which minimizes |A*X-B| is
2782returned. If A is non-degenerate, solution in the usual sense is returned.
2783
2784Algorithm features:
2785* automatic detection (and correct handling!) of degenerate cases
2786* iterative refinement
2787* O(N^3) complexity
2788
2789COMMERCIAL EDITION OF ALGLIB:
2790
2791 ! Commercial version of ALGLIB includes one important improvement of
2792 ! this function, which can be used from C++ and C#:
2793 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB)
2794 !
2795 ! Intel MKL gives approximately constant (with respect to number of
2796 ! worker threads) acceleration factor which depends on CPU being used,
2797 ! problem size and "baseline" ALGLIB edition which is used for
2798 ! comparison.
2799 !
2800 ! Generally, commercial ALGLIB is several times faster than open-source
2801 ! generic C edition, and many times faster than open-source C# edition.
2802 !
2803 ! Multithreaded acceleration is only partially supported (some parts are
2804 ! optimized, but most - are not).
2805 !
2806 ! We recommend you to read 'Working with commercial version' section of
2807 ! ALGLIB Reference Manual in order to find out how to use performance-
2808 ! related features provided by commercial edition of ALGLIB.
2809
2810INPUT PARAMETERS
2811 A - array[0..NRows-1,0..NCols-1], system matrix
2812 NRows - vertical size of A
2813 NCols - horizontal size of A
2814 B - array[0..NCols-1], right part
2815 Threshold- a number in [0,1]. Singular values beyond Threshold are
2816 considered zero. Set it to 0.0, if you don't understand
2817 what it means, so the solver will choose good value on its
2818 own.
2819
2820OUTPUT PARAMETERS
2821 Info - return code:
2822 * -4 SVD subroutine failed
2823 * -1 if NRows<=0 or NCols<=0 or Threshold<0 was passed
2824 * 1 if task is solved
2825 Rep - solver report, see below for more info
2826 X - array[0..N-1,0..M-1], it contains:
2827 * solution of A*X=B (even for singular A)
2828 * zeros, if SVD subroutine failed
2829
2830SOLVER REPORT
2831
2832Subroutine sets following fields of the Rep structure:
2833* R2 reciprocal of condition number: 1/cond(A), 2-norm.
2834* N = NCols
2835* K dim(Null(A))
2836* CX array[0..N-1,0..K-1], kernel of A.
2837 Columns of CX store such vectors that A*CX[i]=0.
2838
2839 -- ALGLIB --
2840 Copyright 24.08.2009 by Bochkanov Sergey
2841*************************************************************************/
2842void rmatrixsolvels(const real_2d_array &a, const ae_int_t nrows, const ae_int_t ncols, const real_1d_array &b, const double threshold, ae_int_t &info, densesolverlsreport &rep, real_1d_array &x);
2843void smp_rmatrixsolvels(const real_2d_array &a, const ae_int_t nrows, const ae_int_t ncols, const real_1d_array &b, const double threshold, ae_int_t &info, densesolverlsreport &rep, real_1d_array &x);
2844
2845/*************************************************************************
2846This function initializes linear LSQR Solver. This solver is used to solve
2847non-symmetric (and, possibly, non-square) problems. Least squares solution
2848is returned for non-compatible systems.
2849
2850USAGE:
28511. User initializes algorithm state with LinLSQRCreate() call
28522. User tunes solver parameters with LinLSQRSetCond() and other functions
28533. User calls LinLSQRSolveSparse() function which takes algorithm state
2854 and SparseMatrix object.
28554. User calls LinLSQRResults() to get solution
28565. Optionally, user may call LinLSQRSolveSparse() again to solve another
2857 problem with different matrix and/or right part without reinitializing
2858 LinLSQRState structure.
2859
2860INPUT PARAMETERS:
2861 M - number of rows in A
2862 N - number of variables, N>0
2863
2864OUTPUT PARAMETERS:
2865 State - structure which stores algorithm state
2866
2867 -- ALGLIB --
2868 Copyright 30.11.2011 by Bochkanov Sergey
2869*************************************************************************/
2870void linlsqrcreate(const ae_int_t m, const ae_int_t n, linlsqrstate &state);
2871
2872
2873/*************************************************************************
2874This function changes preconditioning settings of LinLSQQSolveSparse()
2875function. By default, SolveSparse() uses diagonal preconditioner, but if
2876you want to use solver without preconditioning, you can call this function
2877which forces solver to use unit matrix for preconditioning.
2878
2879INPUT PARAMETERS:
2880 State - structure which stores algorithm state
2881
2882 -- ALGLIB --
2883 Copyright 19.11.2012 by Bochkanov Sergey
2884*************************************************************************/
2885void linlsqrsetprecunit(const linlsqrstate &state);
2886
2887
2888/*************************************************************************
2889This function changes preconditioning settings of LinCGSolveSparse()
2890function. LinCGSolveSparse() will use diagonal of the system matrix as
2891preconditioner. This preconditioning mode is active by default.
2892
2893INPUT PARAMETERS:
2894 State - structure which stores algorithm state
2895
2896 -- ALGLIB --
2897 Copyright 19.11.2012 by Bochkanov Sergey
2898*************************************************************************/
2899void linlsqrsetprecdiag(const linlsqrstate &state);
2900
2901
2902/*************************************************************************
2903This function sets optional Tikhonov regularization coefficient.
2904It is zero by default.
2905
2906INPUT PARAMETERS:
2907 LambdaI - regularization factor, LambdaI>=0
2908
2909OUTPUT PARAMETERS:
2910 State - structure which stores algorithm state
2911
2912 -- ALGLIB --
2913 Copyright 30.11.2011 by Bochkanov Sergey
2914*************************************************************************/
2915void linlsqrsetlambdai(const linlsqrstate &state, const double lambdai);
2916
2917
2918/*************************************************************************
2919Procedure for solution of A*x=b with sparse A.
2920
2921INPUT PARAMETERS:
2922 State - algorithm state
2923 A - sparse M*N matrix in the CRS format (you MUST contvert it
2924 to CRS format by calling SparseConvertToCRS() function
2925 BEFORE you pass it to this function).
2926 B - right part, array[M]
2927
2928RESULT:
2929 This function returns no result.
2930 You can get solution by calling LinCGResults()
2931
2932NOTE: this function uses lightweight preconditioning - multiplication by
2933 inverse of diag(A). If you want, you can turn preconditioning off by
2934 calling LinLSQRSetPrecUnit(). However, preconditioning cost is low
2935 and preconditioner is very important for solution of badly scaled
2936 problems.
2937
2938 -- ALGLIB --
2939 Copyright 30.11.2011 by Bochkanov Sergey
2940*************************************************************************/
2941void linlsqrsolvesparse(const linlsqrstate &state, const sparsematrix &a, const real_1d_array &b);
2942
2943
2944/*************************************************************************
2945This function sets stopping criteria.
2946
2947INPUT PARAMETERS:
2948 EpsA - algorithm will be stopped if ||A^T*Rk||/(||A||*||Rk||)<=EpsA.
2949 EpsB - algorithm will be stopped if ||Rk||<=EpsB*||B||
2950 MaxIts - algorithm will be stopped if number of iterations
2951 more than MaxIts.
2952
2953OUTPUT PARAMETERS:
2954 State - structure which stores algorithm state
2955
2956NOTE: if EpsA,EpsB,EpsC and MaxIts are zero then these variables will
2957be setted as default values.
2958
2959 -- ALGLIB --
2960 Copyright 30.11.2011 by Bochkanov Sergey
2961*************************************************************************/
2962void linlsqrsetcond(const linlsqrstate &state, const double epsa, const double epsb, const ae_int_t maxits);
2963
2964
2965/*************************************************************************
2966LSQR solver: results.
2967
2968This function must be called after LinLSQRSolve
2969
2970INPUT PARAMETERS:
2971 State - algorithm state
2972
2973OUTPUT PARAMETERS:
2974 X - array[N], solution
2975 Rep - optimization report:
2976 * Rep.TerminationType completetion code:
2977 * 1 ||Rk||<=EpsB*||B||
2978 * 4 ||A^T*Rk||/(||A||*||Rk||)<=EpsA
2979 * 5 MaxIts steps was taken
2980 * 7 rounding errors prevent further progress,
2981 X contains best point found so far.
2982 (sometimes returned on singular systems)
2983 * Rep.IterationsCount contains iterations count
2984 * NMV countains number of matrix-vector calculations
2985
2986 -- ALGLIB --
2987 Copyright 30.11.2011 by Bochkanov Sergey
2988*************************************************************************/
2989void linlsqrresults(const linlsqrstate &state, real_1d_array &x, linlsqrreport &rep);
2990
2991
2992/*************************************************************************
2993This function turns on/off reporting.
2994
2995INPUT PARAMETERS:
2996 State - structure which stores algorithm state
2997 NeedXRep- whether iteration reports are needed or not
2998
2999If NeedXRep is True, algorithm will call rep() callback function if it is
3000provided to MinCGOptimize().
3001
3002 -- ALGLIB --
3003 Copyright 30.11.2011 by Bochkanov Sergey
3004*************************************************************************/
3005void linlsqrsetxrep(const linlsqrstate &state, const bool needxrep);
3006
3007/*************************************************************************
3008Polynomial root finding.
3009
3010This function returns all roots of the polynomial
3011 P(x) = a0 + a1*x + a2*x^2 + ... + an*x^n
3012Both real and complex roots are returned (see below).
3013
3014INPUT PARAMETERS:
3015 A - array[N+1], polynomial coefficients:
3016 * A[0] is constant term
3017 * A[N] is a coefficient of X^N
3018 N - polynomial degree
3019
3020OUTPUT PARAMETERS:
3021 X - array of complex roots:
3022 * for isolated real root, X[I] is strictly real: IMAGE(X[I])=0
3023 * complex roots are always returned in pairs - roots occupy
3024 positions I and I+1, with:
3025 * X[I+1]=Conj(X[I])
3026 * IMAGE(X[I]) > 0
3027 * IMAGE(X[I+1]) = -IMAGE(X[I]) < 0
3028 * multiple real roots may have non-zero imaginary part due
3029 to roundoff errors. There is no reliable way to distinguish
3030 real root of multiplicity 2 from two complex roots in
3031 the presence of roundoff errors.
3032 Rep - report, additional information, following fields are set:
3033 * Rep.MaxErr - max( |P(xi)| ) for i=0..N-1. This field
3034 allows to quickly estimate "quality" of the roots being
3035 returned.
3036
3037NOTE: this function uses companion matrix method to find roots. In case
3038 internal EVD solver fails do find eigenvalues, exception is
3039 generated.
3040
3041NOTE: roots are not "polished" and no matrix balancing is performed
3042 for them.
3043
3044 -- ALGLIB --
3045 Copyright 24.02.2014 by Bochkanov Sergey
3046*************************************************************************/
3047void polynomialsolve(const real_1d_array &a, const ae_int_t n, complex_1d_array &x, polynomialsolverreport &rep);
3048
3049/*************************************************************************
3050 LEVENBERG-MARQUARDT-LIKE NONLINEAR SOLVER
3051
3052DESCRIPTION:
3053This algorithm solves system of nonlinear equations
3054 F[0](x[0], ..., x[n-1]) = 0
3055 F[1](x[0], ..., x[n-1]) = 0
3056 ...
3057 F[M-1](x[0], ..., x[n-1]) = 0
3058with M/N do not necessarily coincide. Algorithm converges quadratically
3059under following conditions:
3060 * the solution set XS is nonempty
3061 * for some xs in XS there exist such neighbourhood N(xs) that:
3062 * vector function F(x) and its Jacobian J(x) are continuously
3063 differentiable on N
3064 * ||F(x)|| provides local error bound on N, i.e. there exists such
3065 c1, that ||F(x)||>c1*distance(x,XS)
3066Note that these conditions are much more weaker than usual non-singularity
3067conditions. For example, algorithm will converge for any affine function
3068F (whether its Jacobian singular or not).
3069
3070
3071REQUIREMENTS:
3072Algorithm will request following information during its operation:
3073* function vector F[] and Jacobian matrix at given point X
3074* value of merit function f(x)=F[0]^2(x)+...+F[M-1]^2(x) at given point X
3075
3076
3077USAGE:
30781. User initializes algorithm state with NLEQCreateLM() call
30792. User tunes solver parameters with NLEQSetCond(), NLEQSetStpMax() and
3080 other functions
30813. User calls NLEQSolve() function which takes algorithm state and
3082 pointers (delegates, etc.) to callback functions which calculate merit
3083 function value and Jacobian.
30844. User calls NLEQResults() to get solution
30855. Optionally, user may call NLEQRestartFrom() to solve another problem
3086 with same parameters (N/M) but another starting point and/or another
3087 function vector. NLEQRestartFrom() allows to reuse already initialized
3088 structure.
3089
3090
3091INPUT PARAMETERS:
3092 N - space dimension, N>1:
3093 * if provided, only leading N elements of X are used
3094 * if not provided, determined automatically from size of X
3095 M - system size
3096 X - starting point
3097
3098
3099OUTPUT PARAMETERS:
3100 State - structure which stores algorithm state
3101
3102
3103NOTES:
31041. you may tune stopping conditions with NLEQSetCond() function
31052. if target function contains exp() or other fast growing functions, and
3106 optimization algorithm makes too large steps which leads to overflow,
3107 use NLEQSetStpMax() function to bound algorithm's steps.
31083. this algorithm is a slightly modified implementation of the method
3109 described in 'Levenberg-Marquardt method for constrained nonlinear
3110 equations with strong local convergence properties' by Christian Kanzow
3111 Nobuo Yamashita and Masao Fukushima and further developed in 'On the
3112 convergence of a New Levenberg-Marquardt Method' by Jin-yan Fan and
3113 Ya-Xiang Yuan.
3114
3115
3116 -- ALGLIB --
3117 Copyright 20.08.2009 by Bochkanov Sergey
3118*************************************************************************/
3119void nleqcreatelm(const ae_int_t n, const ae_int_t m, const real_1d_array &x, nleqstate &state);
3120void nleqcreatelm(const ae_int_t m, const real_1d_array &x, nleqstate &state);
3121
3122
3123/*************************************************************************
3124This function sets stopping conditions for the nonlinear solver
3125
3126INPUT PARAMETERS:
3127 State - structure which stores algorithm state
3128 EpsF - >=0
3129 The subroutine finishes its work if on k+1-th iteration
3130 the condition ||F||<=EpsF is satisfied
3131 MaxIts - maximum number of iterations. If MaxIts=0, the number of
3132 iterations is unlimited.
3133
3134Passing EpsF=0 and MaxIts=0 simultaneously will lead to automatic
3135stopping criterion selection (small EpsF).
3136
3137NOTES:
3138
3139 -- ALGLIB --
3140 Copyright 20.08.2010 by Bochkanov Sergey
3141*************************************************************************/
3142void nleqsetcond(const nleqstate &state, const double epsf, const ae_int_t maxits);
3143
3144
3145/*************************************************************************
3146This function turns on/off reporting.
3147
3148INPUT PARAMETERS:
3149 State - structure which stores algorithm state
3150 NeedXRep- whether iteration reports are needed or not
3151
3152If NeedXRep is True, algorithm will call rep() callback function if it is
3153provided to NLEQSolve().
3154
3155 -- ALGLIB --
3156 Copyright 20.08.2010 by Bochkanov Sergey
3157*************************************************************************/
3158void nleqsetxrep(const nleqstate &state, const bool needxrep);
3159
3160
3161/*************************************************************************
3162This function sets maximum step length
3163
3164INPUT PARAMETERS:
3165 State - structure which stores algorithm state
3166 StpMax - maximum step length, >=0. Set StpMax to 0.0, if you don't
3167 want to limit step length.
3168
3169Use this subroutine when target function contains exp() or other fast
3170growing functions, and algorithm makes too large steps which lead to
3171overflow. This function allows us to reject steps that are too large (and
3172therefore expose us to the possible overflow) without actually calculating
3173function value at the x+stp*d.
3174
3175 -- ALGLIB --
3176 Copyright 20.08.2010 by Bochkanov Sergey
3177*************************************************************************/
3178void nleqsetstpmax(const nleqstate &state, const double stpmax);
3179
3180
3181/*************************************************************************
3182This function provides reverse communication interface
3183Reverse communication interface is not documented or recommended to use.
3184See below for functions which provide better documented API
3185*************************************************************************/
3186bool nleqiteration(const nleqstate &state);
3187
3188
3189/*************************************************************************
3190This family of functions is used to launcn iterations of nonlinear solver
3191
3192These functions accept following parameters:
3193 state - algorithm state
3194 func - callback which calculates function (or merit function)
3195 value func at given point x
3196 jac - callback which calculates function vector fi[]
3197 and Jacobian jac at given point x
3198 rep - optional callback which is called after each iteration
3199 can be NULL
3200 ptr - optional pointer which is passed to func/grad/hess/jac/rep
3201 can be NULL
3202
3203
3204 -- ALGLIB --
3205 Copyright 20.03.2009 by Bochkanov Sergey
3206
3207*************************************************************************/
3208void nleqsolve(nleqstate &state,
3209 void (*func)(const real_1d_array &x, double &func, void *ptr),
3210 void (*jac)(const real_1d_array &x, real_1d_array &fi, real_2d_array &jac, void *ptr),
3211 void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL,
3212 void *ptr = NULL);
3213
3214
3215/*************************************************************************
3216NLEQ solver results
3217
3218INPUT PARAMETERS:
3219 State - algorithm state.
3220
3221OUTPUT PARAMETERS:
3222 X - array[0..N-1], solution
3223 Rep - optimization report:
3224 * Rep.TerminationType completetion code:
3225 * -4 ERROR: algorithm has converged to the
3226 stationary point Xf which is local minimum of
3227 f=F[0]^2+...+F[m-1]^2, but is not solution of
3228 nonlinear system.
3229 * 1 sqrt(f)<=EpsF.
3230 * 5 MaxIts steps was taken
3231 * 7 stopping conditions are too stringent,
3232 further improvement is impossible
3233 * Rep.IterationsCount contains iterations count
3234 * NFEV countains number of function calculations
3235 * ActiveConstraints contains number of active constraints
3236
3237 -- ALGLIB --
3238 Copyright 20.08.2009 by Bochkanov Sergey
3239*************************************************************************/
3240void nleqresults(const nleqstate &state, real_1d_array &x, nleqreport &rep);
3241
3242
3243/*************************************************************************
3244NLEQ solver results
3245
3246Buffered implementation of NLEQResults(), which uses pre-allocated buffer
3247to store X[]. If buffer size is too small, it resizes buffer. It is
3248intended to be used in the inner cycles of performance critical algorithms
3249where array reallocation penalty is too large to be ignored.
3250
3251 -- ALGLIB --
3252 Copyright 20.08.2009 by Bochkanov Sergey
3253*************************************************************************/
3254void nleqresultsbuf(const nleqstate &state, real_1d_array &x, nleqreport &rep);
3255
3256
3257/*************************************************************************
3258This subroutine restarts CG algorithm from new point. All optimization
3259parameters are left unchanged.
3260
3261This function allows to solve multiple optimization problems (which
3262must have same number of dimensions) without object reallocation penalty.
3263
3264INPUT PARAMETERS:
3265 State - structure used for reverse communication previously
3266 allocated with MinCGCreate call.
3267 X - new starting point.
3268 BndL - new lower bounds
3269 BndU - new upper bounds
3270
3271 -- ALGLIB --
3272 Copyright 30.07.2010 by Bochkanov Sergey
3273*************************************************************************/
3274void nleqrestartfrom(const nleqstate &state, const real_1d_array &x);
3275
3276/*************************************************************************
3277This function initializes linear CG Solver. This solver is used to solve
3278symmetric positive definite problems. If you want to solve nonsymmetric
3279(or non-positive definite) problem you may use LinLSQR solver provided by
3280ALGLIB.
3281
3282USAGE:
32831. User initializes algorithm state with LinCGCreate() call
32842. User tunes solver parameters with LinCGSetCond() and other functions
32853. Optionally, user sets starting point with LinCGSetStartingPoint()
32864. User calls LinCGSolveSparse() function which takes algorithm state and
3287 SparseMatrix object.
32885. User calls LinCGResults() to get solution
32896. Optionally, user may call LinCGSolveSparse() again to solve another
3290 problem with different matrix and/or right part without reinitializing
3291 LinCGState structure.
3292
3293INPUT PARAMETERS:
3294 N - problem dimension, N>0
3295
3296OUTPUT PARAMETERS:
3297 State - structure which stores algorithm state
3298
3299 -- ALGLIB --
3300 Copyright 14.11.2011 by Bochkanov Sergey
3301*************************************************************************/
3302void lincgcreate(const ae_int_t n, lincgstate &state);
3303
3304
3305/*************************************************************************
3306This function sets starting point.
3307By default, zero starting point is used.
3308
3309INPUT PARAMETERS:
3310 X - starting point, array[N]
3311
3312OUTPUT PARAMETERS:
3313 State - structure which stores algorithm state
3314
3315 -- ALGLIB --
3316 Copyright 14.11.2011 by Bochkanov Sergey
3317*************************************************************************/
3318void lincgsetstartingpoint(const lincgstate &state, const real_1d_array &x);
3319
3320
3321/*************************************************************************
3322This function changes preconditioning settings of LinCGSolveSparse()
3323function. By default, SolveSparse() uses diagonal preconditioner, but if
3324you want to use solver without preconditioning, you can call this function
3325which forces solver to use unit matrix for preconditioning.
3326
3327INPUT PARAMETERS:
3328 State - structure which stores algorithm state
3329
3330 -- ALGLIB --
3331 Copyright 19.11.2012 by Bochkanov Sergey
3332*************************************************************************/
3333void lincgsetprecunit(const lincgstate &state);
3334
3335
3336/*************************************************************************
3337This function changes preconditioning settings of LinCGSolveSparse()
3338function. LinCGSolveSparse() will use diagonal of the system matrix as
3339preconditioner. This preconditioning mode is active by default.
3340
3341INPUT PARAMETERS:
3342 State - structure which stores algorithm state
3343
3344 -- ALGLIB --
3345 Copyright 19.11.2012 by Bochkanov Sergey
3346*************************************************************************/
3347void lincgsetprecdiag(const lincgstate &state);
3348
3349
3350/*************************************************************************
3351This function sets stopping criteria.
3352
3353INPUT PARAMETERS:
3354 EpsF - algorithm will be stopped if norm of residual is less than
3355 EpsF*||b||.
3356 MaxIts - algorithm will be stopped if number of iterations is more
3357 than MaxIts.
3358
3359OUTPUT PARAMETERS:
3360 State - structure which stores algorithm state
3361
3362NOTES:
3363If both EpsF and MaxIts are zero then small EpsF will be set to small
3364value.
3365
3366 -- ALGLIB --
3367 Copyright 14.11.2011 by Bochkanov Sergey
3368*************************************************************************/
3369void lincgsetcond(const lincgstate &state, const double epsf, const ae_int_t maxits);
3370
3371
3372/*************************************************************************
3373Procedure for solution of A*x=b with sparse A.
3374
3375INPUT PARAMETERS:
3376 State - algorithm state
3377 A - sparse matrix in the CRS format (you MUST contvert it to
3378 CRS format by calling SparseConvertToCRS() function).
3379 IsUpper - whether upper or lower triangle of A is used:
3380 * IsUpper=True => only upper triangle is used and lower
3381 triangle is not referenced at all
3382 * IsUpper=False => only lower triangle is used and upper
3383 triangle is not referenced at all
3384 B - right part, array[N]
3385
3386RESULT:
3387 This function returns no result.
3388 You can get solution by calling LinCGResults()
3389
3390NOTE: this function uses lightweight preconditioning - multiplication by
3391 inverse of diag(A). If you want, you can turn preconditioning off by
3392 calling LinCGSetPrecUnit(). However, preconditioning cost is low and
3393 preconditioner is very important for solution of badly scaled
3394 problems.
3395
3396 -- ALGLIB --
3397 Copyright 14.11.2011 by Bochkanov Sergey
3398*************************************************************************/
3399void lincgsolvesparse(const lincgstate &state, const sparsematrix &a, const bool isupper, const real_1d_array &b);
3400
3401
3402/*************************************************************************
3403CG-solver: results.
3404
3405This function must be called after LinCGSolve
3406
3407INPUT PARAMETERS:
3408 State - algorithm state
3409
3410OUTPUT PARAMETERS:
3411 X - array[N], solution
3412 Rep - optimization report:
3413 * Rep.TerminationType completetion code:
3414 * -5 input matrix is either not positive definite,
3415 too large or too small
3416 * -4 overflow/underflow during solution
3417 (ill conditioned problem)
3418 * 1 ||residual||<=EpsF*||b||
3419 * 5 MaxIts steps was taken
3420 * 7 rounding errors prevent further progress,
3421 best point found is returned
3422 * Rep.IterationsCount contains iterations count
3423 * NMV countains number of matrix-vector calculations
3424
3425 -- ALGLIB --
3426 Copyright 14.11.2011 by Bochkanov Sergey
3427*************************************************************************/
3428void lincgresults(const lincgstate &state, real_1d_array &x, lincgreport &rep);
3429
3430
3431/*************************************************************************
3432This function sets restart frequency. By default, algorithm is restarted
3433after N subsequent iterations.
3434
3435 -- ALGLIB --
3436 Copyright 14.11.2011 by Bochkanov Sergey
3437*************************************************************************/
3438void lincgsetrestartfreq(const lincgstate &state, const ae_int_t srf);
3439
3440
3441/*************************************************************************
3442This function sets frequency of residual recalculations.
3443
3444Algorithm updates residual r_k using iterative formula, but recalculates
3445it from scratch after each 10 iterations. It is done to avoid accumulation
3446of numerical errors and to stop algorithm when r_k starts to grow.
3447
3448Such low update frequence (1/10) gives very little overhead, but makes
3449algorithm a bit more robust against numerical errors. However, you may
3450change it
3451
3452INPUT PARAMETERS:
3453 Freq - desired update frequency, Freq>=0.
3454 Zero value means that no updates will be done.
3455
3456 -- ALGLIB --
3457 Copyright 14.11.2011 by Bochkanov Sergey
3458*************************************************************************/
3459void lincgsetrupdatefreq(const lincgstate &state, const ae_int_t freq);
3460
3461
3462/*************************************************************************
3463This function turns on/off reporting.
3464
3465INPUT PARAMETERS:
3466 State - structure which stores algorithm state
3467 NeedXRep- whether iteration reports are needed or not
3468
3469If NeedXRep is True, algorithm will call rep() callback function if it is
3470provided to MinCGOptimize().
3471
3472 -- ALGLIB --
3473 Copyright 14.11.2011 by Bochkanov Sergey
3474*************************************************************************/
3475void lincgsetxrep(const lincgstate &state, const bool needxrep);
3476}
3477
3479//
3480// THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS)
3481//
3483namespace alglib_impl
3484{
3485void rmatrixsolve(/* Real */ ae_matrix* a,
3486 ae_int_t n,
3487 /* Real */ ae_vector* b,
3488 ae_int_t* info,
3489 densesolverreport* rep,
3490 /* Real */ ae_vector* x,
3491 ae_state *_state);
3492void _pexec_rmatrixsolve(/* Real */ ae_matrix* a,
3493 ae_int_t n,
3494 /* Real */ ae_vector* b,
3495 ae_int_t* info,
3496 densesolverreport* rep,
3497 /* Real */ ae_vector* x, ae_state *_state);
3498void rmatrixsolvefast(/* Real */ ae_matrix* a,
3499 ae_int_t n,
3500 /* Real */ ae_vector* b,
3501 ae_int_t* info,
3502 ae_state *_state);
3503void _pexec_rmatrixsolvefast(/* Real */ ae_matrix* a,
3504 ae_int_t n,
3505 /* Real */ ae_vector* b,
3506 ae_int_t* info, ae_state *_state);
3507void rmatrixsolvem(/* Real */ ae_matrix* a,
3508 ae_int_t n,
3509 /* Real */ ae_matrix* b,
3510 ae_int_t m,
3511 ae_bool rfs,
3512 ae_int_t* info,
3513 densesolverreport* rep,
3514 /* Real */ ae_matrix* x,
3515 ae_state *_state);
3516void _pexec_rmatrixsolvem(/* Real */ ae_matrix* a,
3517 ae_int_t n,
3518 /* Real */ ae_matrix* b,
3519 ae_int_t m,
3520 ae_bool rfs,
3521 ae_int_t* info,
3522 densesolverreport* rep,
3523 /* Real */ ae_matrix* x, ae_state *_state);
3524void rmatrixsolvemfast(/* Real */ ae_matrix* a,
3525 ae_int_t n,
3526 /* Real */ ae_matrix* b,
3527 ae_int_t m,
3528 ae_int_t* info,
3529 ae_state *_state);
3530void _pexec_rmatrixsolvemfast(/* Real */ ae_matrix* a,
3531 ae_int_t n,
3532 /* Real */ ae_matrix* b,
3533 ae_int_t m,
3534 ae_int_t* info, ae_state *_state);
3535void rmatrixlusolve(/* Real */ ae_matrix* lua,
3536 /* Integer */ ae_vector* p,
3537 ae_int_t n,
3538 /* Real */ ae_vector* b,
3539 ae_int_t* info,
3540 densesolverreport* rep,
3541 /* Real */ ae_vector* x,
3542 ae_state *_state);
3543void rmatrixlusolvefast(/* Real */ ae_matrix* lua,
3544 /* Integer */ ae_vector* p,
3545 ae_int_t n,
3546 /* Real */ ae_vector* b,
3547 ae_int_t* info,
3548 ae_state *_state);
3549void rmatrixlusolvem(/* Real */ ae_matrix* lua,
3550 /* Integer */ ae_vector* p,
3551 ae_int_t n,
3552 /* Real */ ae_matrix* b,
3553 ae_int_t m,
3554 ae_int_t* info,
3555 densesolverreport* rep,
3556 /* Real */ ae_matrix* x,
3557 ae_state *_state);
3558void _pexec_rmatrixlusolvem(/* Real */ ae_matrix* lua,
3559 /* Integer */ ae_vector* p,
3560 ae_int_t n,
3561 /* Real */ ae_matrix* b,
3562 ae_int_t m,
3563 ae_int_t* info,
3564 densesolverreport* rep,
3565 /* Real */ ae_matrix* x, ae_state *_state);
3566void rmatrixlusolvemfast(/* Real */ ae_matrix* lua,
3567 /* Integer */ ae_vector* p,
3568 ae_int_t n,
3569 /* Real */ ae_matrix* b,
3570 ae_int_t m,
3571 ae_int_t* info,
3572 ae_state *_state);
3573void _pexec_rmatrixlusolvemfast(/* Real */ ae_matrix* lua,
3574 /* Integer */ ae_vector* p,
3575 ae_int_t n,
3576 /* Real */ ae_matrix* b,
3577 ae_int_t m,
3578 ae_int_t* info, ae_state *_state);
3579void rmatrixmixedsolve(/* Real */ ae_matrix* a,
3580 /* Real */ ae_matrix* lua,
3581 /* Integer */ ae_vector* p,
3582 ae_int_t n,
3583 /* Real */ ae_vector* b,
3584 ae_int_t* info,
3585 densesolverreport* rep,
3586 /* Real */ ae_vector* x,
3587 ae_state *_state);
3588void rmatrixmixedsolvem(/* Real */ ae_matrix* a,
3589 /* Real */ ae_matrix* lua,
3590 /* Integer */ ae_vector* p,
3591 ae_int_t n,
3592 /* Real */ ae_matrix* b,
3593 ae_int_t m,
3594 ae_int_t* info,
3595 densesolverreport* rep,
3596 /* Real */ ae_matrix* x,
3597 ae_state *_state);
3598void cmatrixsolvem(/* Complex */ ae_matrix* a,
3599 ae_int_t n,
3600 /* Complex */ ae_matrix* b,
3601 ae_int_t m,
3602 ae_bool rfs,
3603 ae_int_t* info,
3604 densesolverreport* rep,
3605 /* Complex */ ae_matrix* x,
3606 ae_state *_state);
3607void _pexec_cmatrixsolvem(/* Complex */ ae_matrix* a,
3608 ae_int_t n,
3609 /* Complex */ ae_matrix* b,
3610 ae_int_t m,
3611 ae_bool rfs,
3612 ae_int_t* info,
3613 densesolverreport* rep,
3614 /* Complex */ ae_matrix* x, ae_state *_state);
3615void cmatrixsolvemfast(/* Complex */ ae_matrix* a,
3616 ae_int_t n,
3617 /* Complex */ ae_matrix* b,
3618 ae_int_t m,
3619 ae_int_t* info,
3620 ae_state *_state);
3621void _pexec_cmatrixsolvemfast(/* Complex */ ae_matrix* a,
3622 ae_int_t n,
3623 /* Complex */ ae_matrix* b,
3624 ae_int_t m,
3625 ae_int_t* info, ae_state *_state);
3626void cmatrixsolve(/* Complex */ ae_matrix* a,
3627 ae_int_t n,
3628 /* Complex */ ae_vector* b,
3629 ae_int_t* info,
3630 densesolverreport* rep,
3631 /* Complex */ ae_vector* x,
3632 ae_state *_state);
3633void _pexec_cmatrixsolve(/* Complex */ ae_matrix* a,
3634 ae_int_t n,
3635 /* Complex */ ae_vector* b,
3636 ae_int_t* info,
3637 densesolverreport* rep,
3638 /* Complex */ ae_vector* x, ae_state *_state);
3639void cmatrixsolvefast(/* Complex */ ae_matrix* a,
3640 ae_int_t n,
3641 /* Complex */ ae_vector* b,
3642 ae_int_t* info,
3643 ae_state *_state);
3644void _pexec_cmatrixsolvefast(/* Complex */ ae_matrix* a,
3645 ae_int_t n,
3646 /* Complex */ ae_vector* b,
3647 ae_int_t* info, ae_state *_state);
3648void cmatrixlusolvem(/* Complex */ ae_matrix* lua,
3649 /* Integer */ ae_vector* p,
3650 ae_int_t n,
3651 /* Complex */ ae_matrix* b,
3652 ae_int_t m,
3653 ae_int_t* info,
3654 densesolverreport* rep,
3655 /* Complex */ ae_matrix* x,
3656 ae_state *_state);
3657void _pexec_cmatrixlusolvem(/* Complex */ ae_matrix* lua,
3658 /* Integer */ ae_vector* p,
3659 ae_int_t n,
3660 /* Complex */ ae_matrix* b,
3661 ae_int_t m,
3662 ae_int_t* info,
3663 densesolverreport* rep,
3664 /* Complex */ ae_matrix* x, ae_state *_state);
3665void cmatrixlusolvemfast(/* Complex */ ae_matrix* lua,
3666 /* Integer */ ae_vector* p,
3667 ae_int_t n,
3668 /* Complex */ ae_matrix* b,
3669 ae_int_t m,
3670 ae_int_t* info,
3671 ae_state *_state);
3672void _pexec_cmatrixlusolvemfast(/* Complex */ ae_matrix* lua,
3673 /* Integer */ ae_vector* p,
3674 ae_int_t n,
3675 /* Complex */ ae_matrix* b,
3676 ae_int_t m,
3677 ae_int_t* info, ae_state *_state);
3678void cmatrixlusolve(/* Complex */ ae_matrix* lua,
3679 /* Integer */ ae_vector* p,
3680 ae_int_t n,
3681 /* Complex */ ae_vector* b,
3682 ae_int_t* info,
3683 densesolverreport* rep,
3684 /* Complex */ ae_vector* x,
3685 ae_state *_state);
3686void cmatrixlusolvefast(/* Complex */ ae_matrix* lua,
3687 /* Integer */ ae_vector* p,
3688 ae_int_t n,
3689 /* Complex */ ae_vector* b,
3690 ae_int_t* info,
3691 ae_state *_state);
3692void cmatrixmixedsolvem(/* Complex */ ae_matrix* a,
3693 /* Complex */ ae_matrix* lua,
3694 /* Integer */ ae_vector* p,
3695 ae_int_t n,
3696 /* Complex */ ae_matrix* b,
3697 ae_int_t m,
3698 ae_int_t* info,
3699 densesolverreport* rep,
3700 /* Complex */ ae_matrix* x,
3701 ae_state *_state);
3702void cmatrixmixedsolve(/* Complex */ ae_matrix* a,
3703 /* Complex */ ae_matrix* lua,
3704 /* Integer */ ae_vector* p,
3705 ae_int_t n,
3706 /* Complex */ ae_vector* b,
3707 ae_int_t* info,
3708 densesolverreport* rep,
3709 /* Complex */ ae_vector* x,
3710 ae_state *_state);
3711void spdmatrixsolvem(/* Real */ ae_matrix* a,
3712 ae_int_t n,
3713 ae_bool isupper,
3714 /* Real */ ae_matrix* b,
3715 ae_int_t m,
3716 ae_int_t* info,
3717 densesolverreport* rep,
3718 /* Real */ ae_matrix* x,
3719 ae_state *_state);
3720void _pexec_spdmatrixsolvem(/* Real */ ae_matrix* a,
3721 ae_int_t n,
3722 ae_bool isupper,
3723 /* Real */ ae_matrix* b,
3724 ae_int_t m,
3725 ae_int_t* info,
3726 densesolverreport* rep,
3727 /* Real */ ae_matrix* x, ae_state *_state);
3728void spdmatrixsolvemfast(/* Real */ ae_matrix* a,
3729 ae_int_t n,
3730 ae_bool isupper,
3731 /* Real */ ae_matrix* b,
3732 ae_int_t m,
3733 ae_int_t* info,
3734 ae_state *_state);
3735void _pexec_spdmatrixsolvemfast(/* Real */ ae_matrix* a,
3736 ae_int_t n,
3737 ae_bool isupper,
3738 /* Real */ ae_matrix* b,
3739 ae_int_t m,
3740 ae_int_t* info, ae_state *_state);
3741void spdmatrixsolve(/* Real */ ae_matrix* a,
3742 ae_int_t n,
3743 ae_bool isupper,
3744 /* Real */ ae_vector* b,
3745 ae_int_t* info,
3746 densesolverreport* rep,
3747 /* Real */ ae_vector* x,
3748 ae_state *_state);
3749void _pexec_spdmatrixsolve(/* Real */ ae_matrix* a,
3750 ae_int_t n,
3751 ae_bool isupper,
3752 /* Real */ ae_vector* b,
3753 ae_int_t* info,
3754 densesolverreport* rep,
3755 /* Real */ ae_vector* x, ae_state *_state);
3756void spdmatrixsolvefast(/* Real */ ae_matrix* a,
3757 ae_int_t n,
3758 ae_bool isupper,
3759 /* Real */ ae_vector* b,
3760 ae_int_t* info,
3761 ae_state *_state);
3762void _pexec_spdmatrixsolvefast(/* Real */ ae_matrix* a,
3763 ae_int_t n,
3764 ae_bool isupper,
3765 /* Real */ ae_vector* b,
3766 ae_int_t* info, ae_state *_state);
3767void spdmatrixcholeskysolvem(/* Real */ ae_matrix* cha,
3768 ae_int_t n,
3769 ae_bool isupper,
3770 /* Real */ ae_matrix* b,
3771 ae_int_t m,
3772 ae_int_t* info,
3773 densesolverreport* rep,
3774 /* Real */ ae_matrix* x,
3775 ae_state *_state);
3776void _pexec_spdmatrixcholeskysolvem(/* Real */ ae_matrix* cha,
3777 ae_int_t n,
3778 ae_bool isupper,
3779 /* Real */ ae_matrix* b,
3780 ae_int_t m,
3781 ae_int_t* info,
3782 densesolverreport* rep,
3783 /* Real */ ae_matrix* x, ae_state *_state);
3784void spdmatrixcholeskysolvemfast(/* Real */ ae_matrix* cha,
3785 ae_int_t n,
3786 ae_bool isupper,
3787 /* Real */ ae_matrix* b,
3788 ae_int_t m,
3789 ae_int_t* info,
3790 ae_state *_state);
3791void _pexec_spdmatrixcholeskysolvemfast(/* Real */ ae_matrix* cha,
3792 ae_int_t n,
3793 ae_bool isupper,
3794 /* Real */ ae_matrix* b,
3795 ae_int_t m,
3796 ae_int_t* info, ae_state *_state);
3797void spdmatrixcholeskysolve(/* Real */ ae_matrix* cha,
3798 ae_int_t n,
3799 ae_bool isupper,
3800 /* Real */ ae_vector* b,
3801 ae_int_t* info,
3802 densesolverreport* rep,
3803 /* Real */ ae_vector* x,
3804 ae_state *_state);
3805void spdmatrixcholeskysolvefast(/* Real */ ae_matrix* cha,
3806 ae_int_t n,
3807 ae_bool isupper,
3808 /* Real */ ae_vector* b,
3809 ae_int_t* info,
3810 ae_state *_state);
3811void hpdmatrixsolvem(/* Complex */ ae_matrix* a,
3812 ae_int_t n,
3813 ae_bool isupper,
3814 /* Complex */ ae_matrix* b,
3815 ae_int_t m,
3816 ae_int_t* info,
3817 densesolverreport* rep,
3818 /* Complex */ ae_matrix* x,
3819 ae_state *_state);
3820void _pexec_hpdmatrixsolvem(/* Complex */ ae_matrix* a,
3821 ae_int_t n,
3822 ae_bool isupper,
3823 /* Complex */ ae_matrix* b,
3824 ae_int_t m,
3825 ae_int_t* info,
3826 densesolverreport* rep,
3827 /* Complex */ ae_matrix* x, ae_state *_state);
3828void hpdmatrixsolvemfast(/* Complex */ ae_matrix* a,
3829 ae_int_t n,
3830 ae_bool isupper,
3831 /* Complex */ ae_matrix* b,
3832 ae_int_t m,
3833 ae_int_t* info,
3834 ae_state *_state);
3835void _pexec_hpdmatrixsolvemfast(/* Complex */ ae_matrix* a,
3836 ae_int_t n,
3837 ae_bool isupper,
3838 /* Complex */ ae_matrix* b,
3839 ae_int_t m,
3840 ae_int_t* info, ae_state *_state);
3841void hpdmatrixsolve(/* Complex */ ae_matrix* a,
3842 ae_int_t n,
3843 ae_bool isupper,
3844 /* Complex */ ae_vector* b,
3845 ae_int_t* info,
3846 densesolverreport* rep,
3847 /* Complex */ ae_vector* x,
3848 ae_state *_state);
3849void _pexec_hpdmatrixsolve(/* Complex */ ae_matrix* a,
3850 ae_int_t n,
3851 ae_bool isupper,
3852 /* Complex */ ae_vector* b,
3853 ae_int_t* info,
3854 densesolverreport* rep,
3855 /* Complex */ ae_vector* x, ae_state *_state);
3856void hpdmatrixsolvefast(/* Complex */ ae_matrix* a,
3857 ae_int_t n,
3858 ae_bool isupper,
3859 /* Complex */ ae_vector* b,
3860 ae_int_t* info,
3861 ae_state *_state);
3862void _pexec_hpdmatrixsolvefast(/* Complex */ ae_matrix* a,
3863 ae_int_t n,
3864 ae_bool isupper,
3865 /* Complex */ ae_vector* b,
3866 ae_int_t* info, ae_state *_state);
3867void hpdmatrixcholeskysolvem(/* Complex */ ae_matrix* cha,
3868 ae_int_t n,
3869 ae_bool isupper,
3870 /* Complex */ ae_matrix* b,
3871 ae_int_t m,
3872 ae_int_t* info,
3873 densesolverreport* rep,
3874 /* Complex */ ae_matrix* x,
3875 ae_state *_state);
3876void _pexec_hpdmatrixcholeskysolvem(/* Complex */ ae_matrix* cha,
3877 ae_int_t n,
3878 ae_bool isupper,
3879 /* Complex */ ae_matrix* b,
3880 ae_int_t m,
3881 ae_int_t* info,
3882 densesolverreport* rep,
3883 /* Complex */ ae_matrix* x, ae_state *_state);
3884void hpdmatrixcholeskysolvemfast(/* Complex */ ae_matrix* cha,
3885 ae_int_t n,
3886 ae_bool isupper,
3887 /* Complex */ ae_matrix* b,
3888 ae_int_t m,
3889 ae_int_t* info,
3890 ae_state *_state);
3891void _pexec_hpdmatrixcholeskysolvemfast(/* Complex */ ae_matrix* cha,
3892 ae_int_t n,
3893 ae_bool isupper,
3894 /* Complex */ ae_matrix* b,
3895 ae_int_t m,
3896 ae_int_t* info, ae_state *_state);
3897void hpdmatrixcholeskysolve(/* Complex */ ae_matrix* cha,
3898 ae_int_t n,
3899 ae_bool isupper,
3900 /* Complex */ ae_vector* b,
3901 ae_int_t* info,
3902 densesolverreport* rep,
3903 /* Complex */ ae_vector* x,
3904 ae_state *_state);
3905void hpdmatrixcholeskysolvefast(/* Complex */ ae_matrix* cha,
3906 ae_int_t n,
3907 ae_bool isupper,
3908 /* Complex */ ae_vector* b,
3909 ae_int_t* info,
3910 ae_state *_state);
3911void rmatrixsolvels(/* Real */ ae_matrix* a,
3912 ae_int_t nrows,
3913 ae_int_t ncols,
3914 /* Real */ ae_vector* b,
3915 double threshold,
3916 ae_int_t* info,
3917 densesolverlsreport* rep,
3918 /* Real */ ae_vector* x,
3919 ae_state *_state);
3920void _pexec_rmatrixsolvels(/* Real */ ae_matrix* a,
3921 ae_int_t nrows,
3922 ae_int_t ncols,
3923 /* Real */ ae_vector* b,
3924 double threshold,
3925 ae_int_t* info,
3926 densesolverlsreport* rep,
3927 /* Real */ ae_vector* x, ae_state *_state);
3928void _densesolverreport_init(void* _p, ae_state *_state);
3929void _densesolverreport_init_copy(void* _dst, void* _src, ae_state *_state);
3930void _densesolverreport_clear(void* _p);
3931void _densesolverreport_destroy(void* _p);
3932void _densesolverlsreport_init(void* _p, ae_state *_state);
3933void _densesolverlsreport_init_copy(void* _dst, void* _src, ae_state *_state);
3934void _densesolverlsreport_clear(void* _p);
3935void _densesolverlsreport_destroy(void* _p);
3936void linlsqrcreate(ae_int_t m,
3937 ae_int_t n,
3938 linlsqrstate* state,
3939 ae_state *_state);
3940void linlsqrsetb(linlsqrstate* state,
3941 /* Real */ ae_vector* b,
3942 ae_state *_state);
3943void linlsqrsetprecunit(linlsqrstate* state, ae_state *_state);
3944void linlsqrsetprecdiag(linlsqrstate* state, ae_state *_state);
3945void linlsqrsetlambdai(linlsqrstate* state,
3946 double lambdai,
3947 ae_state *_state);
3948ae_bool linlsqriteration(linlsqrstate* state, ae_state *_state);
3949void linlsqrsolvesparse(linlsqrstate* state,
3950 sparsematrix* a,
3951 /* Real */ ae_vector* b,
3952 ae_state *_state);
3953void linlsqrsetcond(linlsqrstate* state,
3954 double epsa,
3955 double epsb,
3956 ae_int_t maxits,
3957 ae_state *_state);
3958void linlsqrresults(linlsqrstate* state,
3959 /* Real */ ae_vector* x,
3960 linlsqrreport* rep,
3961 ae_state *_state);
3962void linlsqrsetxrep(linlsqrstate* state,
3963 ae_bool needxrep,
3964 ae_state *_state);
3965void linlsqrrestart(linlsqrstate* state, ae_state *_state);
3966void _linlsqrstate_init(void* _p, ae_state *_state);
3967void _linlsqrstate_init_copy(void* _dst, void* _src, ae_state *_state);
3968void _linlsqrstate_clear(void* _p);
3969void _linlsqrstate_destroy(void* _p);
3970void _linlsqrreport_init(void* _p, ae_state *_state);
3971void _linlsqrreport_init_copy(void* _dst, void* _src, ae_state *_state);
3972void _linlsqrreport_clear(void* _p);
3973void _linlsqrreport_destroy(void* _p);
3974void polynomialsolve(/* Real */ ae_vector* a,
3975 ae_int_t n,
3976 /* Complex */ ae_vector* x,
3977 polynomialsolverreport* rep,
3978 ae_state *_state);
3979void _polynomialsolverreport_init(void* _p, ae_state *_state);
3980void _polynomialsolverreport_init_copy(void* _dst, void* _src, ae_state *_state);
3981void _polynomialsolverreport_clear(void* _p);
3982void _polynomialsolverreport_destroy(void* _p);
3983void nleqcreatelm(ae_int_t n,
3984 ae_int_t m,
3985 /* Real */ ae_vector* x,
3986 nleqstate* state,
3987 ae_state *_state);
3988void nleqsetcond(nleqstate* state,
3989 double epsf,
3990 ae_int_t maxits,
3991 ae_state *_state);
3992void nleqsetxrep(nleqstate* state, ae_bool needxrep, ae_state *_state);
3993void nleqsetstpmax(nleqstate* state, double stpmax, ae_state *_state);
3994ae_bool nleqiteration(nleqstate* state, ae_state *_state);
3995void nleqresults(nleqstate* state,
3996 /* Real */ ae_vector* x,
3997 nleqreport* rep,
3998 ae_state *_state);
3999void nleqresultsbuf(nleqstate* state,
4000 /* Real */ ae_vector* x,
4001 nleqreport* rep,
4002 ae_state *_state);
4003void nleqrestartfrom(nleqstate* state,
4004 /* Real */ ae_vector* x,
4005 ae_state *_state);
4006void _nleqstate_init(void* _p, ae_state *_state);
4007void _nleqstate_init_copy(void* _dst, void* _src, ae_state *_state);
4008void _nleqstate_clear(void* _p);
4009void _nleqstate_destroy(void* _p);
4010void _nleqreport_init(void* _p, ae_state *_state);
4011void _nleqreport_init_copy(void* _dst, void* _src, ae_state *_state);
4012void _nleqreport_clear(void* _p);
4013void _nleqreport_destroy(void* _p);
4014void lincgcreate(ae_int_t n, lincgstate* state, ae_state *_state);
4015void lincgsetstartingpoint(lincgstate* state,
4016 /* Real */ ae_vector* x,
4017 ae_state *_state);
4018void lincgsetb(lincgstate* state,
4019 /* Real */ ae_vector* b,
4020 ae_state *_state);
4021void lincgsetprecunit(lincgstate* state, ae_state *_state);
4022void lincgsetprecdiag(lincgstate* state, ae_state *_state);
4023void lincgsetcond(lincgstate* state,
4024 double epsf,
4025 ae_int_t maxits,
4026 ae_state *_state);
4027ae_bool lincgiteration(lincgstate* state, ae_state *_state);
4028void lincgsolvesparse(lincgstate* state,
4029 sparsematrix* a,
4030 ae_bool isupper,
4031 /* Real */ ae_vector* b,
4032 ae_state *_state);
4033void lincgresults(lincgstate* state,
4034 /* Real */ ae_vector* x,
4035 lincgreport* rep,
4036 ae_state *_state);
4037void lincgsetrestartfreq(lincgstate* state,
4038 ae_int_t srf,
4039 ae_state *_state);
4040void lincgsetrupdatefreq(lincgstate* state,
4041 ae_int_t freq,
4042 ae_state *_state);
4043void lincgsetxrep(lincgstate* state, ae_bool needxrep, ae_state *_state);
4044void lincgrestart(lincgstate* state, ae_state *_state);
4045void _lincgstate_init(void* _p, ae_state *_state);
4046void _lincgstate_init_copy(void* _dst, void* _src, ae_state *_state);
4047void _lincgstate_clear(void* _p);
4048void _lincgstate_destroy(void* _p);
4049void _lincgreport_init(void* _p, ae_state *_state);
4050void _lincgreport_init_copy(void* _dst, void* _src, ae_state *_state);
4051void _lincgreport_clear(void* _p);
4052void _lincgreport_destroy(void* _p);
4053
4054}
4055#endif
4056