-
Notifications
You must be signed in to change notification settings - Fork 0
/
linalg.h
8979 lines (7551 loc) · 367 KB
/
linalg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*************************************************************************
ALGLIB 3.17.0 (source code generated 2020-12-27)
Copyright (c) Sergey Bochkanov (ALGLIB project).
>>> SOURCE LICENSE >>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation (www.fsf.org); either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
A copy of the GNU General Public License is available at
http://www.fsf.org/licensing/licenses
>>> END OF LICENSE >>>
*************************************************************************/
#ifndef _linalg_pkg_h
#define _linalg_pkg_h
#include "ap.h"
#include "alglibinternal.h"
#include "alglibmisc.h"
/////////////////////////////////////////////////////////////////////////
//
// THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (DATATYPES)
//
/////////////////////////////////////////////////////////////////////////
namespace alglib_impl
{
#if defined(AE_COMPILE_SPARSE) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
ae_vector vals;
ae_vector idx;
ae_vector ridx;
ae_vector didx;
ae_vector uidx;
ae_int_t matrixtype;
ae_int_t m;
ae_int_t n;
ae_int_t nfree;
ae_int_t ninitialized;
ae_int_t tablesize;
} sparsematrix;
typedef struct
{
ae_vector d;
ae_vector u;
sparsematrix s;
} sparsebuffers;
#endif
#if defined(AE_COMPILE_ABLAS) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_DLU) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SPTRF) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
ae_int_t nfixed;
ae_int_t ndynamic;
ae_vector idxfirst;
ae_vector strgidx;
ae_vector strgval;
ae_int_t nallocated;
ae_int_t nused;
} sluv2list1matrix;
typedef struct
{
ae_int_t n;
ae_int_t k;
ae_vector nzc;
ae_int_t maxwrkcnt;
ae_int_t maxwrknz;
ae_int_t wrkcnt;
ae_vector wrkset;
ae_vector colid;
ae_vector isdensified;
ae_vector slscolptr;
ae_vector slsrowptr;
ae_vector slsidx;
ae_vector slsval;
ae_int_t slsused;
ae_vector tmp0;
} sluv2sparsetrail;
typedef struct
{
ae_int_t n;
ae_int_t ndense;
ae_matrix d;
ae_vector did;
} sluv2densetrail;
typedef struct
{
ae_int_t n;
sparsematrix sparsel;
sparsematrix sparseut;
sluv2list1matrix bleft;
sluv2list1matrix bupper;
sluv2sparsetrail strail;
sluv2densetrail dtrail;
ae_vector rowpermrawidx;
ae_matrix dbuf;
ae_vector v0i;
ae_vector v1i;
ae_vector v0r;
ae_vector v1r;
ae_vector tmp0;
ae_vector tmpi;
ae_vector tmpp;
} sluv2buffer;
#endif
#if defined(AE_COMPILE_AMDORDERING) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
ae_int_t n;
ae_int_t nstored;
ae_vector items;
ae_vector locationof;
ae_int_t iteridx;
} amdnset;
typedef struct
{
ae_int_t k;
ae_int_t n;
ae_vector flagarray;
ae_vector vbegin;
ae_vector vallocated;
ae_vector vcnt;
ae_vector data;
ae_int_t dataused;
ae_int_t iterrow;
ae_int_t iteridx;
} amdknset;
typedef struct
{
ae_int_t n;
ae_bool checkexactdegrees;
ae_int_t smallestdegree;
ae_vector approxd;
ae_vector optionalexactd;
ae_vector isvertex;
ae_vector vbegin;
ae_vector vprev;
ae_vector vnext;
} amdvertexset;
typedef struct
{
ae_int_t n;
ae_vector vbegin;
ae_vector vcolcnt;
ae_vector entries;
ae_int_t entriesinitialized;
} amdllmatrix;
typedef struct
{
ae_int_t n;
ae_bool extendeddebug;
ae_bool checkexactdegrees;
ae_vector iseliminated;
ae_vector issupernode;
amdknset setsuper;
amdknset seta;
amdknset sete;
amdllmatrix mtxl;
amdvertexset vertexdegrees;
ae_vector perm;
ae_vector invperm;
ae_vector columnswaps;
amdnset lp;
amdnset plp;
amdnset ep;
amdnset adji;
amdnset adjj;
ae_vector ls;
ae_int_t lscnt;
amdnset exactdegreetmp0;
amdknset hashbuckets;
amdnset nonemptybuckets;
ae_vector sncandidates;
ae_vector tmp0;
ae_vector arrwe;
ae_matrix dbga;
} amdbuffer;
#endif
#if defined(AE_COMPILE_SPCHOL) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
ae_int_t tasktype;
ae_int_t n;
ae_int_t permtype;
ae_bool unitd;
ae_int_t modtype;
double modparam0;
double modparam1;
double modparam2;
double modparam3;
ae_bool extendeddebug;
ae_bool dotrace;
ae_int_t nsuper;
ae_vector parentsupernode;
ae_vector supercolrange;
ae_vector superrowridx;
ae_vector superrowidx;
ae_vector fillinperm;
ae_vector invfillinperm;
ae_vector superperm;
ae_vector invsuperperm;
ae_vector effectiveperm;
ae_vector inveffectiveperm;
ae_bool istopologicalordering;
ae_bool applypermutationtooutput;
ae_vector ladjplusr;
ae_vector ladjplus;
ae_vector outrowcounts;
sparsematrix wrkat;
ae_vector rowstorage;
ae_vector rowstrides;
ae_vector rowoffsets;
ae_vector diagd;
ae_vector wrkrows;
ae_vector flagarray;
ae_vector tmpparent;
ae_vector node2supernode;
ae_vector u2smap;
ae_vector raw2smap;
amdbuffer amdtmp;
ae_vector tmp0;
ae_vector tmp1;
ae_vector tmp2;
ae_vector tmp3;
ae_vector tmp4;
sparsematrix tmpa;
} spcholanalysis;
#endif
#if defined(AE_COMPILE_MATGEN) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_TRFAC) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
ae_int_t n;
ae_int_t facttype;
ae_int_t permtype;
spcholanalysis analysis;
sparsematrix wrka;
sparsematrix wrkat;
sparsematrix crsa;
sparsematrix crsat;
} sparsedecompositionanalysis;
#endif
#if defined(AE_COMPILE_RCOND) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_MATINV) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
double r1;
double rinf;
} matinvreport;
#endif
#if defined(AE_COMPILE_ORTFAC) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_FBLS) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
double e1;
double e2;
ae_vector x;
ae_vector ax;
double xax;
ae_int_t n;
ae_vector rk;
ae_vector rk1;
ae_vector xk;
ae_vector xk1;
ae_vector pk;
ae_vector pk1;
ae_vector b;
rcommstate rstate;
ae_vector tmp2;
} fblslincgstate;
typedef struct
{
ae_vector b;
ae_vector x;
ae_vector ax;
ae_vector xs;
ae_matrix qi;
ae_matrix aqi;
ae_matrix h;
ae_matrix hq;
ae_matrix hr;
ae_vector hqb;
ae_vector ys;
ae_vector tmp0;
ae_vector tmp1;
ae_int_t n;
ae_int_t itscnt;
double epsort;
double epsres;
double epsred;
double epsdiag;
ae_int_t itsperformed;
ae_int_t retcode;
rcommstate rstate;
} fblsgmresstate;
#endif
#if defined(AE_COMPILE_BDSVD) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SVD) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_NORMESTIMATOR) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
ae_int_t n;
ae_int_t m;
ae_int_t nstart;
ae_int_t nits;
ae_int_t seedval;
ae_vector x0;
ae_vector x1;
ae_vector t;
ae_vector xbest;
hqrndstate r;
ae_vector x;
ae_vector mv;
ae_vector mtv;
ae_bool needmv;
ae_bool needmtv;
double repnorm;
rcommstate rstate;
} normestimatorstate;
#endif
#if defined(AE_COMPILE_HSSCHUR) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_EVD) || !defined(AE_PARTIAL_BUILD)
typedef struct
{
ae_int_t n;
ae_int_t k;
ae_int_t nwork;
ae_int_t maxits;
double eps;
ae_int_t eigenvectorsneeded;
ae_int_t matrixtype;
ae_bool usewarmstart;
ae_bool firstcall;
hqrndstate rs;
ae_bool running;
ae_vector tau;
ae_matrix q0;
ae_matrix qcur;
ae_matrix qnew;
ae_matrix znew;
ae_matrix r;
ae_matrix rz;
ae_matrix tz;
ae_matrix rq;
ae_matrix dummy;
ae_vector rw;
ae_vector tw;
ae_vector wcur;
ae_vector wprev;
ae_vector wrank;
apbuffers buf;
ae_matrix x;
ae_matrix ax;
ae_int_t requesttype;
ae_int_t requestsize;
ae_int_t repiterationscount;
rcommstate rstate;
} eigsubspacestate;
typedef struct
{
ae_int_t iterationscount;
} eigsubspacereport;
#endif
#if defined(AE_COMPILE_SCHUR) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SPDGEVD) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_INVERSEUPDATE) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_MATDET) || !defined(AE_PARTIAL_BUILD)
#endif
}
/////////////////////////////////////////////////////////////////////////
//
// THIS SECTION CONTAINS C++ INTERFACE
//
/////////////////////////////////////////////////////////////////////////
namespace alglib
{
#if defined(AE_COMPILE_SPARSE) || !defined(AE_PARTIAL_BUILD)
/*************************************************************************
Sparse matrix structure.
You should use ALGLIB functions to work with sparse matrix. Never try to
access its fields directly!
NOTES ON THE SPARSE STORAGE FORMATS
Sparse matrices can be stored using several formats:
* Hash-Table representation
* Compressed Row Storage (CRS)
* Skyline matrix storage (SKS)
Each of the formats has benefits and drawbacks:
* Hash-table is good for dynamic operations (insertion of new elements),
but does not support linear algebra operations
* CRS is good for operations like matrix-vector or matrix-matrix products,
but its initialization is less convenient - you have to tell row sizes
at the initialization, and you have to fill matrix only row by row,
from left to right.
* SKS is a special format which is used to store triangular factors from
Cholesky factorization. It does not support dynamic modification, and
support for linear algebra operations is very limited.
Tables below outline information about these two formats:
OPERATIONS WITH MATRIX HASH CRS SKS
creation + + +
SparseGet + + +
SparseExists + + +
SparseRewriteExisting + + +
SparseSet + + +
SparseAdd +
SparseGetRow + +
SparseGetCompressedRow + +
sparse-dense linear algebra + +
*************************************************************************/
class _sparsematrix_owner
{
public:
_sparsematrix_owner();
_sparsematrix_owner(const _sparsematrix_owner &rhs);
_sparsematrix_owner& operator=(const _sparsematrix_owner &rhs);
virtual ~_sparsematrix_owner();
alglib_impl::sparsematrix* c_ptr();
alglib_impl::sparsematrix* c_ptr() const;
protected:
alglib_impl::sparsematrix *p_struct;
};
class sparsematrix : public _sparsematrix_owner
{
public:
sparsematrix();
sparsematrix(const sparsematrix &rhs);
sparsematrix& operator=(const sparsematrix &rhs);
virtual ~sparsematrix();
};
/*************************************************************************
Temporary buffers for sparse matrix operations.
You should pass an instance of this structure to factorization functions.
It allows to reuse memory during repeated sparse factorizations. You do
not have to call some initialization function - simply passing an instance
to factorization function is enough.
*************************************************************************/
class _sparsebuffers_owner
{
public:
_sparsebuffers_owner();
_sparsebuffers_owner(const _sparsebuffers_owner &rhs);
_sparsebuffers_owner& operator=(const _sparsebuffers_owner &rhs);
virtual ~_sparsebuffers_owner();
alglib_impl::sparsebuffers* c_ptr();
alglib_impl::sparsebuffers* c_ptr() const;
protected:
alglib_impl::sparsebuffers *p_struct;
};
class sparsebuffers : public _sparsebuffers_owner
{
public:
sparsebuffers();
sparsebuffers(const sparsebuffers &rhs);
sparsebuffers& operator=(const sparsebuffers &rhs);
virtual ~sparsebuffers();
};
#endif
#if defined(AE_COMPILE_ABLAS) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_DLU) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SPTRF) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_AMDORDERING) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SPCHOL) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_MATGEN) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_TRFAC) || !defined(AE_PARTIAL_BUILD)
/*************************************************************************
An analysis of the sparse matrix decomposition, performed prior to actual
numerical factorization. You should not directly access fields of this
object - use appropriate ALGLIB functions to work with this object.
*************************************************************************/
class _sparsedecompositionanalysis_owner
{
public:
_sparsedecompositionanalysis_owner();
_sparsedecompositionanalysis_owner(const _sparsedecompositionanalysis_owner &rhs);
_sparsedecompositionanalysis_owner& operator=(const _sparsedecompositionanalysis_owner &rhs);
virtual ~_sparsedecompositionanalysis_owner();
alglib_impl::sparsedecompositionanalysis* c_ptr();
alglib_impl::sparsedecompositionanalysis* c_ptr() const;
protected:
alglib_impl::sparsedecompositionanalysis *p_struct;
};
class sparsedecompositionanalysis : public _sparsedecompositionanalysis_owner
{
public:
sparsedecompositionanalysis();
sparsedecompositionanalysis(const sparsedecompositionanalysis &rhs);
sparsedecompositionanalysis& operator=(const sparsedecompositionanalysis &rhs);
virtual ~sparsedecompositionanalysis();
};
#endif
#if defined(AE_COMPILE_RCOND) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_MATINV) || !defined(AE_PARTIAL_BUILD)
/*************************************************************************
Matrix inverse report:
* R1 reciprocal of condition number in 1-norm
* RInf reciprocal of condition number in inf-norm
*************************************************************************/
class _matinvreport_owner
{
public:
_matinvreport_owner();
_matinvreport_owner(const _matinvreport_owner &rhs);
_matinvreport_owner& operator=(const _matinvreport_owner &rhs);
virtual ~_matinvreport_owner();
alglib_impl::matinvreport* c_ptr();
alglib_impl::matinvreport* c_ptr() const;
protected:
alglib_impl::matinvreport *p_struct;
};
class matinvreport : public _matinvreport_owner
{
public:
matinvreport();
matinvreport(const matinvreport &rhs);
matinvreport& operator=(const matinvreport &rhs);
virtual ~matinvreport();
double &r1;
double &rinf;
};
#endif
#if defined(AE_COMPILE_ORTFAC) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_FBLS) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_BDSVD) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SVD) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_NORMESTIMATOR) || !defined(AE_PARTIAL_BUILD)
/*************************************************************************
This object stores state of the iterative norm estimation algorithm.
You should use ALGLIB functions to work with this object.
*************************************************************************/
class _normestimatorstate_owner
{
public:
_normestimatorstate_owner();
_normestimatorstate_owner(const _normestimatorstate_owner &rhs);
_normestimatorstate_owner& operator=(const _normestimatorstate_owner &rhs);
virtual ~_normestimatorstate_owner();
alglib_impl::normestimatorstate* c_ptr();
alglib_impl::normestimatorstate* c_ptr() const;
protected:
alglib_impl::normestimatorstate *p_struct;
};
class normestimatorstate : public _normestimatorstate_owner
{
public:
normestimatorstate();
normestimatorstate(const normestimatorstate &rhs);
normestimatorstate& operator=(const normestimatorstate &rhs);
virtual ~normestimatorstate();
};
#endif
#if defined(AE_COMPILE_HSSCHUR) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_EVD) || !defined(AE_PARTIAL_BUILD)
/*************************************************************************
This object stores state of the subspace iteration algorithm.
You should use ALGLIB functions to work with this object.
*************************************************************************/
class _eigsubspacestate_owner
{
public:
_eigsubspacestate_owner();
_eigsubspacestate_owner(const _eigsubspacestate_owner &rhs);
_eigsubspacestate_owner& operator=(const _eigsubspacestate_owner &rhs);
virtual ~_eigsubspacestate_owner();
alglib_impl::eigsubspacestate* c_ptr();
alglib_impl::eigsubspacestate* c_ptr() const;
protected:
alglib_impl::eigsubspacestate *p_struct;
};
class eigsubspacestate : public _eigsubspacestate_owner
{
public:
eigsubspacestate();
eigsubspacestate(const eigsubspacestate &rhs);
eigsubspacestate& operator=(const eigsubspacestate &rhs);
virtual ~eigsubspacestate();
};
/*************************************************************************
This object stores state of the subspace iteration algorithm.
You should use ALGLIB functions to work with this object.
*************************************************************************/
class _eigsubspacereport_owner
{
public:
_eigsubspacereport_owner();
_eigsubspacereport_owner(const _eigsubspacereport_owner &rhs);
_eigsubspacereport_owner& operator=(const _eigsubspacereport_owner &rhs);
virtual ~_eigsubspacereport_owner();
alglib_impl::eigsubspacereport* c_ptr();
alglib_impl::eigsubspacereport* c_ptr() const;
protected:
alglib_impl::eigsubspacereport *p_struct;
};
class eigsubspacereport : public _eigsubspacereport_owner
{
public:
eigsubspacereport();
eigsubspacereport(const eigsubspacereport &rhs);
eigsubspacereport& operator=(const eigsubspacereport &rhs);
virtual ~eigsubspacereport();
ae_int_t &iterationscount;
};
#endif
#if defined(AE_COMPILE_SCHUR) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SPDGEVD) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_INVERSEUPDATE) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_MATDET) || !defined(AE_PARTIAL_BUILD)
#endif
#if defined(AE_COMPILE_SPARSE) || !defined(AE_PARTIAL_BUILD)
/*************************************************************************
This function creates sparse matrix in a Hash-Table format.
This function creates Hast-Table matrix, which can be converted to CRS
format after its initialization is over. Typical usage scenario for a
sparse matrix is:
1. creation in a Hash-Table format
2. insertion of the matrix elements
3. conversion to the CRS representation
4. matrix is passed to some linear algebra algorithm
Some information about different matrix formats can be found below, in
the "NOTES" section.
INPUT PARAMETERS
M - number of rows in a matrix, M>=1
N - number of columns in a matrix, N>=1
K - K>=0, expected number of non-zero elements in a matrix.
K can be inexact approximation, can be less than actual
number of elements (table will grow when needed) or
even zero).
It is important to understand that although hash-table
may grow automatically, it is better to provide good
estimate of data size.
OUTPUT PARAMETERS
S - sparse M*N matrix in Hash-Table representation.
All elements of the matrix are zero.
NOTE 1
Hash-tables use memory inefficiently, and they have to keep some amount
of the "spare memory" in order to have good performance. Hash table for
matrix with K non-zero elements will need C*K*(8+2*sizeof(int)) bytes,
where C is a small constant, about 1.5-2 in magnitude.
CRS storage, from the other side, is more memory-efficient, and needs
just K*(8+sizeof(int))+M*sizeof(int) bytes, where M is a number of rows
in a matrix.
When you convert from the Hash-Table to CRS representation, all unneeded
memory will be freed.
NOTE 2
Comments of SparseMatrix structure outline information about different
sparse storage formats. We recommend you to read them before starting to
use ALGLIB sparse matrices.
NOTE 3
This function completely overwrites S with new sparse matrix. Previously
allocated storage is NOT reused. If you want to reuse already allocated
memory, call SparseCreateBuf function.
-- ALGLIB PROJECT --
Copyright 14.10.2011 by Bochkanov Sergey
*************************************************************************/
void sparsecreate(const ae_int_t m, const ae_int_t n, const ae_int_t k, sparsematrix &s, const xparams _xparams = alglib::xdefault);
void sparsecreate(const ae_int_t m, const ae_int_t n, sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This version of SparseCreate function creates sparse matrix in Hash-Table
format, reusing previously allocated storage as much as possible. Read
comments for SparseCreate() for more information.
INPUT PARAMETERS
M - number of rows in a matrix, M>=1
N - number of columns in a matrix, N>=1
K - K>=0, expected number of non-zero elements in a matrix.
K can be inexact approximation, can be less than actual
number of elements (table will grow when needed) or
even zero).
It is important to understand that although hash-table
may grow automatically, it is better to provide good
estimate of data size.
S - SparseMatrix structure which MAY contain some already
allocated storage.
OUTPUT PARAMETERS
S - sparse M*N matrix in Hash-Table representation.
All elements of the matrix are zero.
Previously allocated storage is reused, if its size
is compatible with expected number of non-zeros K.
-- ALGLIB PROJECT --
Copyright 14.01.2014 by Bochkanov Sergey
*************************************************************************/
void sparsecreatebuf(const ae_int_t m, const ae_int_t n, const ae_int_t k, const sparsematrix &s, const xparams _xparams = alglib::xdefault);
void sparsecreatebuf(const ae_int_t m, const ae_int_t n, const sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This function creates sparse matrix in a CRS format (expert function for
situations when you are running out of memory).
This function creates CRS matrix. Typical usage scenario for a CRS matrix
is:
1. creation (you have to tell number of non-zero elements at each row at
this moment)
2. insertion of the matrix elements (row by row, from left to right)
3. matrix is passed to some linear algebra algorithm
This function is a memory-efficient alternative to SparseCreate(), but it
is more complex because it requires you to know in advance how large your
matrix is. Some information about different matrix formats can be found
in comments on SparseMatrix structure. We recommend you to read them
before starting to use ALGLIB sparse matrices..
INPUT PARAMETERS
M - number of rows in a matrix, M>=1
N - number of columns in a matrix, N>=1
NER - number of elements at each row, array[M], NER[I]>=0
OUTPUT PARAMETERS
S - sparse M*N matrix in CRS representation.
You have to fill ALL non-zero elements by calling
SparseSet() BEFORE you try to use this matrix.
NOTE: this function completely overwrites S with new sparse matrix.
Previously allocated storage is NOT reused. If you want to reuse
already allocated memory, call SparseCreateCRSBuf function.
-- ALGLIB PROJECT --
Copyright 14.10.2011 by Bochkanov Sergey
*************************************************************************/
void sparsecreatecrs(const ae_int_t m, const ae_int_t n, const integer_1d_array &ner, sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This function creates sparse matrix in a CRS format (expert function for
situations when you are running out of memory). This version of CRS
matrix creation function may reuse memory already allocated in S.
This function creates CRS matrix. Typical usage scenario for a CRS matrix
is:
1. creation (you have to tell number of non-zero elements at each row at
this moment)
2. insertion of the matrix elements (row by row, from left to right)
3. matrix is passed to some linear algebra algorithm
This function is a memory-efficient alternative to SparseCreate(), but it
is more complex because it requires you to know in advance how large your
matrix is. Some information about different matrix formats can be found
in comments on SparseMatrix structure. We recommend you to read them
before starting to use ALGLIB sparse matrices..
INPUT PARAMETERS
M - number of rows in a matrix, M>=1
N - number of columns in a matrix, N>=1
NER - number of elements at each row, array[M], NER[I]>=0
S - sparse matrix structure with possibly preallocated
memory.
OUTPUT PARAMETERS
S - sparse M*N matrix in CRS representation.
You have to fill ALL non-zero elements by calling
SparseSet() BEFORE you try to use this matrix.
-- ALGLIB PROJECT --
Copyright 14.10.2011 by Bochkanov Sergey
*************************************************************************/
void sparsecreatecrsbuf(const ae_int_t m, const ae_int_t n, const integer_1d_array &ner, const sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This function creates sparse matrix in a SKS format (skyline storage
format). In most cases you do not need this function - CRS format better
suits most use cases.
INPUT PARAMETERS
M, N - number of rows(M) and columns (N) in a matrix:
* M=N (as for now, ALGLIB supports only square SKS)
* N>=1
* M>=1
D - "bottom" bandwidths, array[M], D[I]>=0.
I-th element stores number of non-zeros at I-th row,
below the diagonal (diagonal itself is not included)
U - "top" bandwidths, array[N], U[I]>=0.
I-th element stores number of non-zeros at I-th row,
above the diagonal (diagonal itself is not included)
OUTPUT PARAMETERS
S - sparse M*N matrix in SKS representation.
All elements are filled by zeros.
You may use sparseset() to change their values.
NOTE: this function completely overwrites S with new sparse matrix.
Previously allocated storage is NOT reused. If you want to reuse
already allocated memory, call SparseCreateSKSBuf function.
-- ALGLIB PROJECT --
Copyright 13.01.2014 by Bochkanov Sergey
*************************************************************************/
void sparsecreatesks(const ae_int_t m, const ae_int_t n, const integer_1d_array &d, const integer_1d_array &u, sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This is "buffered" version of SparseCreateSKS() which reuses memory
previously allocated in S (of course, memory is reallocated if needed).
This function creates sparse matrix in a SKS format (skyline storage
format). In most cases you do not need this function - CRS format better
suits most use cases.
INPUT PARAMETERS
M, N - number of rows(M) and columns (N) in a matrix:
* M=N (as for now, ALGLIB supports only square SKS)
* N>=1
* M>=1
D - "bottom" bandwidths, array[M], 0<=D[I]<=I.
I-th element stores number of non-zeros at I-th row,
below the diagonal (diagonal itself is not included)
U - "top" bandwidths, array[N], 0<=U[I]<=I.
I-th element stores number of non-zeros at I-th row,
above the diagonal (diagonal itself is not included)
OUTPUT PARAMETERS
S - sparse M*N matrix in SKS representation.
All elements are filled by zeros.
You may use sparseset() to change their values.
-- ALGLIB PROJECT --
Copyright 13.01.2014 by Bochkanov Sergey
*************************************************************************/
void sparsecreatesksbuf(const ae_int_t m, const ae_int_t n, const integer_1d_array &d, const integer_1d_array &u, const sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This function creates sparse matrix in a SKS format (skyline storage
format). Unlike more general sparsecreatesks(), this function creates
sparse matrix with constant bandwidth.
You may want to use this function instead of sparsecreatesks() when your
matrix has constant or nearly-constant bandwidth, and you want to
simplify source code.
INPUT PARAMETERS
M, N - number of rows(M) and columns (N) in a matrix:
* M=N (as for now, ALGLIB supports only square SKS)
* N>=1
* M>=1
BW - matrix bandwidth, BW>=0
OUTPUT PARAMETERS
S - sparse M*N matrix in SKS representation.
All elements are filled by zeros.
You may use sparseset() to change their values.
NOTE: this function completely overwrites S with new sparse matrix.
Previously allocated storage is NOT reused. If you want to reuse
already allocated memory, call sparsecreatesksbandbuf function.
-- ALGLIB PROJECT --
Copyright 25.12.2017 by Bochkanov Sergey
*************************************************************************/
void sparsecreatesksband(const ae_int_t m, const ae_int_t n, const ae_int_t bw, sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This is "buffered" version of sparsecreatesksband() which reuses memory
previously allocated in S (of course, memory is reallocated if needed).
You may want to use this function instead of sparsecreatesksbuf() when
your matrix has constant or nearly-constant bandwidth, and you want to
simplify source code.
INPUT PARAMETERS
M, N - number of rows(M) and columns (N) in a matrix:
* M=N (as for now, ALGLIB supports only square SKS)
* N>=1
* M>=1
BW - bandwidth, BW>=0
OUTPUT PARAMETERS
S - sparse M*N matrix in SKS representation.
All elements are filled by zeros.
You may use sparseset() to change their values.
-- ALGLIB PROJECT --
Copyright 13.01.2014 by Bochkanov Sergey
*************************************************************************/
void sparsecreatesksbandbuf(const ae_int_t m, const ae_int_t n, const ae_int_t bw, const sparsematrix &s, const xparams _xparams = alglib::xdefault);
/*************************************************************************
This function copies S0 to S1.
This function completely deallocates memory owned by S1 before creating a
copy of S0. If you want to reuse memory, use SparseCopyBuf.
NOTE: this function does not verify its arguments, it just copies all
fields of the structure.
-- ALGLIB PROJECT --
Copyright 14.10.2011 by Bochkanov Sergey
*************************************************************************/
void sparsecopy(const sparsematrix &s0, sparsematrix &s1, const xparams _xparams = alglib::xdefault);