1 /************************************************************************* 2 ALGLIB 3.18.0 (source code generated 2021-10-25) 3 Copyright (c) Sergey Bochkanov (ALGLIB project). 4 5 >>> SOURCE LICENSE >>> 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation (www.fsf.org); either version 2 of the 9 License, or (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 A copy of the GNU General Public License is available at 17 http://www.fsf.org/licensing/licenses 18 >>> END OF LICENSE >>> 19 *************************************************************************/ 20 #ifndef _linalg_pkg_h 21 #define _linalg_pkg_h 22 #include "ap.h" 23 #include "alglibinternal.h" 24 #include "alglibmisc.h" 25 26 ///////////////////////////////////////////////////////////////////////// 27 // 28 // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (DATATYPES) 29 // 30 ///////////////////////////////////////////////////////////////////////// 31 namespace alglib_impl 32 { 33 #if defined(AE_COMPILE_ABLAS) || !defined(AE_PARTIAL_BUILD) 34 #endif 35 #if defined(AE_COMPILE_ORTFAC) || !defined(AE_PARTIAL_BUILD) 36 #endif 37 #if defined(AE_COMPILE_MATGEN) || !defined(AE_PARTIAL_BUILD) 38 #endif 39 #if defined(AE_COMPILE_SPARSE) || !defined(AE_PARTIAL_BUILD) 40 typedef struct 41 { 42 ae_vector vals; 43 ae_vector idx; 44 ae_vector ridx; 45 ae_vector didx; 46 ae_vector uidx; 47 ae_int_t matrixtype; 48 ae_int_t m; 49 ae_int_t n; 50 ae_int_t nfree; 51 ae_int_t ninitialized; 52 ae_int_t tablesize; 53 } sparsematrix; 54 typedef struct 55 { 56 ae_vector d; 57 ae_vector u; 58 sparsematrix s; 59 } sparsebuffers; 60 #endif 61 #if defined(AE_COMPILE_HSSCHUR) || !defined(AE_PARTIAL_BUILD) 62 #endif 63 #if defined(AE_COMPILE_EVD) || !defined(AE_PARTIAL_BUILD) 64 typedef struct 65 { 66 ae_int_t n; 67 ae_int_t k; 68 ae_int_t nwork; 69 ae_int_t maxits; 70 double eps; 71 ae_int_t eigenvectorsneeded; 72 ae_int_t matrixtype; 73 ae_bool usewarmstart; 74 ae_bool firstcall; 75 hqrndstate rs; 76 ae_bool running; 77 ae_vector tau; 78 ae_matrix q0; 79 ae_matrix qcur; 80 ae_matrix qnew; 81 ae_matrix znew; 82 ae_matrix r; 83 ae_matrix rz; 84 ae_matrix tz; 85 ae_matrix rq; 86 ae_matrix dummy; 87 ae_vector rw; 88 ae_vector tw; 89 ae_vector wcur; 90 ae_vector wprev; 91 ae_vector wrank; 92 apbuffers buf; 93 ae_matrix x; 94 ae_matrix ax; 95 ae_int_t requesttype; 96 ae_int_t requestsize; 97 ae_int_t repiterationscount; 98 rcommstate rstate; 99 } eigsubspacestate; 100 typedef struct 101 { 102 ae_int_t iterationscount; 103 } eigsubspacereport; 104 #endif 105 #if defined(AE_COMPILE_DLU) || !defined(AE_PARTIAL_BUILD) 106 #endif 107 #if defined(AE_COMPILE_SPTRF) || !defined(AE_PARTIAL_BUILD) 108 typedef struct 109 { 110 ae_int_t nfixed; 111 ae_int_t ndynamic; 112 ae_vector idxfirst; 113 ae_vector strgidx; 114 ae_vector strgval; 115 ae_int_t nallocated; 116 ae_int_t nused; 117 } sluv2list1matrix; 118 typedef struct 119 { 120 ae_int_t n; 121 ae_int_t k; 122 ae_vector nzc; 123 ae_int_t maxwrkcnt; 124 ae_int_t maxwrknz; 125 ae_int_t wrkcnt; 126 ae_vector wrkset; 127 ae_vector colid; 128 ae_vector isdensified; 129 ae_vector slscolptr; 130 ae_vector slsrowptr; 131 ae_vector slsidx; 132 ae_vector slsval; 133 ae_int_t slsused; 134 ae_vector tmp0; 135 } sluv2sparsetrail; 136 typedef struct 137 { 138 ae_int_t n; 139 ae_int_t ndense; 140 ae_matrix d; 141 ae_vector did; 142 } sluv2densetrail; 143 typedef struct 144 { 145 ae_int_t n; 146 sparsematrix sparsel; 147 sparsematrix sparseut; 148 sluv2list1matrix bleft; 149 sluv2list1matrix bupper; 150 sluv2sparsetrail strail; 151 sluv2densetrail dtrail; 152 ae_vector rowpermrawidx; 153 ae_matrix dbuf; 154 ae_vector v0i; 155 ae_vector v1i; 156 ae_vector v0r; 157 ae_vector v1r; 158 ae_vector tmp0; 159 ae_vector tmpi; 160 ae_vector tmpp; 161 } sluv2buffer; 162 #endif 163 #if defined(AE_COMPILE_AMDORDERING) || !defined(AE_PARTIAL_BUILD) 164 typedef struct 165 { 166 ae_int_t n; 167 ae_int_t nstored; 168 ae_vector items; 169 ae_vector locationof; 170 ae_int_t iteridx; 171 } amdnset; 172 typedef struct 173 { 174 ae_int_t k; 175 ae_int_t n; 176 ae_vector flagarray; 177 ae_vector vbegin; 178 ae_vector vallocated; 179 ae_vector vcnt; 180 ae_vector data; 181 ae_int_t dataused; 182 ae_int_t iterrow; 183 ae_int_t iteridx; 184 } amdknset; 185 typedef struct 186 { 187 ae_int_t n; 188 ae_bool checkexactdegrees; 189 ae_int_t smallestdegree; 190 ae_vector approxd; 191 ae_vector optionalexactd; 192 ae_vector isvertex; 193 ae_vector vbegin; 194 ae_vector vprev; 195 ae_vector vnext; 196 } amdvertexset; 197 typedef struct 198 { 199 ae_int_t n; 200 ae_vector vbegin; 201 ae_vector vcolcnt; 202 ae_vector entries; 203 ae_int_t entriesinitialized; 204 } amdllmatrix; 205 typedef struct 206 { 207 ae_int_t n; 208 ae_bool extendeddebug; 209 ae_bool checkexactdegrees; 210 ae_vector iseliminated; 211 ae_vector issupernode; 212 amdknset setsuper; 213 amdknset seta; 214 amdknset sete; 215 amdllmatrix mtxl; 216 amdvertexset vertexdegrees; 217 amdnset setq; 218 ae_vector perm; 219 ae_vector invperm; 220 ae_vector columnswaps; 221 amdnset setp; 222 amdnset lp; 223 amdnset setrp; 224 amdnset ep; 225 amdnset adji; 226 amdnset adjj; 227 ae_vector ls; 228 ae_int_t lscnt; 229 amdnset setqsupercand; 230 amdnset exactdegreetmp0; 231 amdknset hashbuckets; 232 amdnset nonemptybuckets; 233 ae_vector sncandidates; 234 ae_vector tmp0; 235 ae_vector arrwe; 236 ae_matrix dbga; 237 } amdbuffer; 238 #endif 239 #if defined(AE_COMPILE_SPCHOL) || !defined(AE_PARTIAL_BUILD) 240 typedef struct 241 { 242 ae_int_t tasktype; 243 ae_int_t n; 244 ae_int_t permtype; 245 ae_bool unitd; 246 ae_int_t modtype; 247 double modparam0; 248 double modparam1; 249 double modparam2; 250 double modparam3; 251 ae_bool extendeddebug; 252 ae_bool dotrace; 253 ae_bool dotracesupernodalstructure; 254 ae_int_t nsuper; 255 ae_vector parentsupernode; 256 ae_vector supercolrange; 257 ae_vector superrowridx; 258 ae_vector superrowidx; 259 ae_vector fillinperm; 260 ae_vector invfillinperm; 261 ae_vector superperm; 262 ae_vector invsuperperm; 263 ae_vector effectiveperm; 264 ae_vector inveffectiveperm; 265 ae_bool istopologicalordering; 266 ae_bool applypermutationtooutput; 267 ae_vector ladjplusr; 268 ae_vector ladjplus; 269 ae_vector outrowcounts; 270 ae_vector inputstorage; 271 ae_vector outputstorage; 272 ae_vector rowstrides; 273 ae_vector rowoffsets; 274 ae_vector diagd; 275 ae_vector wrkrows; 276 ae_vector flagarray; 277 ae_vector tmpparent; 278 ae_vector node2supernode; 279 ae_vector u2smap; 280 ae_vector raw2smap; 281 amdbuffer amdtmp; 282 ae_vector tmp0; 283 ae_vector tmp1; 284 ae_vector tmp2; 285 ae_vector tmp3; 286 ae_vector tmp4; 287 sparsematrix tmpa; 288 sparsematrix tmpat; 289 sparsematrix tmpa2; 290 sparsematrix tmpbottomt; 291 sparsematrix tmpupdate; 292 sparsematrix tmpupdatet; 293 sparsematrix tmpnewtailt; 294 ae_vector tmpperm; 295 ae_vector invtmpperm; 296 ae_vector tmpx; 297 ae_vector simdbuf; 298 } spcholanalysis; 299 #endif 300 #if defined(AE_COMPILE_TRFAC) || !defined(AE_PARTIAL_BUILD) 301 typedef struct 302 { 303 ae_int_t n; 304 ae_int_t facttype; 305 ae_int_t permtype; 306 spcholanalysis analysis; 307 sparsematrix wrka; 308 sparsematrix wrkat; 309 sparsematrix crsa; 310 sparsematrix crsat; 311 } sparsedecompositionanalysis; 312 #endif 313 #if defined(AE_COMPILE_BDSVD) || !defined(AE_PARTIAL_BUILD) 314 #endif 315 #if defined(AE_COMPILE_SVD) || !defined(AE_PARTIAL_BUILD) 316 #endif 317 #if defined(AE_COMPILE_RCOND) || !defined(AE_PARTIAL_BUILD) 318 #endif 319 #if defined(AE_COMPILE_FBLS) || !defined(AE_PARTIAL_BUILD) 320 typedef struct 321 { 322 double e1; 323 double e2; 324 ae_vector x; 325 ae_vector ax; 326 double xax; 327 ae_int_t n; 328 ae_vector rk; 329 ae_vector rk1; 330 ae_vector xk; 331 ae_vector xk1; 332 ae_vector pk; 333 ae_vector pk1; 334 ae_vector b; 335 rcommstate rstate; 336 ae_vector tmp2; 337 } fblslincgstate; 338 typedef struct 339 { 340 ae_vector b; 341 ae_vector x; 342 ae_vector ax; 343 ae_vector xs; 344 ae_matrix qi; 345 ae_matrix aqi; 346 ae_matrix h; 347 ae_matrix hq; 348 ae_matrix hr; 349 ae_vector hqb; 350 ae_vector ys; 351 ae_vector tmp0; 352 ae_vector tmp1; 353 ae_int_t n; 354 ae_int_t itscnt; 355 double epsort; 356 double epsres; 357 double epsred; 358 double epsdiag; 359 ae_int_t itsperformed; 360 ae_int_t retcode; 361 rcommstate rstate; 362 } fblsgmresstate; 363 #endif 364 #if defined(AE_COMPILE_NORMESTIMATOR) || !defined(AE_PARTIAL_BUILD) 365 typedef struct 366 { 367 ae_int_t n; 368 ae_int_t m; 369 ae_int_t nstart; 370 ae_int_t nits; 371 ae_int_t seedval; 372 ae_vector x0; 373 ae_vector x1; 374 ae_vector t; 375 ae_vector xbest; 376 hqrndstate r; 377 ae_vector x; 378 ae_vector mv; 379 ae_vector mtv; 380 ae_bool needmv; 381 ae_bool needmtv; 382 double repnorm; 383 rcommstate rstate; 384 } normestimatorstate; 385 #endif 386 #if defined(AE_COMPILE_MATINV) || !defined(AE_PARTIAL_BUILD) 387 typedef struct 388 { 389 double r1; 390 double rinf; 391 } matinvreport; 392 #endif 393 #if defined(AE_COMPILE_INVERSEUPDATE) || !defined(AE_PARTIAL_BUILD) 394 #endif 395 #if defined(AE_COMPILE_SCHUR) || !defined(AE_PARTIAL_BUILD) 396 #endif 397 #if defined(AE_COMPILE_SPDGEVD) || !defined(AE_PARTIAL_BUILD) 398 #endif 399 #if defined(AE_COMPILE_MATDET) || !defined(AE_PARTIAL_BUILD) 400 #endif 401 402 } 403 404 ///////////////////////////////////////////////////////////////////////// 405 // 406 // THIS SECTION CONTAINS C++ INTERFACE 407 // 408 ///////////////////////////////////////////////////////////////////////// 409 namespace alglib 410 { 411 412 #if defined(AE_COMPILE_ABLAS) || !defined(AE_PARTIAL_BUILD) 413 414 #endif 415 416 #if defined(AE_COMPILE_ORTFAC) || !defined(AE_PARTIAL_BUILD) 417 418 #endif 419 420 #if defined(AE_COMPILE_MATGEN) || !defined(AE_PARTIAL_BUILD) 421 422 #endif 423 424 #if defined(AE_COMPILE_SPARSE) || !defined(AE_PARTIAL_BUILD) 425 /************************************************************************* 426 Sparse matrix structure. 427 428 You should use ALGLIB functions to work with sparse matrix. Never try to 429 access its fields directly! 430 431 NOTES ON THE SPARSE STORAGE FORMATS 432 433 Sparse matrices can be stored using several formats: 434 * Hash-Table representation 435 * Compressed Row Storage (CRS) 436 * Skyline matrix storage (SKS) 437 438 Each of the formats has benefits and drawbacks: 439 * Hash-table is good for dynamic operations (insertion of new elements), 440 but does not support linear algebra operations 441 * CRS is good for operations like matrix-vector or matrix-matrix products, 442 but its initialization is less convenient - you have to tell row sizes 443 at the initialization, and you have to fill matrix only row by row, 444 from left to right. 445 * SKS is a special format which is used to store triangular factors from 446 Cholesky factorization. It does not support dynamic modification, and 447 support for linear algebra operations is very limited. 448 449 Tables below outline information about these two formats: 450 451 OPERATIONS WITH MATRIX HASH CRS SKS 452 creation + + + 453 SparseGet + + + 454 SparseExists + + + 455 SparseRewriteExisting + + + 456 SparseSet + + + 457 SparseAdd + 458 SparseGetRow + + 459 SparseGetCompressedRow + + 460 sparse-dense linear algebra + + 461 *************************************************************************/ 462 class _sparsematrix_owner 463 { 464 public: 465 _sparsematrix_owner(); 466 _sparsematrix_owner(const _sparsematrix_owner &rhs); 467 _sparsematrix_owner& operator=(const _sparsematrix_owner &rhs); 468 virtual ~_sparsematrix_owner(); 469 alglib_impl::sparsematrix* c_ptr(); 470 alglib_impl::sparsematrix* c_ptr() const; 471 protected: 472 alglib_impl::sparsematrix *p_struct; 473 }; 474 class sparsematrix : public _sparsematrix_owner 475 { 476 public: 477 sparsematrix(); 478 sparsematrix(const sparsematrix &rhs); 479 sparsematrix& operator=(const sparsematrix &rhs); 480 virtual ~sparsematrix(); 481 482 }; 483 484 485 /************************************************************************* 486 Temporary buffers for sparse matrix operations. 487 488 You should pass an instance of this structure to factorization functions. 489 It allows to reuse memory during repeated sparse factorizations. You do 490 not have to call some initialization function - simply passing an instance 491 to factorization function is enough. 492 *************************************************************************/ 493 class _sparsebuffers_owner 494 { 495 public: 496 _sparsebuffers_owner(); 497 _sparsebuffers_owner(const _sparsebuffers_owner &rhs); 498 _sparsebuffers_owner& operator=(const _sparsebuffers_owner &rhs); 499 virtual ~_sparsebuffers_owner(); 500 alglib_impl::sparsebuffers* c_ptr(); 501 alglib_impl::sparsebuffers* c_ptr() const; 502 protected: 503 alglib_impl::sparsebuffers *p_struct; 504 }; 505 class sparsebuffers : public _sparsebuffers_owner 506 { 507 public: 508 sparsebuffers(); 509 sparsebuffers(const sparsebuffers &rhs); 510 sparsebuffers& operator=(const sparsebuffers &rhs); 511 virtual ~sparsebuffers(); 512 513 }; 514 #endif 515 516 #if defined(AE_COMPILE_HSSCHUR) || !defined(AE_PARTIAL_BUILD) 517 518 #endif 519 520 #if defined(AE_COMPILE_EVD) || !defined(AE_PARTIAL_BUILD) 521 /************************************************************************* 522 This object stores state of the subspace iteration algorithm. 523 524 You should use ALGLIB functions to work with this object. 525 *************************************************************************/ 526 class _eigsubspacestate_owner 527 { 528 public: 529 _eigsubspacestate_owner(); 530 _eigsubspacestate_owner(const _eigsubspacestate_owner &rhs); 531 _eigsubspacestate_owner& operator=(const _eigsubspacestate_owner &rhs); 532 virtual ~_eigsubspacestate_owner(); 533 alglib_impl::eigsubspacestate* c_ptr(); 534 alglib_impl::eigsubspacestate* c_ptr() const; 535 protected: 536 alglib_impl::eigsubspacestate *p_struct; 537 }; 538 class eigsubspacestate : public _eigsubspacestate_owner 539 { 540 public: 541 eigsubspacestate(); 542 eigsubspacestate(const eigsubspacestate &rhs); 543 eigsubspacestate& operator=(const eigsubspacestate &rhs); 544 virtual ~eigsubspacestate(); 545 546 }; 547 548 549 /************************************************************************* 550 This object stores state of the subspace iteration algorithm. 551 552 You should use ALGLIB functions to work with this object. 553 *************************************************************************/ 554 class _eigsubspacereport_owner 555 { 556 public: 557 _eigsubspacereport_owner(); 558 _eigsubspacereport_owner(const _eigsubspacereport_owner &rhs); 559 _eigsubspacereport_owner& operator=(const _eigsubspacereport_owner &rhs); 560 virtual ~_eigsubspacereport_owner(); 561 alglib_impl::eigsubspacereport* c_ptr(); 562 alglib_impl::eigsubspacereport* c_ptr() const; 563 protected: 564 alglib_impl::eigsubspacereport *p_struct; 565 }; 566 class eigsubspacereport : public _eigsubspacereport_owner 567 { 568 public: 569 eigsubspacereport(); 570 eigsubspacereport(const eigsubspacereport &rhs); 571 eigsubspacereport& operator=(const eigsubspacereport &rhs); 572 virtual ~eigsubspacereport(); 573 ae_int_t &iterationscount; 574 575 }; 576 #endif 577 578 #if defined(AE_COMPILE_DLU) || !defined(AE_PARTIAL_BUILD) 579 580 #endif 581 582 #if defined(AE_COMPILE_SPTRF) || !defined(AE_PARTIAL_BUILD) 583 584 #endif 585 586 #if defined(AE_COMPILE_AMDORDERING) || !defined(AE_PARTIAL_BUILD) 587 588 #endif 589 590 #if defined(AE_COMPILE_SPCHOL) || !defined(AE_PARTIAL_BUILD) 591 592 #endif 593 594 #if defined(AE_COMPILE_TRFAC) || !defined(AE_PARTIAL_BUILD) 595 /************************************************************************* 596 An analysis of the sparse matrix decomposition, performed prior to actual 597 numerical factorization. You should not directly access fields of this 598 object - use appropriate ALGLIB functions to work with this object. 599 *************************************************************************/ 600 class _sparsedecompositionanalysis_owner 601 { 602 public: 603 _sparsedecompositionanalysis_owner(); 604 _sparsedecompositionanalysis_owner(const _sparsedecompositionanalysis_owner &rhs); 605 _sparsedecompositionanalysis_owner& operator=(const _sparsedecompositionanalysis_owner &rhs); 606 virtual ~_sparsedecompositionanalysis_owner(); 607 alglib_impl::sparsedecompositionanalysis* c_ptr(); 608 alglib_impl::sparsedecompositionanalysis* c_ptr() const; 609 protected: 610 alglib_impl::sparsedecompositionanalysis *p_struct; 611 }; 612 class sparsedecompositionanalysis : public _sparsedecompositionanalysis_owner 613 { 614 public: 615 sparsedecompositionanalysis(); 616 sparsedecompositionanalysis(const sparsedecompositionanalysis &rhs); 617 sparsedecompositionanalysis& operator=(const sparsedecompositionanalysis &rhs); 618 virtual ~sparsedecompositionanalysis(); 619 620 }; 621 #endif 622 623 #if defined(AE_COMPILE_BDSVD) || !defined(AE_PARTIAL_BUILD) 624 625 #endif 626 627 #if defined(AE_COMPILE_SVD) || !defined(AE_PARTIAL_BUILD) 628 629 #endif 630 631 #if defined(AE_COMPILE_RCOND) || !defined(AE_PARTIAL_BUILD) 632 633 #endif 634 635 #if defined(AE_COMPILE_FBLS) || !defined(AE_PARTIAL_BUILD) 636 637 #endif 638 639 #if defined(AE_COMPILE_NORMESTIMATOR) || !defined(AE_PARTIAL_BUILD) 640 /************************************************************************* 641 This object stores state of the iterative norm estimation algorithm. 642 643 You should use ALGLIB functions to work with this object. 644 *************************************************************************/ 645 class _normestimatorstate_owner 646 { 647 public: 648 _normestimatorstate_owner(); 649 _normestimatorstate_owner(const _normestimatorstate_owner &rhs); 650 _normestimatorstate_owner& operator=(const _normestimatorstate_owner &rhs); 651 virtual ~_normestimatorstate_owner(); 652 alglib_impl::normestimatorstate* c_ptr(); 653 alglib_impl::normestimatorstate* c_ptr() const; 654 protected: 655 alglib_impl::normestimatorstate *p_struct; 656 }; 657 class normestimatorstate : public _normestimatorstate_owner 658 { 659 public: 660 normestimatorstate(); 661 normestimatorstate(const normestimatorstate &rhs); 662 normestimatorstate& operator=(const normestimatorstate &rhs); 663 virtual ~normestimatorstate(); 664 665 }; 666 #endif 667 668 #if defined(AE_COMPILE_MATINV) || !defined(AE_PARTIAL_BUILD) 669 /************************************************************************* 670 Matrix inverse report: 671 * R1 reciprocal of condition number in 1-norm 672 * RInf reciprocal of condition number in inf-norm 673 *************************************************************************/ 674 class _matinvreport_owner 675 { 676 public: 677 _matinvreport_owner(); 678 _matinvreport_owner(const _matinvreport_owner &rhs); 679 _matinvreport_owner& operator=(const _matinvreport_owner &rhs); 680 virtual ~_matinvreport_owner(); 681 alglib_impl::matinvreport* c_ptr(); 682 alglib_impl::matinvreport* c_ptr() const; 683 protected: 684 alglib_impl::matinvreport *p_struct; 685 }; 686 class matinvreport : public _matinvreport_owner 687 { 688 public: 689 matinvreport(); 690 matinvreport(const matinvreport &rhs); 691 matinvreport& operator=(const matinvreport &rhs); 692 virtual ~matinvreport(); 693 double &r1; 694 double &rinf; 695 696 }; 697 #endif 698 699 #if defined(AE_COMPILE_INVERSEUPDATE) || !defined(AE_PARTIAL_BUILD) 700 701 #endif 702 703 #if defined(AE_COMPILE_SCHUR) || !defined(AE_PARTIAL_BUILD) 704 705 #endif 706 707 #if defined(AE_COMPILE_SPDGEVD) || !defined(AE_PARTIAL_BUILD) 708 709 #endif 710 711 #if defined(AE_COMPILE_MATDET) || !defined(AE_PARTIAL_BUILD) 712 713 #endif 714 715 #if defined(AE_COMPILE_ABLAS) || !defined(AE_PARTIAL_BUILD) 716 /************************************************************************* 717 Cache-oblivous complex "copy-and-transpose" 718 719 Input parameters: 720 M - number of rows 721 N - number of columns 722 A - source matrix, MxN submatrix is copied and transposed 723 IA - submatrix offset (row index) 724 JA - submatrix offset (column index) 725 B - destination matrix, must be large enough to store result 726 IB - submatrix offset (row index) 727 JB - submatrix offset (column index) 728 *************************************************************************/ 729 void cmatrixtranspose(const ae_int_t m, const ae_int_t n, const complex_2d_array &a, const ae_int_t ia, const ae_int_t ja, complex_2d_array &b, const ae_int_t ib, const ae_int_t jb, const xparams _xparams = alglib::xdefault); 730 731 732 /************************************************************************* 733 Cache-oblivous real "copy-and-transpose" 734 735 Input parameters: 736 M - number of rows 737 N - number of columns 738 A - source matrix, MxN submatrix is copied and transposed 739 IA - submatrix offset (row index) 740 JA - submatrix offset (column index) 741 B - destination matrix, must be large enough to store result 742 IB - submatrix offset (row index) 743 JB - submatrix offset (column index) 744 *************************************************************************/ 745 void rmatrixtranspose(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const real_2d_array &b, const ae_int_t ib, const ae_int_t jb, const xparams _xparams = alglib::xdefault); 746 747 748 /************************************************************************* 749 This code enforces symmetricy of the matrix by copying Upper part to lower 750 one (or vice versa). 751 752 INPUT PARAMETERS: 753 A - matrix 754 N - number of rows/columns 755 IsUpper - whether we want to copy upper triangle to lower one (True) 756 or vice versa (False). 757 *************************************************************************/ 758 void rmatrixenforcesymmetricity(const real_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 759 760 761 /************************************************************************* 762 Copy 763 764 Input parameters: 765 M - number of rows 766 N - number of columns 767 A - source matrix, MxN submatrix is copied and transposed 768 IA - submatrix offset (row index) 769 JA - submatrix offset (column index) 770 B - destination matrix, must be large enough to store result 771 IB - submatrix offset (row index) 772 JB - submatrix offset (column index) 773 *************************************************************************/ 774 void cmatrixcopy(const ae_int_t m, const ae_int_t n, const complex_2d_array &a, const ae_int_t ia, const ae_int_t ja, complex_2d_array &b, const ae_int_t ib, const ae_int_t jb, const xparams _xparams = alglib::xdefault); 775 776 777 /************************************************************************* 778 Copy 779 780 Input parameters: 781 N - subvector size 782 A - source vector, N elements are copied 783 IA - source offset (first element index) 784 B - destination vector, must be large enough to store result 785 IB - destination offset (first element index) 786 *************************************************************************/ 787 void rvectorcopy(const ae_int_t n, const real_1d_array &a, const ae_int_t ia, const real_1d_array &b, const ae_int_t ib, const xparams _xparams = alglib::xdefault); 788 789 790 /************************************************************************* 791 Copy 792 793 Input parameters: 794 M - number of rows 795 N - number of columns 796 A - source matrix, MxN submatrix is copied and transposed 797 IA - submatrix offset (row index) 798 JA - submatrix offset (column index) 799 B - destination matrix, must be large enough to store result 800 IB - submatrix offset (row index) 801 JB - submatrix offset (column index) 802 *************************************************************************/ 803 void rmatrixcopy(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const real_2d_array &b, const ae_int_t ib, const ae_int_t jb, const xparams _xparams = alglib::xdefault); 804 805 806 /************************************************************************* 807 Performs generalized copy: B := Beta*B + Alpha*A. 808 809 If Beta=0, then previous contents of B is simply ignored. If Alpha=0, then 810 A is ignored and not referenced. If both Alpha and Beta are zero, B is 811 filled by zeros. 812 813 Input parameters: 814 M - number of rows 815 N - number of columns 816 Alpha- coefficient 817 A - source matrix, MxN submatrix is copied and transposed 818 IA - submatrix offset (row index) 819 JA - submatrix offset (column index) 820 Beta- coefficient 821 B - destination matrix, must be large enough to store result 822 IB - submatrix offset (row index) 823 JB - submatrix offset (column index) 824 *************************************************************************/ 825 void rmatrixgencopy(const ae_int_t m, const ae_int_t n, const double alpha, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const double beta, const real_2d_array &b, const ae_int_t ib, const ae_int_t jb, const xparams _xparams = alglib::xdefault); 826 827 828 /************************************************************************* 829 Rank-1 correction: A := A + alpha*u*v' 830 831 NOTE: this function expects A to be large enough to store result. No 832 automatic preallocation happens for smaller arrays. No integrity 833 checks is performed for sizes of A, u, v. 834 835 INPUT PARAMETERS: 836 M - number of rows 837 N - number of columns 838 A - target matrix, MxN submatrix is updated 839 IA - submatrix offset (row index) 840 JA - submatrix offset (column index) 841 Alpha- coefficient 842 U - vector #1 843 IU - subvector offset 844 V - vector #2 845 IV - subvector offset 846 847 848 -- ALGLIB routine -- 849 850 16.10.2017 851 Bochkanov Sergey 852 *************************************************************************/ 853 void rmatrixger(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const double alpha, const real_1d_array &u, const ae_int_t iu, const real_1d_array &v, const ae_int_t iv, const xparams _xparams = alglib::xdefault); 854 855 856 /************************************************************************* 857 Rank-1 correction: A := A + u*v' 858 859 INPUT PARAMETERS: 860 M - number of rows 861 N - number of columns 862 A - target matrix, MxN submatrix is updated 863 IA - submatrix offset (row index) 864 JA - submatrix offset (column index) 865 U - vector #1 866 IU - subvector offset 867 V - vector #2 868 IV - subvector offset 869 *************************************************************************/ 870 void cmatrixrank1(const ae_int_t m, const ae_int_t n, complex_2d_array &a, const ae_int_t ia, const ae_int_t ja, complex_1d_array &u, const ae_int_t iu, complex_1d_array &v, const ae_int_t iv, const xparams _xparams = alglib::xdefault); 871 872 873 /************************************************************************* 874 IMPORTANT: this function is deprecated since ALGLIB 3.13. Use RMatrixGER() 875 which is more generic version of this function. 876 877 Rank-1 correction: A := A + u*v' 878 879 INPUT PARAMETERS: 880 M - number of rows 881 N - number of columns 882 A - target matrix, MxN submatrix is updated 883 IA - submatrix offset (row index) 884 JA - submatrix offset (column index) 885 U - vector #1 886 IU - subvector offset 887 V - vector #2 888 IV - subvector offset 889 *************************************************************************/ 890 void rmatrixrank1(const ae_int_t m, const ae_int_t n, real_2d_array &a, const ae_int_t ia, const ae_int_t ja, real_1d_array &u, const ae_int_t iu, real_1d_array &v, const ae_int_t iv, const xparams _xparams = alglib::xdefault); 891 892 893 /************************************************************************* 894 895 *************************************************************************/ 896 void rmatrixgemv(const ae_int_t m, const ae_int_t n, const double alpha, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t opa, const real_1d_array &x, const ae_int_t ix, const double beta, const real_1d_array &y, const ae_int_t iy, const xparams _xparams = alglib::xdefault); 897 898 899 /************************************************************************* 900 Matrix-vector product: y := op(A)*x 901 902 INPUT PARAMETERS: 903 M - number of rows of op(A) 904 M>=0 905 N - number of columns of op(A) 906 N>=0 907 A - target matrix 908 IA - submatrix offset (row index) 909 JA - submatrix offset (column index) 910 OpA - operation type: 911 * OpA=0 => op(A) = A 912 * OpA=1 => op(A) = A^T 913 * OpA=2 => op(A) = A^H 914 X - input vector 915 IX - subvector offset 916 IY - subvector offset 917 Y - preallocated matrix, must be large enough to store result 918 919 OUTPUT PARAMETERS: 920 Y - vector which stores result 921 922 if M=0, then subroutine does nothing. 923 if N=0, Y is filled by zeros. 924 925 926 -- ALGLIB routine -- 927 928 28.01.2010 929 Bochkanov Sergey 930 *************************************************************************/ 931 void cmatrixmv(const ae_int_t m, const ae_int_t n, const complex_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t opa, const complex_1d_array &x, const ae_int_t ix, complex_1d_array &y, const ae_int_t iy, const xparams _xparams = alglib::xdefault); 932 933 934 /************************************************************************* 935 IMPORTANT: this function is deprecated since ALGLIB 3.13. Use RMatrixGEMV() 936 which is more generic version of this function. 937 938 Matrix-vector product: y := op(A)*x 939 940 INPUT PARAMETERS: 941 M - number of rows of op(A) 942 N - number of columns of op(A) 943 A - target matrix 944 IA - submatrix offset (row index) 945 JA - submatrix offset (column index) 946 OpA - operation type: 947 * OpA=0 => op(A) = A 948 * OpA=1 => op(A) = A^T 949 X - input vector 950 IX - subvector offset 951 IY - subvector offset 952 Y - preallocated matrix, must be large enough to store result 953 954 OUTPUT PARAMETERS: 955 Y - vector which stores result 956 957 if M=0, then subroutine does nothing. 958 if N=0, Y is filled by zeros. 959 960 961 -- ALGLIB routine -- 962 963 28.01.2010 964 Bochkanov Sergey 965 *************************************************************************/ 966 void rmatrixmv(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t opa, const real_1d_array &x, const ae_int_t ix, const real_1d_array &y, const ae_int_t iy, const xparams _xparams = alglib::xdefault); 967 968 969 /************************************************************************* 970 971 *************************************************************************/ 972 void rmatrixsymv(const ae_int_t n, const double alpha, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const bool isupper, const real_1d_array &x, const ae_int_t ix, const double beta, const real_1d_array &y, const ae_int_t iy, const xparams _xparams = alglib::xdefault); 973 974 975 /************************************************************************* 976 977 *************************************************************************/ 978 double rmatrixsyvmv(const ae_int_t n, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const bool isupper, const real_1d_array &x, const ae_int_t ix, const real_1d_array &tmp, const xparams _xparams = alglib::xdefault); 979 980 981 /************************************************************************* 982 This subroutine solves linear system op(A)*x=b where: 983 * A is NxN upper/lower triangular/unitriangular matrix 984 * X and B are Nx1 vectors 985 * "op" may be identity transformation or transposition 986 987 Solution replaces X. 988 989 IMPORTANT: * no overflow/underflow/denegeracy tests is performed. 990 * no integrity checks for operand sizes, out-of-bounds accesses 991 and so on is performed 992 993 INPUT PARAMETERS 994 N - matrix size, N>=0 995 A - matrix, actial matrix is stored in A[IA:IA+N-1,JA:JA+N-1] 996 IA - submatrix offset 997 JA - submatrix offset 998 IsUpper - whether matrix is upper triangular 999 IsUnit - whether matrix is unitriangular 1000 OpType - transformation type: 1001 * 0 - no transformation 1002 * 1 - transposition 1003 X - right part, actual vector is stored in X[IX:IX+N-1] 1004 IX - offset 1005 1006 OUTPUT PARAMETERS 1007 X - solution replaces elements X[IX:IX+N-1] 1008 1009 -- ALGLIB routine / remastering of LAPACK's DTRSV -- 1010 (c) 2017 Bochkanov Sergey - converted to ALGLIB 1011 (c) 2016 Reference BLAS level1 routine (LAPACK version 3.7.0) 1012 Reference BLAS is a software package provided by Univ. of Tennessee, 1013 Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd. 1014 *************************************************************************/ 1015 void rmatrixtrsv(const ae_int_t n, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const bool isupper, const bool isunit, const ae_int_t optype, const real_1d_array &x, const ae_int_t ix, const xparams _xparams = alglib::xdefault); 1016 1017 1018 /************************************************************************* 1019 This subroutine calculates X*op(A^-1) where: 1020 * X is MxN general matrix 1021 * A is NxN upper/lower triangular/unitriangular matrix 1022 * "op" may be identity transformation, transposition, conjugate transposition 1023 Multiplication result replaces X. 1024 1025 INPUT PARAMETERS 1026 N - matrix size, N>=0 1027 M - matrix size, N>=0 1028 A - matrix, actial matrix is stored in A[I1:I1+N-1,J1:J1+N-1] 1029 I1 - submatrix offset 1030 J1 - submatrix offset 1031 IsUpper - whether matrix is upper triangular 1032 IsUnit - whether matrix is unitriangular 1033 OpType - transformation type: 1034 * 0 - no transformation 1035 * 1 - transposition 1036 * 2 - conjugate transposition 1037 X - matrix, actial matrix is stored in X[I2:I2+M-1,J2:J2+N-1] 1038 I2 - submatrix offset 1039 J2 - submatrix offset 1040 1041 ! FREE EDITION OF ALGLIB: 1042 ! 1043 ! Free Edition of ALGLIB supports following important features for this 1044 ! function: 1045 ! * C++ version: x64 SIMD support using C++ intrinsics 1046 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1047 ! 1048 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1049 ! Reference Manual in order to find out how to activate SIMD support 1050 ! in ALGLIB. 1051 1052 ! COMMERCIAL EDITION OF ALGLIB: 1053 ! 1054 ! Commercial Edition of ALGLIB includes following important improvements 1055 ! of this function: 1056 ! * high-performance native backend with same C# interface (C# version) 1057 ! * multithreading support (C++ and C# versions) 1058 ! * hardware vendor (Intel) implementations of linear algebra primitives 1059 ! (C++ and C# versions, x86/x64 platform) 1060 ! 1061 ! We recommend you to read 'Working with commercial version' section of 1062 ! ALGLIB Reference Manual in order to find out how to use performance- 1063 ! related features provided by commercial edition of ALGLIB. 1064 1065 -- ALGLIB routine -- 1066 20.01.2018 1067 Bochkanov Sergey 1068 *************************************************************************/ 1069 void cmatrixrighttrsm(const ae_int_t m, const ae_int_t n, const complex_2d_array &a, const ae_int_t i1, const ae_int_t j1, const bool isupper, const bool isunit, const ae_int_t optype, const complex_2d_array &x, const ae_int_t i2, const ae_int_t j2, const xparams _xparams = alglib::xdefault); 1070 1071 1072 /************************************************************************* 1073 This subroutine calculates op(A^-1)*X where: 1074 * X is MxN general matrix 1075 * A is MxM upper/lower triangular/unitriangular matrix 1076 * "op" may be identity transformation, transposition, conjugate transposition 1077 Multiplication result replaces X. 1078 1079 INPUT PARAMETERS 1080 N - matrix size, N>=0 1081 M - matrix size, N>=0 1082 A - matrix, actial matrix is stored in A[I1:I1+M-1,J1:J1+M-1] 1083 I1 - submatrix offset 1084 J1 - submatrix offset 1085 IsUpper - whether matrix is upper triangular 1086 IsUnit - whether matrix is unitriangular 1087 OpType - transformation type: 1088 * 0 - no transformation 1089 * 1 - transposition 1090 * 2 - conjugate transposition 1091 X - matrix, actial matrix is stored in X[I2:I2+M-1,J2:J2+N-1] 1092 I2 - submatrix offset 1093 J2 - submatrix offset 1094 1095 ! FREE EDITION OF ALGLIB: 1096 ! 1097 ! Free Edition of ALGLIB supports following important features for this 1098 ! function: 1099 ! * C++ version: x64 SIMD support using C++ intrinsics 1100 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1101 ! 1102 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1103 ! Reference Manual in order to find out how to activate SIMD support 1104 ! in ALGLIB. 1105 1106 ! COMMERCIAL EDITION OF ALGLIB: 1107 ! 1108 ! Commercial Edition of ALGLIB includes following important improvements 1109 ! of this function: 1110 ! * high-performance native backend with same C# interface (C# version) 1111 ! * multithreading support (C++ and C# versions) 1112 ! * hardware vendor (Intel) implementations of linear algebra primitives 1113 ! (C++ and C# versions, x86/x64 platform) 1114 ! 1115 ! We recommend you to read 'Working with commercial version' section of 1116 ! ALGLIB Reference Manual in order to find out how to use performance- 1117 ! related features provided by commercial edition of ALGLIB. 1118 1119 -- ALGLIB routine -- 1120 15.12.2009-22.01.2018 1121 Bochkanov Sergey 1122 *************************************************************************/ 1123 void cmatrixlefttrsm(const ae_int_t m, const ae_int_t n, const complex_2d_array &a, const ae_int_t i1, const ae_int_t j1, const bool isupper, const bool isunit, const ae_int_t optype, const complex_2d_array &x, const ae_int_t i2, const ae_int_t j2, const xparams _xparams = alglib::xdefault); 1124 1125 1126 /************************************************************************* 1127 This subroutine calculates X*op(A^-1) where: 1128 * X is MxN general matrix 1129 * A is NxN upper/lower triangular/unitriangular matrix 1130 * "op" may be identity transformation, transposition 1131 Multiplication result replaces X. 1132 1133 INPUT PARAMETERS 1134 N - matrix size, N>=0 1135 M - matrix size, N>=0 1136 A - matrix, actial matrix is stored in A[I1:I1+N-1,J1:J1+N-1] 1137 I1 - submatrix offset 1138 J1 - submatrix offset 1139 IsUpper - whether matrix is upper triangular 1140 IsUnit - whether matrix is unitriangular 1141 OpType - transformation type: 1142 * 0 - no transformation 1143 * 1 - transposition 1144 X - matrix, actial matrix is stored in X[I2:I2+M-1,J2:J2+N-1] 1145 I2 - submatrix offset 1146 J2 - submatrix offset 1147 1148 ! FREE EDITION OF ALGLIB: 1149 ! 1150 ! Free Edition of ALGLIB supports following important features for this 1151 ! function: 1152 ! * C++ version: x64 SIMD support using C++ intrinsics 1153 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1154 ! 1155 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1156 ! Reference Manual in order to find out how to activate SIMD support 1157 ! in ALGLIB. 1158 1159 ! COMMERCIAL EDITION OF ALGLIB: 1160 ! 1161 ! Commercial Edition of ALGLIB includes following important improvements 1162 ! of this function: 1163 ! * high-performance native backend with same C# interface (C# version) 1164 ! * multithreading support (C++ and C# versions) 1165 ! * hardware vendor (Intel) implementations of linear algebra primitives 1166 ! (C++ and C# versions, x86/x64 platform) 1167 ! 1168 ! We recommend you to read 'Working with commercial version' section of 1169 ! ALGLIB Reference Manual in order to find out how to use performance- 1170 ! related features provided by commercial edition of ALGLIB. 1171 1172 -- ALGLIB routine -- 1173 15.12.2009-22.01.2018 1174 Bochkanov Sergey 1175 *************************************************************************/ 1176 void rmatrixrighttrsm(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const ae_int_t i1, const ae_int_t j1, const bool isupper, const bool isunit, const ae_int_t optype, const real_2d_array &x, const ae_int_t i2, const ae_int_t j2, const xparams _xparams = alglib::xdefault); 1177 1178 1179 /************************************************************************* 1180 This subroutine calculates op(A^-1)*X where: 1181 * X is MxN general matrix 1182 * A is MxM upper/lower triangular/unitriangular matrix 1183 * "op" may be identity transformation, transposition 1184 Multiplication result replaces X. 1185 1186 INPUT PARAMETERS 1187 N - matrix size, N>=0 1188 M - matrix size, N>=0 1189 A - matrix, actial matrix is stored in A[I1:I1+M-1,J1:J1+M-1] 1190 I1 - submatrix offset 1191 J1 - submatrix offset 1192 IsUpper - whether matrix is upper triangular 1193 IsUnit - whether matrix is unitriangular 1194 OpType - transformation type: 1195 * 0 - no transformation 1196 * 1 - transposition 1197 X - matrix, actial matrix is stored in X[I2:I2+M-1,J2:J2+N-1] 1198 I2 - submatrix offset 1199 J2 - submatrix offset 1200 1201 ! FREE EDITION OF ALGLIB: 1202 ! 1203 ! Free Edition of ALGLIB supports following important features for this 1204 ! function: 1205 ! * C++ version: x64 SIMD support using C++ intrinsics 1206 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1207 ! 1208 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1209 ! Reference Manual in order to find out how to activate SIMD support 1210 ! in ALGLIB. 1211 1212 ! COMMERCIAL EDITION OF ALGLIB: 1213 ! 1214 ! Commercial Edition of ALGLIB includes following important improvements 1215 ! of this function: 1216 ! * high-performance native backend with same C# interface (C# version) 1217 ! * multithreading support (C++ and C# versions) 1218 ! * hardware vendor (Intel) implementations of linear algebra primitives 1219 ! (C++ and C# versions, x86/x64 platform) 1220 ! 1221 ! We recommend you to read 'Working with commercial version' section of 1222 ! ALGLIB Reference Manual in order to find out how to use performance- 1223 ! related features provided by commercial edition of ALGLIB. 1224 1225 -- ALGLIB routine -- 1226 15.12.2009-22.01.2018 1227 Bochkanov Sergey 1228 *************************************************************************/ 1229 void rmatrixlefttrsm(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const ae_int_t i1, const ae_int_t j1, const bool isupper, const bool isunit, const ae_int_t optype, const real_2d_array &x, const ae_int_t i2, const ae_int_t j2, const xparams _xparams = alglib::xdefault); 1230 1231 1232 /************************************************************************* 1233 This subroutine calculates C=alpha*A*A^H+beta*C or C=alpha*A^H*A+beta*C 1234 where: 1235 * C is NxN Hermitian matrix given by its upper/lower triangle 1236 * A is NxK matrix when A*A^H is calculated, KxN matrix otherwise 1237 1238 Additional info: 1239 * multiplication result replaces C. If Beta=0, C elements are not used in 1240 calculations (not multiplied by zero - just not referenced) 1241 * if Alpha=0, A is not used (not multiplied by zero - just not referenced) 1242 * if both Beta and Alpha are zero, C is filled by zeros. 1243 1244 INPUT PARAMETERS 1245 N - matrix size, N>=0 1246 K - matrix size, K>=0 1247 Alpha - coefficient 1248 A - matrix 1249 IA - submatrix offset (row index) 1250 JA - submatrix offset (column index) 1251 OpTypeA - multiplication type: 1252 * 0 - A*A^H is calculated 1253 * 2 - A^H*A is calculated 1254 Beta - coefficient 1255 C - preallocated input/output matrix 1256 IC - submatrix offset (row index) 1257 JC - submatrix offset (column index) 1258 IsUpper - whether upper or lower triangle of C is updated; 1259 this function updates only one half of C, leaving 1260 other half unchanged (not referenced at all). 1261 1262 ! FREE EDITION OF ALGLIB: 1263 ! 1264 ! Free Edition of ALGLIB supports following important features for this 1265 ! function: 1266 ! * C++ version: x64 SIMD support using C++ intrinsics 1267 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1268 ! 1269 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1270 ! Reference Manual in order to find out how to activate SIMD support 1271 ! in ALGLIB. 1272 1273 ! COMMERCIAL EDITION OF ALGLIB: 1274 ! 1275 ! Commercial Edition of ALGLIB includes following important improvements 1276 ! of this function: 1277 ! * high-performance native backend with same C# interface (C# version) 1278 ! * multithreading support (C++ and C# versions) 1279 ! * hardware vendor (Intel) implementations of linear algebra primitives 1280 ! (C++ and C# versions, x86/x64 platform) 1281 ! 1282 ! We recommend you to read 'Working with commercial version' section of 1283 ! ALGLIB Reference Manual in order to find out how to use performance- 1284 ! related features provided by commercial edition of ALGLIB. 1285 1286 -- ALGLIB routine -- 1287 16.12.2009-22.01.2018 1288 Bochkanov Sergey 1289 *************************************************************************/ 1290 void cmatrixherk(const ae_int_t n, const ae_int_t k, const double alpha, const complex_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t optypea, const double beta, const complex_2d_array &c, const ae_int_t ic, const ae_int_t jc, const bool isupper, const xparams _xparams = alglib::xdefault); 1291 1292 1293 /************************************************************************* 1294 This subroutine calculates C=alpha*A*A^T+beta*C or C=alpha*A^T*A+beta*C 1295 where: 1296 * C is NxN symmetric matrix given by its upper/lower triangle 1297 * A is NxK matrix when A*A^T is calculated, KxN matrix otherwise 1298 1299 Additional info: 1300 * multiplication result replaces C. If Beta=0, C elements are not used in 1301 calculations (not multiplied by zero - just not referenced) 1302 * if Alpha=0, A is not used (not multiplied by zero - just not referenced) 1303 * if both Beta and Alpha are zero, C is filled by zeros. 1304 1305 INPUT PARAMETERS 1306 N - matrix size, N>=0 1307 K - matrix size, K>=0 1308 Alpha - coefficient 1309 A - matrix 1310 IA - submatrix offset (row index) 1311 JA - submatrix offset (column index) 1312 OpTypeA - multiplication type: 1313 * 0 - A*A^T is calculated 1314 * 2 - A^T*A is calculated 1315 Beta - coefficient 1316 C - preallocated input/output matrix 1317 IC - submatrix offset (row index) 1318 JC - submatrix offset (column index) 1319 IsUpper - whether C is upper triangular or lower triangular 1320 1321 ! FREE EDITION OF ALGLIB: 1322 ! 1323 ! Free Edition of ALGLIB supports following important features for this 1324 ! function: 1325 ! * C++ version: x64 SIMD support using C++ intrinsics 1326 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1327 ! 1328 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1329 ! Reference Manual in order to find out how to activate SIMD support 1330 ! in ALGLIB. 1331 1332 ! COMMERCIAL EDITION OF ALGLIB: 1333 ! 1334 ! Commercial Edition of ALGLIB includes following important improvements 1335 ! of this function: 1336 ! * high-performance native backend with same C# interface (C# version) 1337 ! * multithreading support (C++ and C# versions) 1338 ! * hardware vendor (Intel) implementations of linear algebra primitives 1339 ! (C++ and C# versions, x86/x64 platform) 1340 ! 1341 ! We recommend you to read 'Working with commercial version' section of 1342 ! ALGLIB Reference Manual in order to find out how to use performance- 1343 ! related features provided by commercial edition of ALGLIB. 1344 1345 -- ALGLIB routine -- 1346 16.12.2009-22.01.2018 1347 Bochkanov Sergey 1348 *************************************************************************/ 1349 void rmatrixsyrk(const ae_int_t n, const ae_int_t k, const double alpha, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t optypea, const double beta, const real_2d_array &c, const ae_int_t ic, const ae_int_t jc, const bool isupper, const xparams _xparams = alglib::xdefault); 1350 1351 1352 /************************************************************************* 1353 This subroutine calculates C = alpha*op1(A)*op2(B) +beta*C where: 1354 * C is MxN general matrix 1355 * op1(A) is MxK matrix 1356 * op2(B) is KxN matrix 1357 * "op" may be identity transformation, transposition, conjugate transposition 1358 1359 Additional info: 1360 * cache-oblivious algorithm is used. 1361 * multiplication result replaces C. If Beta=0, C elements are not used in 1362 calculations (not multiplied by zero - just not referenced) 1363 * if Alpha=0, A is not used (not multiplied by zero - just not referenced) 1364 * if both Beta and Alpha are zero, C is filled by zeros. 1365 1366 IMPORTANT: 1367 1368 This function does NOT preallocate output matrix C, it MUST be preallocated 1369 by caller prior to calling this function. In case C does not have enough 1370 space to store result, exception will be generated. 1371 1372 INPUT PARAMETERS 1373 M - matrix size, M>0 1374 N - matrix size, N>0 1375 K - matrix size, K>0 1376 Alpha - coefficient 1377 A - matrix 1378 IA - submatrix offset 1379 JA - submatrix offset 1380 OpTypeA - transformation type: 1381 * 0 - no transformation 1382 * 1 - transposition 1383 * 2 - conjugate transposition 1384 B - matrix 1385 IB - submatrix offset 1386 JB - submatrix offset 1387 OpTypeB - transformation type: 1388 * 0 - no transformation 1389 * 1 - transposition 1390 * 2 - conjugate transposition 1391 Beta - coefficient 1392 C - matrix (PREALLOCATED, large enough to store result) 1393 IC - submatrix offset 1394 JC - submatrix offset 1395 1396 ! FREE EDITION OF ALGLIB: 1397 ! 1398 ! Free Edition of ALGLIB supports following important features for this 1399 ! function: 1400 ! * C++ version: x64 SIMD support using C++ intrinsics 1401 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1402 ! 1403 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1404 ! Reference Manual in order to find out how to activate SIMD support 1405 ! in ALGLIB. 1406 1407 ! COMMERCIAL EDITION OF ALGLIB: 1408 ! 1409 ! Commercial Edition of ALGLIB includes following important improvements 1410 ! of this function: 1411 ! * high-performance native backend with same C# interface (C# version) 1412 ! * multithreading support (C++ and C# versions) 1413 ! * hardware vendor (Intel) implementations of linear algebra primitives 1414 ! (C++ and C# versions, x86/x64 platform) 1415 ! 1416 ! We recommend you to read 'Working with commercial version' section of 1417 ! ALGLIB Reference Manual in order to find out how to use performance- 1418 ! related features provided by commercial edition of ALGLIB. 1419 1420 -- ALGLIB routine -- 1421 2009-2019 1422 Bochkanov Sergey 1423 *************************************************************************/ 1424 void cmatrixgemm(const ae_int_t m, const ae_int_t n, const ae_int_t k, const alglib::complex alpha, const complex_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t optypea, const complex_2d_array &b, const ae_int_t ib, const ae_int_t jb, const ae_int_t optypeb, const alglib::complex beta, const complex_2d_array &c, const ae_int_t ic, const ae_int_t jc, const xparams _xparams = alglib::xdefault); 1425 1426 1427 /************************************************************************* 1428 This subroutine calculates C = alpha*op1(A)*op2(B) +beta*C where: 1429 * C is MxN general matrix 1430 * op1(A) is MxK matrix 1431 * op2(B) is KxN matrix 1432 * "op" may be identity transformation, transposition 1433 1434 Additional info: 1435 * cache-oblivious algorithm is used. 1436 * multiplication result replaces C. If Beta=0, C elements are not used in 1437 calculations (not multiplied by zero - just not referenced) 1438 * if Alpha=0, A is not used (not multiplied by zero - just not referenced) 1439 * if both Beta and Alpha are zero, C is filled by zeros. 1440 1441 IMPORTANT: 1442 1443 This function does NOT preallocate output matrix C, it MUST be preallocated 1444 by caller prior to calling this function. In case C does not have enough 1445 space to store result, exception will be generated. 1446 1447 INPUT PARAMETERS 1448 M - matrix size, M>0 1449 N - matrix size, N>0 1450 K - matrix size, K>0 1451 Alpha - coefficient 1452 A - matrix 1453 IA - submatrix offset 1454 JA - submatrix offset 1455 OpTypeA - transformation type: 1456 * 0 - no transformation 1457 * 1 - transposition 1458 B - matrix 1459 IB - submatrix offset 1460 JB - submatrix offset 1461 OpTypeB - transformation type: 1462 * 0 - no transformation 1463 * 1 - transposition 1464 Beta - coefficient 1465 C - PREALLOCATED output matrix, large enough to store result 1466 IC - submatrix offset 1467 JC - submatrix offset 1468 1469 ! FREE EDITION OF ALGLIB: 1470 ! 1471 ! Free Edition of ALGLIB supports following important features for this 1472 ! function: 1473 ! * C++ version: x64 SIMD support using C++ intrinsics 1474 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1475 ! 1476 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1477 ! Reference Manual in order to find out how to activate SIMD support 1478 ! in ALGLIB. 1479 1480 ! COMMERCIAL EDITION OF ALGLIB: 1481 ! 1482 ! Commercial Edition of ALGLIB includes following important improvements 1483 ! of this function: 1484 ! * high-performance native backend with same C# interface (C# version) 1485 ! * multithreading support (C++ and C# versions) 1486 ! * hardware vendor (Intel) implementations of linear algebra primitives 1487 ! (C++ and C# versions, x86/x64 platform) 1488 ! 1489 ! We recommend you to read 'Working with commercial version' section of 1490 ! ALGLIB Reference Manual in order to find out how to use performance- 1491 ! related features provided by commercial edition of ALGLIB. 1492 1493 -- ALGLIB routine -- 1494 2009-2019 1495 Bochkanov Sergey 1496 *************************************************************************/ 1497 void rmatrixgemm(const ae_int_t m, const ae_int_t n, const ae_int_t k, const double alpha, const real_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t optypea, const real_2d_array &b, const ae_int_t ib, const ae_int_t jb, const ae_int_t optypeb, const double beta, const real_2d_array &c, const ae_int_t ic, const ae_int_t jc, const xparams _xparams = alglib::xdefault); 1498 1499 1500 /************************************************************************* 1501 This subroutine is an older version of CMatrixHERK(), one with wrong name 1502 (it is HErmitian update, not SYmmetric). It is left here for backward 1503 compatibility. 1504 1505 -- ALGLIB routine -- 1506 16.12.2009 1507 Bochkanov Sergey 1508 *************************************************************************/ 1509 void cmatrixsyrk(const ae_int_t n, const ae_int_t k, const double alpha, const complex_2d_array &a, const ae_int_t ia, const ae_int_t ja, const ae_int_t optypea, const double beta, const complex_2d_array &c, const ae_int_t ic, const ae_int_t jc, const bool isupper, const xparams _xparams = alglib::xdefault); 1510 #endif 1511 1512 #if defined(AE_COMPILE_ORTFAC) || !defined(AE_PARTIAL_BUILD) 1513 /************************************************************************* 1514 QR decomposition of a rectangular matrix of size MxN 1515 1516 Input parameters: 1517 A - matrix A whose indexes range within [0..M-1, 0..N-1]. 1518 M - number of rows in matrix A. 1519 N - number of columns in matrix A. 1520 1521 Output parameters: 1522 A - matrices Q and R in compact form (see below). 1523 Tau - array of scalar factors which are used to form 1524 matrix Q. Array whose index ranges within [0.. Min(M-1,N-1)]. 1525 1526 Matrix A is represented as A = QR, where Q is an orthogonal matrix of size 1527 MxM, R - upper triangular (or upper trapezoid) matrix of size M x N. 1528 1529 The elements of matrix R are located on and above the main diagonal of 1530 matrix A. The elements which are located in Tau array and below the main 1531 diagonal of matrix A are used to form matrix Q as follows: 1532 1533 Matrix Q is represented as a product of elementary reflections 1534 1535 Q = H(0)*H(2)*...*H(k-1), 1536 1537 where k = min(m,n), and each H(i) is in the form 1538 1539 H(i) = 1 - tau * v * (v^T) 1540 1541 where tau is a scalar stored in Tau[I]; v - real vector, 1542 so that v(0:i-1) = 0, v(i) = 1, v(i+1:m-1) stored in A(i+1:m-1,i). 1543 1544 ! FREE EDITION OF ALGLIB: 1545 ! 1546 ! Free Edition of ALGLIB supports following important features for this 1547 ! function: 1548 ! * C++ version: x64 SIMD support using C++ intrinsics 1549 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1550 ! 1551 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1552 ! Reference Manual in order to find out how to activate SIMD support 1553 ! in ALGLIB. 1554 1555 ! COMMERCIAL EDITION OF ALGLIB: 1556 ! 1557 ! Commercial Edition of ALGLIB includes following important improvements 1558 ! of this function: 1559 ! * high-performance native backend with same C# interface (C# version) 1560 ! * multithreading support (C++ and C# versions) 1561 ! * hardware vendor (Intel) implementations of linear algebra primitives 1562 ! (C++ and C# versions, x86/x64 platform) 1563 ! 1564 ! We recommend you to read 'Working with commercial version' section of 1565 ! ALGLIB Reference Manual in order to find out how to use performance- 1566 ! related features provided by commercial edition of ALGLIB. 1567 1568 -- ALGLIB routine -- 1569 17.02.2010 1570 Bochkanov Sergey 1571 *************************************************************************/ 1572 void rmatrixqr(real_2d_array &a, const ae_int_t m, const ae_int_t n, real_1d_array &tau, const xparams _xparams = alglib::xdefault); 1573 1574 1575 /************************************************************************* 1576 LQ decomposition of a rectangular matrix of size MxN 1577 1578 Input parameters: 1579 A - matrix A whose indexes range within [0..M-1, 0..N-1]. 1580 M - number of rows in matrix A. 1581 N - number of columns in matrix A. 1582 1583 Output parameters: 1584 A - matrices L and Q in compact form (see below) 1585 Tau - array of scalar factors which are used to form 1586 matrix Q. Array whose index ranges within [0..Min(M,N)-1]. 1587 1588 Matrix A is represented as A = LQ, where Q is an orthogonal matrix of size 1589 MxM, L - lower triangular (or lower trapezoid) matrix of size M x N. 1590 1591 The elements of matrix L are located on and below the main diagonal of 1592 matrix A. The elements which are located in Tau array and above the main 1593 diagonal of matrix A are used to form matrix Q as follows: 1594 1595 Matrix Q is represented as a product of elementary reflections 1596 1597 Q = H(k-1)*H(k-2)*...*H(1)*H(0), 1598 1599 where k = min(m,n), and each H(i) is of the form 1600 1601 H(i) = 1 - tau * v * (v^T) 1602 1603 where tau is a scalar stored in Tau[I]; v - real vector, so that v(0:i-1)=0, 1604 v(i) = 1, v(i+1:n-1) stored in A(i,i+1:n-1). 1605 1606 ! FREE EDITION OF ALGLIB: 1607 ! 1608 ! Free Edition of ALGLIB supports following important features for this 1609 ! function: 1610 ! * C++ version: x64 SIMD support using C++ intrinsics 1611 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1612 ! 1613 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1614 ! Reference Manual in order to find out how to activate SIMD support 1615 ! in ALGLIB. 1616 1617 ! COMMERCIAL EDITION OF ALGLIB: 1618 ! 1619 ! Commercial Edition of ALGLIB includes following important improvements 1620 ! of this function: 1621 ! * high-performance native backend with same C# interface (C# version) 1622 ! * multithreading support (C++ and C# versions) 1623 ! * hardware vendor (Intel) implementations of linear algebra primitives 1624 ! (C++ and C# versions, x86/x64 platform) 1625 ! 1626 ! We recommend you to read 'Working with commercial version' section of 1627 ! ALGLIB Reference Manual in order to find out how to use performance- 1628 ! related features provided by commercial edition of ALGLIB. 1629 1630 -- ALGLIB routine -- 1631 17.02.2010 1632 Bochkanov Sergey 1633 *************************************************************************/ 1634 void rmatrixlq(real_2d_array &a, const ae_int_t m, const ae_int_t n, real_1d_array &tau, const xparams _xparams = alglib::xdefault); 1635 1636 1637 /************************************************************************* 1638 QR decomposition of a rectangular complex matrix of size MxN 1639 1640 Input parameters: 1641 A - matrix A whose indexes range within [0..M-1, 0..N-1] 1642 M - number of rows in matrix A. 1643 N - number of columns in matrix A. 1644 1645 Output parameters: 1646 A - matrices Q and R in compact form 1647 Tau - array of scalar factors which are used to form matrix Q. Array 1648 whose indexes range within [0.. Min(M,N)-1] 1649 1650 Matrix A is represented as A = QR, where Q is an orthogonal matrix of size 1651 MxM, R - upper triangular (or upper trapezoid) matrix of size MxN. 1652 1653 ! FREE EDITION OF ALGLIB: 1654 ! 1655 ! Free Edition of ALGLIB supports following important features for this 1656 ! function: 1657 ! * C++ version: x64 SIMD support using C++ intrinsics 1658 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1659 ! 1660 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1661 ! Reference Manual in order to find out how to activate SIMD support 1662 ! in ALGLIB. 1663 1664 ! COMMERCIAL EDITION OF ALGLIB: 1665 ! 1666 ! Commercial Edition of ALGLIB includes following important improvements 1667 ! of this function: 1668 ! * high-performance native backend with same C# interface (C# version) 1669 ! * multithreading support (C++ and C# versions) 1670 ! * hardware vendor (Intel) implementations of linear algebra primitives 1671 ! (C++ and C# versions, x86/x64 platform) 1672 ! 1673 ! We recommend you to read 'Working with commercial version' section of 1674 ! ALGLIB Reference Manual in order to find out how to use performance- 1675 ! related features provided by commercial edition of ALGLIB. 1676 1677 -- LAPACK routine (version 3.0) -- 1678 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 1679 Courant Institute, Argonne National Lab, and Rice University 1680 September 30, 1994 1681 *************************************************************************/ 1682 void cmatrixqr(complex_2d_array &a, const ae_int_t m, const ae_int_t n, complex_1d_array &tau, const xparams _xparams = alglib::xdefault); 1683 1684 1685 /************************************************************************* 1686 LQ decomposition of a rectangular complex matrix of size MxN 1687 1688 Input parameters: 1689 A - matrix A whose indexes range within [0..M-1, 0..N-1] 1690 M - number of rows in matrix A. 1691 N - number of columns in matrix A. 1692 1693 Output parameters: 1694 A - matrices Q and L in compact form 1695 Tau - array of scalar factors which are used to form matrix Q. Array 1696 whose indexes range within [0.. Min(M,N)-1] 1697 1698 Matrix A is represented as A = LQ, where Q is an orthogonal matrix of size 1699 MxM, L - lower triangular (or lower trapezoid) matrix of size MxN. 1700 1701 ! FREE EDITION OF ALGLIB: 1702 ! 1703 ! Free Edition of ALGLIB supports following important features for this 1704 ! function: 1705 ! * C++ version: x64 SIMD support using C++ intrinsics 1706 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1707 ! 1708 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1709 ! Reference Manual in order to find out how to activate SIMD support 1710 ! in ALGLIB. 1711 1712 ! COMMERCIAL EDITION OF ALGLIB: 1713 ! 1714 ! Commercial Edition of ALGLIB includes following important improvements 1715 ! of this function: 1716 ! * high-performance native backend with same C# interface (C# version) 1717 ! * multithreading support (C++ and C# versions) 1718 ! * hardware vendor (Intel) implementations of linear algebra primitives 1719 ! (C++ and C# versions, x86/x64 platform) 1720 ! 1721 ! We recommend you to read 'Working with commercial version' section of 1722 ! ALGLIB Reference Manual in order to find out how to use performance- 1723 ! related features provided by commercial edition of ALGLIB. 1724 1725 -- LAPACK routine (version 3.0) -- 1726 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 1727 Courant Institute, Argonne National Lab, and Rice University 1728 September 30, 1994 1729 *************************************************************************/ 1730 void cmatrixlq(complex_2d_array &a, const ae_int_t m, const ae_int_t n, complex_1d_array &tau, const xparams _xparams = alglib::xdefault); 1731 1732 1733 /************************************************************************* 1734 Partial unpacking of matrix Q from the QR decomposition of a matrix A 1735 1736 Input parameters: 1737 A - matrices Q and R in compact form. 1738 Output of RMatrixQR subroutine. 1739 M - number of rows in given matrix A. M>=0. 1740 N - number of columns in given matrix A. N>=0. 1741 Tau - scalar factors which are used to form Q. 1742 Output of the RMatrixQR subroutine. 1743 QColumns - required number of columns of matrix Q. M>=QColumns>=0. 1744 1745 Output parameters: 1746 Q - first QColumns columns of matrix Q. 1747 Array whose indexes range within [0..M-1, 0..QColumns-1]. 1748 If QColumns=0, the array remains unchanged. 1749 1750 ! FREE EDITION OF ALGLIB: 1751 ! 1752 ! Free Edition of ALGLIB supports following important features for this 1753 ! function: 1754 ! * C++ version: x64 SIMD support using C++ intrinsics 1755 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1756 ! 1757 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1758 ! Reference Manual in order to find out how to activate SIMD support 1759 ! in ALGLIB. 1760 1761 ! COMMERCIAL EDITION OF ALGLIB: 1762 ! 1763 ! Commercial Edition of ALGLIB includes following important improvements 1764 ! of this function: 1765 ! * high-performance native backend with same C# interface (C# version) 1766 ! * multithreading support (C++ and C# versions) 1767 ! * hardware vendor (Intel) implementations of linear algebra primitives 1768 ! (C++ and C# versions, x86/x64 platform) 1769 ! 1770 ! We recommend you to read 'Working with commercial version' section of 1771 ! ALGLIB Reference Manual in order to find out how to use performance- 1772 ! related features provided by commercial edition of ALGLIB. 1773 1774 -- ALGLIB routine -- 1775 17.02.2010 1776 Bochkanov Sergey 1777 *************************************************************************/ 1778 void rmatrixqrunpackq(const real_2d_array &a, const ae_int_t m, const ae_int_t n, const real_1d_array &tau, const ae_int_t qcolumns, real_2d_array &q, const xparams _xparams = alglib::xdefault); 1779 1780 1781 /************************************************************************* 1782 Unpacking of matrix R from the QR decomposition of a matrix A 1783 1784 Input parameters: 1785 A - matrices Q and R in compact form. 1786 Output of RMatrixQR subroutine. 1787 M - number of rows in given matrix A. M>=0. 1788 N - number of columns in given matrix A. N>=0. 1789 1790 Output parameters: 1791 R - matrix R, array[0..M-1, 0..N-1]. 1792 1793 -- ALGLIB routine -- 1794 17.02.2010 1795 Bochkanov Sergey 1796 *************************************************************************/ 1797 void rmatrixqrunpackr(const real_2d_array &a, const ae_int_t m, const ae_int_t n, real_2d_array &r, const xparams _xparams = alglib::xdefault); 1798 1799 1800 /************************************************************************* 1801 Partial unpacking of matrix Q from the LQ decomposition of a matrix A 1802 1803 Input parameters: 1804 A - matrices L and Q in compact form. 1805 Output of RMatrixLQ subroutine. 1806 M - number of rows in given matrix A. M>=0. 1807 N - number of columns in given matrix A. N>=0. 1808 Tau - scalar factors which are used to form Q. 1809 Output of the RMatrixLQ subroutine. 1810 QRows - required number of rows in matrix Q. N>=QRows>=0. 1811 1812 Output parameters: 1813 Q - first QRows rows of matrix Q. Array whose indexes range 1814 within [0..QRows-1, 0..N-1]. If QRows=0, the array remains 1815 unchanged. 1816 1817 ! FREE EDITION OF ALGLIB: 1818 ! 1819 ! Free Edition of ALGLIB supports following important features for this 1820 ! function: 1821 ! * C++ version: x64 SIMD support using C++ intrinsics 1822 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1823 ! 1824 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1825 ! Reference Manual in order to find out how to activate SIMD support 1826 ! in ALGLIB. 1827 1828 ! COMMERCIAL EDITION OF ALGLIB: 1829 ! 1830 ! Commercial Edition of ALGLIB includes following important improvements 1831 ! of this function: 1832 ! * high-performance native backend with same C# interface (C# version) 1833 ! * multithreading support (C++ and C# versions) 1834 ! * hardware vendor (Intel) implementations of linear algebra primitives 1835 ! (C++ and C# versions, x86/x64 platform) 1836 ! 1837 ! We recommend you to read 'Working with commercial version' section of 1838 ! ALGLIB Reference Manual in order to find out how to use performance- 1839 ! related features provided by commercial edition of ALGLIB. 1840 1841 -- ALGLIB routine -- 1842 17.02.2010 1843 Bochkanov Sergey 1844 *************************************************************************/ 1845 void rmatrixlqunpackq(const real_2d_array &a, const ae_int_t m, const ae_int_t n, const real_1d_array &tau, const ae_int_t qrows, real_2d_array &q, const xparams _xparams = alglib::xdefault); 1846 1847 1848 /************************************************************************* 1849 Unpacking of matrix L from the LQ decomposition of a matrix A 1850 1851 Input parameters: 1852 A - matrices Q and L in compact form. 1853 Output of RMatrixLQ subroutine. 1854 M - number of rows in given matrix A. M>=0. 1855 N - number of columns in given matrix A. N>=0. 1856 1857 Output parameters: 1858 L - matrix L, array[0..M-1, 0..N-1]. 1859 1860 -- ALGLIB routine -- 1861 17.02.2010 1862 Bochkanov Sergey 1863 *************************************************************************/ 1864 void rmatrixlqunpackl(const real_2d_array &a, const ae_int_t m, const ae_int_t n, real_2d_array &l, const xparams _xparams = alglib::xdefault); 1865 1866 1867 /************************************************************************* 1868 Partial unpacking of matrix Q from QR decomposition of a complex matrix A. 1869 1870 Input parameters: 1871 A - matrices Q and R in compact form. 1872 Output of CMatrixQR subroutine . 1873 M - number of rows in matrix A. M>=0. 1874 N - number of columns in matrix A. N>=0. 1875 Tau - scalar factors which are used to form Q. 1876 Output of CMatrixQR subroutine . 1877 QColumns - required number of columns in matrix Q. M>=QColumns>=0. 1878 1879 Output parameters: 1880 Q - first QColumns columns of matrix Q. 1881 Array whose index ranges within [0..M-1, 0..QColumns-1]. 1882 If QColumns=0, array isn't changed. 1883 1884 ! FREE EDITION OF ALGLIB: 1885 ! 1886 ! Free Edition of ALGLIB supports following important features for this 1887 ! function: 1888 ! * C++ version: x64 SIMD support using C++ intrinsics 1889 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1890 ! 1891 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1892 ! Reference Manual in order to find out how to activate SIMD support 1893 ! in ALGLIB. 1894 1895 ! COMMERCIAL EDITION OF ALGLIB: 1896 ! 1897 ! Commercial Edition of ALGLIB includes following important improvements 1898 ! of this function: 1899 ! * high-performance native backend with same C# interface (C# version) 1900 ! * multithreading support (C++ and C# versions) 1901 ! * hardware vendor (Intel) implementations of linear algebra primitives 1902 ! (C++ and C# versions, x86/x64 platform) 1903 ! 1904 ! We recommend you to read 'Working with commercial version' section of 1905 ! ALGLIB Reference Manual in order to find out how to use performance- 1906 ! related features provided by commercial edition of ALGLIB. 1907 1908 -- ALGLIB routine -- 1909 17.02.2010 1910 Bochkanov Sergey 1911 *************************************************************************/ 1912 void cmatrixqrunpackq(const complex_2d_array &a, const ae_int_t m, const ae_int_t n, const complex_1d_array &tau, const ae_int_t qcolumns, complex_2d_array &q, const xparams _xparams = alglib::xdefault); 1913 1914 1915 /************************************************************************* 1916 Unpacking of matrix R from the QR decomposition of a matrix A 1917 1918 Input parameters: 1919 A - matrices Q and R in compact form. 1920 Output of CMatrixQR subroutine. 1921 M - number of rows in given matrix A. M>=0. 1922 N - number of columns in given matrix A. N>=0. 1923 1924 Output parameters: 1925 R - matrix R, array[0..M-1, 0..N-1]. 1926 1927 -- ALGLIB routine -- 1928 17.02.2010 1929 Bochkanov Sergey 1930 *************************************************************************/ 1931 void cmatrixqrunpackr(const complex_2d_array &a, const ae_int_t m, const ae_int_t n, complex_2d_array &r, const xparams _xparams = alglib::xdefault); 1932 1933 1934 /************************************************************************* 1935 Partial unpacking of matrix Q from LQ decomposition of a complex matrix A. 1936 1937 Input parameters: 1938 A - matrices Q and R in compact form. 1939 Output of CMatrixLQ subroutine . 1940 M - number of rows in matrix A. M>=0. 1941 N - number of columns in matrix A. N>=0. 1942 Tau - scalar factors which are used to form Q. 1943 Output of CMatrixLQ subroutine . 1944 QRows - required number of rows in matrix Q. N>=QColumns>=0. 1945 1946 Output parameters: 1947 Q - first QRows rows of matrix Q. 1948 Array whose index ranges within [0..QRows-1, 0..N-1]. 1949 If QRows=0, array isn't changed. 1950 1951 ! FREE EDITION OF ALGLIB: 1952 ! 1953 ! Free Edition of ALGLIB supports following important features for this 1954 ! function: 1955 ! * C++ version: x64 SIMD support using C++ intrinsics 1956 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 1957 ! 1958 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 1959 ! Reference Manual in order to find out how to activate SIMD support 1960 ! in ALGLIB. 1961 1962 ! COMMERCIAL EDITION OF ALGLIB: 1963 ! 1964 ! Commercial Edition of ALGLIB includes following important improvements 1965 ! of this function: 1966 ! * high-performance native backend with same C# interface (C# version) 1967 ! * multithreading support (C++ and C# versions) 1968 ! * hardware vendor (Intel) implementations of linear algebra primitives 1969 ! (C++ and C# versions, x86/x64 platform) 1970 ! 1971 ! We recommend you to read 'Working with commercial version' section of 1972 ! ALGLIB Reference Manual in order to find out how to use performance- 1973 ! related features provided by commercial edition of ALGLIB. 1974 1975 -- ALGLIB routine -- 1976 17.02.2010 1977 Bochkanov Sergey 1978 *************************************************************************/ 1979 void cmatrixlqunpackq(const complex_2d_array &a, const ae_int_t m, const ae_int_t n, const complex_1d_array &tau, const ae_int_t qrows, complex_2d_array &q, const xparams _xparams = alglib::xdefault); 1980 1981 1982 /************************************************************************* 1983 Unpacking of matrix L from the LQ decomposition of a matrix A 1984 1985 Input parameters: 1986 A - matrices Q and L in compact form. 1987 Output of CMatrixLQ subroutine. 1988 M - number of rows in given matrix A. M>=0. 1989 N - number of columns in given matrix A. N>=0. 1990 1991 Output parameters: 1992 L - matrix L, array[0..M-1, 0..N-1]. 1993 1994 -- ALGLIB routine -- 1995 17.02.2010 1996 Bochkanov Sergey 1997 *************************************************************************/ 1998 void cmatrixlqunpackl(const complex_2d_array &a, const ae_int_t m, const ae_int_t n, complex_2d_array &l, const xparams _xparams = alglib::xdefault); 1999 2000 2001 /************************************************************************* 2002 Reduction of a rectangular matrix to bidiagonal form 2003 2004 The algorithm reduces the rectangular matrix A to bidiagonal form by 2005 orthogonal transformations P and Q: A = Q*B*(P^T). 2006 2007 ! COMMERCIAL EDITION OF ALGLIB: 2008 ! 2009 ! Commercial Edition of ALGLIB includes following important improvements 2010 ! of this function: 2011 ! * high-performance native backend with same C# interface (C# version) 2012 ! * hardware vendor (Intel) implementations of linear algebra primitives 2013 ! (C++ and C# versions, x86/x64 platform) 2014 ! 2015 ! We recommend you to read 'Working with commercial version' section of 2016 ! ALGLIB Reference Manual in order to find out how to use performance- 2017 ! related features provided by commercial edition of ALGLIB. 2018 2019 Input parameters: 2020 A - source matrix. array[0..M-1, 0..N-1] 2021 M - number of rows in matrix A. 2022 N - number of columns in matrix A. 2023 2024 Output parameters: 2025 A - matrices Q, B, P in compact form (see below). 2026 TauQ - scalar factors which are used to form matrix Q. 2027 TauP - scalar factors which are used to form matrix P. 2028 2029 The main diagonal and one of the secondary diagonals of matrix A are 2030 replaced with bidiagonal matrix B. Other elements contain elementary 2031 reflections which form MxM matrix Q and NxN matrix P, respectively. 2032 2033 If M>=N, B is the upper bidiagonal MxN matrix and is stored in the 2034 corresponding elements of matrix A. Matrix Q is represented as a 2035 product of elementary reflections Q = H(0)*H(1)*...*H(n-1), where 2036 H(i) = 1-tau*v*v'. Here tau is a scalar which is stored in TauQ[i], and 2037 vector v has the following structure: v(0:i-1)=0, v(i)=1, v(i+1:m-1) is 2038 stored in elements A(i+1:m-1,i). Matrix P is as follows: P = 2039 G(0)*G(1)*...*G(n-2), where G(i) = 1 - tau*u*u'. Tau is stored in TauP[i], 2040 u(0:i)=0, u(i+1)=1, u(i+2:n-1) is stored in elements A(i,i+2:n-1). 2041 2042 If M<N, B is the lower bidiagonal MxN matrix and is stored in the 2043 corresponding elements of matrix A. Q = H(0)*H(1)*...*H(m-2), where 2044 H(i) = 1 - tau*v*v', tau is stored in TauQ, v(0:i)=0, v(i+1)=1, v(i+2:m-1) 2045 is stored in elements A(i+2:m-1,i). P = G(0)*G(1)*...*G(m-1), 2046 G(i) = 1-tau*u*u', tau is stored in TauP, u(0:i-1)=0, u(i)=1, u(i+1:n-1) 2047 is stored in A(i,i+1:n-1). 2048 2049 EXAMPLE: 2050 2051 m=6, n=5 (m > n): m=5, n=6 (m < n): 2052 2053 ( d e u1 u1 u1 ) ( d u1 u1 u1 u1 u1 ) 2054 ( v1 d e u2 u2 ) ( e d u2 u2 u2 u2 ) 2055 ( v1 v2 d e u3 ) ( v1 e d u3 u3 u3 ) 2056 ( v1 v2 v3 d e ) ( v1 v2 e d u4 u4 ) 2057 ( v1 v2 v3 v4 d ) ( v1 v2 v3 e d u5 ) 2058 ( v1 v2 v3 v4 v5 ) 2059 2060 Here vi and ui are vectors which form H(i) and G(i), and d and e - 2061 are the diagonal and off-diagonal elements of matrix B. 2062 2063 -- LAPACK routine (version 3.0) -- 2064 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 2065 Courant Institute, Argonne National Lab, and Rice University 2066 September 30, 1994. 2067 Sergey Bochkanov, ALGLIB project, translation from FORTRAN to 2068 pseudocode, 2007-2010. 2069 *************************************************************************/ 2070 void rmatrixbd(real_2d_array &a, const ae_int_t m, const ae_int_t n, real_1d_array &tauq, real_1d_array &taup, const xparams _xparams = alglib::xdefault); 2071 2072 2073 /************************************************************************* 2074 Unpacking matrix Q which reduces a matrix to bidiagonal form. 2075 2076 ! COMMERCIAL EDITION OF ALGLIB: 2077 ! 2078 ! Commercial Edition of ALGLIB includes following important improvements 2079 ! of this function: 2080 ! * high-performance native backend with same C# interface (C# version) 2081 ! * hardware vendor (Intel) implementations of linear algebra primitives 2082 ! (C++ and C# versions, x86/x64 platform) 2083 ! 2084 ! We recommend you to read 'Working with commercial version' section of 2085 ! ALGLIB Reference Manual in order to find out how to use performance- 2086 ! related features provided by commercial edition of ALGLIB. 2087 2088 Input parameters: 2089 QP - matrices Q and P in compact form. 2090 Output of ToBidiagonal subroutine. 2091 M - number of rows in matrix A. 2092 N - number of columns in matrix A. 2093 TAUQ - scalar factors which are used to form Q. 2094 Output of ToBidiagonal subroutine. 2095 QColumns - required number of columns in matrix Q. 2096 M>=QColumns>=0. 2097 2098 Output parameters: 2099 Q - first QColumns columns of matrix Q. 2100 Array[0..M-1, 0..QColumns-1] 2101 If QColumns=0, the array is not modified. 2102 2103 -- ALGLIB -- 2104 2005-2010 2105 Bochkanov Sergey 2106 *************************************************************************/ 2107 void rmatrixbdunpackq(const real_2d_array &qp, const ae_int_t m, const ae_int_t n, const real_1d_array &tauq, const ae_int_t qcolumns, real_2d_array &q, const xparams _xparams = alglib::xdefault); 2108 2109 2110 /************************************************************************* 2111 Multiplication by matrix Q which reduces matrix A to bidiagonal form. 2112 2113 The algorithm allows pre- or post-multiply by Q or Q'. 2114 2115 ! COMMERCIAL EDITION OF ALGLIB: 2116 ! 2117 ! Commercial Edition of ALGLIB includes following important improvements 2118 ! of this function: 2119 ! * high-performance native backend with same C# interface (C# version) 2120 ! * hardware vendor (Intel) implementations of linear algebra primitives 2121 ! (C++ and C# versions, x86/x64 platform) 2122 ! 2123 ! We recommend you to read 'Working with commercial version' section of 2124 ! ALGLIB Reference Manual in order to find out how to use performance- 2125 ! related features provided by commercial edition of ALGLIB. 2126 2127 Input parameters: 2128 QP - matrices Q and P in compact form. 2129 Output of ToBidiagonal subroutine. 2130 M - number of rows in matrix A. 2131 N - number of columns in matrix A. 2132 TAUQ - scalar factors which are used to form Q. 2133 Output of ToBidiagonal subroutine. 2134 Z - multiplied matrix. 2135 array[0..ZRows-1,0..ZColumns-1] 2136 ZRows - number of rows in matrix Z. If FromTheRight=False, 2137 ZRows=M, otherwise ZRows can be arbitrary. 2138 ZColumns - number of columns in matrix Z. If FromTheRight=True, 2139 ZColumns=M, otherwise ZColumns can be arbitrary. 2140 FromTheRight - pre- or post-multiply. 2141 DoTranspose - multiply by Q or Q'. 2142 2143 Output parameters: 2144 Z - product of Z and Q. 2145 Array[0..ZRows-1,0..ZColumns-1] 2146 If ZRows=0 or ZColumns=0, the array is not modified. 2147 2148 -- ALGLIB -- 2149 2005-2010 2150 Bochkanov Sergey 2151 *************************************************************************/ 2152 void rmatrixbdmultiplybyq(const real_2d_array &qp, const ae_int_t m, const ae_int_t n, const real_1d_array &tauq, real_2d_array &z, const ae_int_t zrows, const ae_int_t zcolumns, const bool fromtheright, const bool dotranspose, const xparams _xparams = alglib::xdefault); 2153 2154 2155 /************************************************************************* 2156 Unpacking matrix P which reduces matrix A to bidiagonal form. 2157 The subroutine returns transposed matrix P. 2158 2159 Input parameters: 2160 QP - matrices Q and P in compact form. 2161 Output of ToBidiagonal subroutine. 2162 M - number of rows in matrix A. 2163 N - number of columns in matrix A. 2164 TAUP - scalar factors which are used to form P. 2165 Output of ToBidiagonal subroutine. 2166 PTRows - required number of rows of matrix P^T. N >= PTRows >= 0. 2167 2168 Output parameters: 2169 PT - first PTRows columns of matrix P^T 2170 Array[0..PTRows-1, 0..N-1] 2171 If PTRows=0, the array is not modified. 2172 2173 -- ALGLIB -- 2174 2005-2010 2175 Bochkanov Sergey 2176 *************************************************************************/ 2177 void rmatrixbdunpackpt(const real_2d_array &qp, const ae_int_t m, const ae_int_t n, const real_1d_array &taup, const ae_int_t ptrows, real_2d_array &pt, const xparams _xparams = alglib::xdefault); 2178 2179 2180 /************************************************************************* 2181 Multiplication by matrix P which reduces matrix A to bidiagonal form. 2182 2183 The algorithm allows pre- or post-multiply by P or P'. 2184 2185 Input parameters: 2186 QP - matrices Q and P in compact form. 2187 Output of RMatrixBD subroutine. 2188 M - number of rows in matrix A. 2189 N - number of columns in matrix A. 2190 TAUP - scalar factors which are used to form P. 2191 Output of RMatrixBD subroutine. 2192 Z - multiplied matrix. 2193 Array whose indexes range within [0..ZRows-1,0..ZColumns-1]. 2194 ZRows - number of rows in matrix Z. If FromTheRight=False, 2195 ZRows=N, otherwise ZRows can be arbitrary. 2196 ZColumns - number of columns in matrix Z. If FromTheRight=True, 2197 ZColumns=N, otherwise ZColumns can be arbitrary. 2198 FromTheRight - pre- or post-multiply. 2199 DoTranspose - multiply by P or P'. 2200 2201 Output parameters: 2202 Z - product of Z and P. 2203 Array whose indexes range within [0..ZRows-1,0..ZColumns-1]. 2204 If ZRows=0 or ZColumns=0, the array is not modified. 2205 2206 -- ALGLIB -- 2207 2005-2010 2208 Bochkanov Sergey 2209 *************************************************************************/ 2210 void rmatrixbdmultiplybyp(const real_2d_array &qp, const ae_int_t m, const ae_int_t n, const real_1d_array &taup, real_2d_array &z, const ae_int_t zrows, const ae_int_t zcolumns, const bool fromtheright, const bool dotranspose, const xparams _xparams = alglib::xdefault); 2211 2212 2213 /************************************************************************* 2214 Unpacking of the main and secondary diagonals of bidiagonal decomposition 2215 of matrix A. 2216 2217 Input parameters: 2218 B - output of RMatrixBD subroutine. 2219 M - number of rows in matrix B. 2220 N - number of columns in matrix B. 2221 2222 Output parameters: 2223 IsUpper - True, if the matrix is upper bidiagonal. 2224 otherwise IsUpper is False. 2225 D - the main diagonal. 2226 Array whose index ranges within [0..Min(M,N)-1]. 2227 E - the secondary diagonal (upper or lower, depending on 2228 the value of IsUpper). 2229 Array index ranges within [0..Min(M,N)-1], the last 2230 element is not used. 2231 2232 -- ALGLIB -- 2233 2005-2010 2234 Bochkanov Sergey 2235 *************************************************************************/ 2236 void rmatrixbdunpackdiagonals(const real_2d_array &b, const ae_int_t m, const ae_int_t n, bool &isupper, real_1d_array &d, real_1d_array &e, const xparams _xparams = alglib::xdefault); 2237 2238 2239 /************************************************************************* 2240 Reduction of a square matrix to upper Hessenberg form: Q'*A*Q = H, 2241 where Q is an orthogonal matrix, H - Hessenberg matrix. 2242 2243 ! COMMERCIAL EDITION OF ALGLIB: 2244 ! 2245 ! Commercial Edition of ALGLIB includes following important improvements 2246 ! of this function: 2247 ! * high-performance native backend with same C# interface (C# version) 2248 ! * hardware vendor (Intel) implementations of linear algebra primitives 2249 ! (C++ and C# versions, x86/x64 platform) 2250 ! 2251 ! We recommend you to read 'Working with commercial version' section of 2252 ! ALGLIB Reference Manual in order to find out how to use performance- 2253 ! related features provided by commercial edition of ALGLIB. 2254 2255 Input parameters: 2256 A - matrix A with elements [0..N-1, 0..N-1] 2257 N - size of matrix A. 2258 2259 Output parameters: 2260 A - matrices Q and P in compact form (see below). 2261 Tau - array of scalar factors which are used to form matrix Q. 2262 Array whose index ranges within [0..N-2] 2263 2264 Matrix H is located on the main diagonal, on the lower secondary diagonal 2265 and above the main diagonal of matrix A. The elements which are used to 2266 form matrix Q are situated in array Tau and below the lower secondary 2267 diagonal of matrix A as follows: 2268 2269 Matrix Q is represented as a product of elementary reflections 2270 2271 Q = H(0)*H(2)*...*H(n-2), 2272 2273 where each H(i) is given by 2274 2275 H(i) = 1 - tau * v * (v^T) 2276 2277 where tau is a scalar stored in Tau[I]; v - is a real vector, 2278 so that v(0:i) = 0, v(i+1) = 1, v(i+2:n-1) stored in A(i+2:n-1,i). 2279 2280 -- LAPACK routine (version 3.0) -- 2281 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 2282 Courant Institute, Argonne National Lab, and Rice University 2283 October 31, 1992 2284 *************************************************************************/ 2285 void rmatrixhessenberg(real_2d_array &a, const ae_int_t n, real_1d_array &tau, const xparams _xparams = alglib::xdefault); 2286 2287 2288 /************************************************************************* 2289 Unpacking matrix Q which reduces matrix A to upper Hessenberg form 2290 2291 ! COMMERCIAL EDITION OF ALGLIB: 2292 ! 2293 ! Commercial Edition of ALGLIB includes following important improvements 2294 ! of this function: 2295 ! * high-performance native backend with same C# interface (C# version) 2296 ! * hardware vendor (Intel) implementations of linear algebra primitives 2297 ! (C++ and C# versions, x86/x64 platform) 2298 ! 2299 ! We recommend you to read 'Working with commercial version' section of 2300 ! ALGLIB Reference Manual in order to find out how to use performance- 2301 ! related features provided by commercial edition of ALGLIB. 2302 2303 Input parameters: 2304 A - output of RMatrixHessenberg subroutine. 2305 N - size of matrix A. 2306 Tau - scalar factors which are used to form Q. 2307 Output of RMatrixHessenberg subroutine. 2308 2309 Output parameters: 2310 Q - matrix Q. 2311 Array whose indexes range within [0..N-1, 0..N-1]. 2312 2313 -- ALGLIB -- 2314 2005-2010 2315 Bochkanov Sergey 2316 *************************************************************************/ 2317 void rmatrixhessenbergunpackq(const real_2d_array &a, const ae_int_t n, const real_1d_array &tau, real_2d_array &q, const xparams _xparams = alglib::xdefault); 2318 2319 2320 /************************************************************************* 2321 Unpacking matrix H (the result of matrix A reduction to upper Hessenberg form) 2322 2323 Input parameters: 2324 A - output of RMatrixHessenberg subroutine. 2325 N - size of matrix A. 2326 2327 Output parameters: 2328 H - matrix H. Array whose indexes range within [0..N-1, 0..N-1]. 2329 2330 -- ALGLIB -- 2331 2005-2010 2332 Bochkanov Sergey 2333 *************************************************************************/ 2334 void rmatrixhessenbergunpackh(const real_2d_array &a, const ae_int_t n, real_2d_array &h, const xparams _xparams = alglib::xdefault); 2335 2336 2337 /************************************************************************* 2338 Reduction of a symmetric matrix which is given by its higher or lower 2339 triangular part to a tridiagonal matrix using orthogonal similarity 2340 transformation: Q'*A*Q=T. 2341 2342 ! COMMERCIAL EDITION OF ALGLIB: 2343 ! 2344 ! Commercial Edition of ALGLIB includes following important improvements 2345 ! of this function: 2346 ! * high-performance native backend with same C# interface (C# version) 2347 ! * hardware vendor (Intel) implementations of linear algebra primitives 2348 ! (C++ and C# versions, x86/x64 platform) 2349 ! 2350 ! We recommend you to read 'Working with commercial version' section of 2351 ! ALGLIB Reference Manual in order to find out how to use performance- 2352 ! related features provided by commercial edition of ALGLIB. 2353 2354 Input parameters: 2355 A - matrix to be transformed 2356 array with elements [0..N-1, 0..N-1]. 2357 N - size of matrix A. 2358 IsUpper - storage format. If IsUpper = True, then matrix A is given 2359 by its upper triangle, and the lower triangle is not used 2360 and not modified by the algorithm, and vice versa 2361 if IsUpper = False. 2362 2363 Output parameters: 2364 A - matrices T and Q in compact form (see lower) 2365 Tau - array of factors which are forming matrices H(i) 2366 array with elements [0..N-2]. 2367 D - main diagonal of symmetric matrix T. 2368 array with elements [0..N-1]. 2369 E - secondary diagonal of symmetric matrix T. 2370 array with elements [0..N-2]. 2371 2372 2373 If IsUpper=True, the matrix Q is represented as a product of elementary 2374 reflectors 2375 2376 Q = H(n-2) . . . H(2) H(0). 2377 2378 Each H(i) has the form 2379 2380 H(i) = I - tau * v * v' 2381 2382 where tau is a real scalar, and v is a real vector with 2383 v(i+1:n-1) = 0, v(i) = 1, v(0:i-1) is stored on exit in 2384 A(0:i-1,i+1), and tau in TAU(i). 2385 2386 If IsUpper=False, the matrix Q is represented as a product of elementary 2387 reflectors 2388 2389 Q = H(0) H(2) . . . H(n-2). 2390 2391 Each H(i) has the form 2392 2393 H(i) = I - tau * v * v' 2394 2395 where tau is a real scalar, and v is a real vector with 2396 v(0:i) = 0, v(i+1) = 1, v(i+2:n-1) is stored on exit in A(i+2:n-1,i), 2397 and tau in TAU(i). 2398 2399 The contents of A on exit are illustrated by the following examples 2400 with n = 5: 2401 2402 if UPLO = 'U': if UPLO = 'L': 2403 2404 ( d e v1 v2 v3 ) ( d ) 2405 ( d e v2 v3 ) ( e d ) 2406 ( d e v3 ) ( v0 e d ) 2407 ( d e ) ( v0 v1 e d ) 2408 ( d ) ( v0 v1 v2 e d ) 2409 2410 where d and e denote diagonal and off-diagonal elements of T, and vi 2411 denotes an element of the vector defining H(i). 2412 2413 -- LAPACK routine (version 3.0) -- 2414 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 2415 Courant Institute, Argonne National Lab, and Rice University 2416 October 31, 1992 2417 *************************************************************************/ 2418 void smatrixtd(real_2d_array &a, const ae_int_t n, const bool isupper, real_1d_array &tau, real_1d_array &d, real_1d_array &e, const xparams _xparams = alglib::xdefault); 2419 2420 2421 /************************************************************************* 2422 Unpacking matrix Q which reduces symmetric matrix to a tridiagonal 2423 form. 2424 2425 ! COMMERCIAL EDITION OF ALGLIB: 2426 ! 2427 ! Commercial Edition of ALGLIB includes following important improvements 2428 ! of this function: 2429 ! * high-performance native backend with same C# interface (C# version) 2430 ! * hardware vendor (Intel) implementations of linear algebra primitives 2431 ! (C++ and C# versions, x86/x64 platform) 2432 ! 2433 ! We recommend you to read 'Working with commercial version' section of 2434 ! ALGLIB Reference Manual in order to find out how to use performance- 2435 ! related features provided by commercial edition of ALGLIB. 2436 2437 Input parameters: 2438 A - the result of a SMatrixTD subroutine 2439 N - size of matrix A. 2440 IsUpper - storage format (a parameter of SMatrixTD subroutine) 2441 Tau - the result of a SMatrixTD subroutine 2442 2443 Output parameters: 2444 Q - transformation matrix. 2445 array with elements [0..N-1, 0..N-1]. 2446 2447 -- ALGLIB -- 2448 Copyright 2005-2010 by Bochkanov Sergey 2449 *************************************************************************/ 2450 void smatrixtdunpackq(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &tau, real_2d_array &q, const xparams _xparams = alglib::xdefault); 2451 2452 2453 /************************************************************************* 2454 Reduction of a Hermitian matrix which is given by its higher or lower 2455 triangular part to a real tridiagonal matrix using unitary similarity 2456 transformation: Q'*A*Q = T. 2457 2458 ! COMMERCIAL EDITION OF ALGLIB: 2459 ! 2460 ! Commercial Edition of ALGLIB includes following important improvements 2461 ! of this function: 2462 ! * high-performance native backend with same C# interface (C# version) 2463 ! * hardware vendor (Intel) implementations of linear algebra primitives 2464 ! (C++ and C# versions, x86/x64 platform) 2465 ! 2466 ! We recommend you to read 'Working with commercial version' section of 2467 ! ALGLIB Reference Manual in order to find out how to use performance- 2468 ! related features provided by commercial edition of ALGLIB. 2469 2470 Input parameters: 2471 A - matrix to be transformed 2472 array with elements [0..N-1, 0..N-1]. 2473 N - size of matrix A. 2474 IsUpper - storage format. If IsUpper = True, then matrix A is given 2475 by its upper triangle, and the lower triangle is not used 2476 and not modified by the algorithm, and vice versa 2477 if IsUpper = False. 2478 2479 Output parameters: 2480 A - matrices T and Q in compact form (see lower) 2481 Tau - array of factors which are forming matrices H(i) 2482 array with elements [0..N-2]. 2483 D - main diagonal of real symmetric matrix T. 2484 array with elements [0..N-1]. 2485 E - secondary diagonal of real symmetric matrix T. 2486 array with elements [0..N-2]. 2487 2488 2489 If IsUpper=True, the matrix Q is represented as a product of elementary 2490 reflectors 2491 2492 Q = H(n-2) . . . H(2) H(0). 2493 2494 Each H(i) has the form 2495 2496 H(i) = I - tau * v * v' 2497 2498 where tau is a complex scalar, and v is a complex vector with 2499 v(i+1:n-1) = 0, v(i) = 1, v(0:i-1) is stored on exit in 2500 A(0:i-1,i+1), and tau in TAU(i). 2501 2502 If IsUpper=False, the matrix Q is represented as a product of elementary 2503 reflectors 2504 2505 Q = H(0) H(2) . . . H(n-2). 2506 2507 Each H(i) has the form 2508 2509 H(i) = I - tau * v * v' 2510 2511 where tau is a complex scalar, and v is a complex vector with 2512 v(0:i) = 0, v(i+1) = 1, v(i+2:n-1) is stored on exit in A(i+2:n-1,i), 2513 and tau in TAU(i). 2514 2515 The contents of A on exit are illustrated by the following examples 2516 with n = 5: 2517 2518 if UPLO = 'U': if UPLO = 'L': 2519 2520 ( d e v1 v2 v3 ) ( d ) 2521 ( d e v2 v3 ) ( e d ) 2522 ( d e v3 ) ( v0 e d ) 2523 ( d e ) ( v0 v1 e d ) 2524 ( d ) ( v0 v1 v2 e d ) 2525 2526 where d and e denote diagonal and off-diagonal elements of T, and vi 2527 denotes an element of the vector defining H(i). 2528 2529 -- LAPACK routine (version 3.0) -- 2530 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 2531 Courant Institute, Argonne National Lab, and Rice University 2532 October 31, 1992 2533 *************************************************************************/ 2534 void hmatrixtd(complex_2d_array &a, const ae_int_t n, const bool isupper, complex_1d_array &tau, real_1d_array &d, real_1d_array &e, const xparams _xparams = alglib::xdefault); 2535 2536 2537 /************************************************************************* 2538 Unpacking matrix Q which reduces a Hermitian matrix to a real tridiagonal 2539 form. 2540 2541 ! COMMERCIAL EDITION OF ALGLIB: 2542 ! 2543 ! Commercial Edition of ALGLIB includes following important improvements 2544 ! of this function: 2545 ! * high-performance native backend with same C# interface (C# version) 2546 ! * hardware vendor (Intel) implementations of linear algebra primitives 2547 ! (C++ and C# versions, x86/x64 platform) 2548 ! 2549 ! We recommend you to read 'Working with commercial version' section of 2550 ! ALGLIB Reference Manual in order to find out how to use performance- 2551 ! related features provided by commercial edition of ALGLIB. 2552 2553 Input parameters: 2554 A - the result of a HMatrixTD subroutine 2555 N - size of matrix A. 2556 IsUpper - storage format (a parameter of HMatrixTD subroutine) 2557 Tau - the result of a HMatrixTD subroutine 2558 2559 Output parameters: 2560 Q - transformation matrix. 2561 array with elements [0..N-1, 0..N-1]. 2562 2563 -- ALGLIB -- 2564 Copyright 2005-2010 by Bochkanov Sergey 2565 *************************************************************************/ 2566 void hmatrixtdunpackq(const complex_2d_array &a, const ae_int_t n, const bool isupper, const complex_1d_array &tau, complex_2d_array &q, const xparams _xparams = alglib::xdefault); 2567 #endif 2568 2569 #if defined(AE_COMPILE_MATGEN) || !defined(AE_PARTIAL_BUILD) 2570 /************************************************************************* 2571 Generation of a random uniformly distributed (Haar) orthogonal matrix 2572 2573 INPUT PARAMETERS: 2574 N - matrix size, N>=1 2575 2576 OUTPUT PARAMETERS: 2577 A - orthogonal NxN matrix, array[0..N-1,0..N-1] 2578 2579 NOTE: this function uses algorithm described in Stewart, G. W. (1980), 2580 "The Efficient Generation of Random Orthogonal Matrices with an 2581 Application to Condition Estimators". 2582 2583 Speaking short, to generate an (N+1)x(N+1) orthogonal matrix, it: 2584 * takes an NxN one 2585 * takes uniformly distributed unit vector of dimension N+1. 2586 * constructs a Householder reflection from the vector, then applies 2587 it to the smaller matrix (embedded in the larger size with a 1 at 2588 the bottom right corner). 2589 2590 -- ALGLIB routine -- 2591 04.12.2009 2592 Bochkanov Sergey 2593 *************************************************************************/ 2594 void rmatrixrndorthogonal(const ae_int_t n, real_2d_array &a, const xparams _xparams = alglib::xdefault); 2595 2596 2597 /************************************************************************* 2598 Generation of random NxN matrix with given condition number and norm2(A)=1 2599 2600 INPUT PARAMETERS: 2601 N - matrix size 2602 C - condition number (in 2-norm) 2603 2604 OUTPUT PARAMETERS: 2605 A - random matrix with norm2(A)=1 and cond(A)=C 2606 2607 -- ALGLIB routine -- 2608 04.12.2009 2609 Bochkanov Sergey 2610 *************************************************************************/ 2611 void rmatrixrndcond(const ae_int_t n, const double c, real_2d_array &a, const xparams _xparams = alglib::xdefault); 2612 2613 2614 /************************************************************************* 2615 Generation of a random Haar distributed orthogonal complex matrix 2616 2617 INPUT PARAMETERS: 2618 N - matrix size, N>=1 2619 2620 OUTPUT PARAMETERS: 2621 A - orthogonal NxN matrix, array[0..N-1,0..N-1] 2622 2623 NOTE: this function uses algorithm described in Stewart, G. W. (1980), 2624 "The Efficient Generation of Random Orthogonal Matrices with an 2625 Application to Condition Estimators". 2626 2627 Speaking short, to generate an (N+1)x(N+1) orthogonal matrix, it: 2628 * takes an NxN one 2629 * takes uniformly distributed unit vector of dimension N+1. 2630 * constructs a Householder reflection from the vector, then applies 2631 it to the smaller matrix (embedded in the larger size with a 1 at 2632 the bottom right corner). 2633 2634 -- ALGLIB routine -- 2635 04.12.2009 2636 Bochkanov Sergey 2637 *************************************************************************/ 2638 void cmatrixrndorthogonal(const ae_int_t n, complex_2d_array &a, const xparams _xparams = alglib::xdefault); 2639 2640 2641 /************************************************************************* 2642 Generation of random NxN complex matrix with given condition number C and 2643 norm2(A)=1 2644 2645 INPUT PARAMETERS: 2646 N - matrix size 2647 C - condition number (in 2-norm) 2648 2649 OUTPUT PARAMETERS: 2650 A - random matrix with norm2(A)=1 and cond(A)=C 2651 2652 -- ALGLIB routine -- 2653 04.12.2009 2654 Bochkanov Sergey 2655 *************************************************************************/ 2656 void cmatrixrndcond(const ae_int_t n, const double c, complex_2d_array &a, const xparams _xparams = alglib::xdefault); 2657 2658 2659 /************************************************************************* 2660 Generation of random NxN symmetric matrix with given condition number and 2661 norm2(A)=1 2662 2663 INPUT PARAMETERS: 2664 N - matrix size 2665 C - condition number (in 2-norm) 2666 2667 OUTPUT PARAMETERS: 2668 A - random matrix with norm2(A)=1 and cond(A)=C 2669 2670 -- ALGLIB routine -- 2671 04.12.2009 2672 Bochkanov Sergey 2673 *************************************************************************/ 2674 void smatrixrndcond(const ae_int_t n, const double c, real_2d_array &a, const xparams _xparams = alglib::xdefault); 2675 2676 2677 /************************************************************************* 2678 Generation of random NxN symmetric positive definite matrix with given 2679 condition number and norm2(A)=1 2680 2681 INPUT PARAMETERS: 2682 N - matrix size 2683 C - condition number (in 2-norm) 2684 2685 OUTPUT PARAMETERS: 2686 A - random SPD matrix with norm2(A)=1 and cond(A)=C 2687 2688 -- ALGLIB routine -- 2689 04.12.2009 2690 Bochkanov Sergey 2691 *************************************************************************/ 2692 void spdmatrixrndcond(const ae_int_t n, const double c, real_2d_array &a, const xparams _xparams = alglib::xdefault); 2693 2694 2695 /************************************************************************* 2696 Generation of random NxN Hermitian matrix with given condition number and 2697 norm2(A)=1 2698 2699 INPUT PARAMETERS: 2700 N - matrix size 2701 C - condition number (in 2-norm) 2702 2703 OUTPUT PARAMETERS: 2704 A - random matrix with norm2(A)=1 and cond(A)=C 2705 2706 -- ALGLIB routine -- 2707 04.12.2009 2708 Bochkanov Sergey 2709 *************************************************************************/ 2710 void hmatrixrndcond(const ae_int_t n, const double c, complex_2d_array &a, const xparams _xparams = alglib::xdefault); 2711 2712 2713 /************************************************************************* 2714 Generation of random NxN Hermitian positive definite matrix with given 2715 condition number and norm2(A)=1 2716 2717 INPUT PARAMETERS: 2718 N - matrix size 2719 C - condition number (in 2-norm) 2720 2721 OUTPUT PARAMETERS: 2722 A - random HPD matrix with norm2(A)=1 and cond(A)=C 2723 2724 -- ALGLIB routine -- 2725 04.12.2009 2726 Bochkanov Sergey 2727 *************************************************************************/ 2728 void hpdmatrixrndcond(const ae_int_t n, const double c, complex_2d_array &a, const xparams _xparams = alglib::xdefault); 2729 2730 2731 /************************************************************************* 2732 Multiplication of MxN matrix by NxN random Haar distributed orthogonal matrix 2733 2734 INPUT PARAMETERS: 2735 A - matrix, array[0..M-1, 0..N-1] 2736 M, N- matrix size 2737 2738 OUTPUT PARAMETERS: 2739 A - A*Q, where Q is random NxN orthogonal matrix 2740 2741 -- ALGLIB routine -- 2742 04.12.2009 2743 Bochkanov Sergey 2744 *************************************************************************/ 2745 void rmatrixrndorthogonalfromtheright(real_2d_array &a, const ae_int_t m, const ae_int_t n, const xparams _xparams = alglib::xdefault); 2746 2747 2748 /************************************************************************* 2749 Multiplication of MxN matrix by MxM random Haar distributed orthogonal matrix 2750 2751 INPUT PARAMETERS: 2752 A - matrix, array[0..M-1, 0..N-1] 2753 M, N- matrix size 2754 2755 OUTPUT PARAMETERS: 2756 A - Q*A, where Q is random MxM orthogonal matrix 2757 2758 -- ALGLIB routine -- 2759 04.12.2009 2760 Bochkanov Sergey 2761 *************************************************************************/ 2762 void rmatrixrndorthogonalfromtheleft(real_2d_array &a, const ae_int_t m, const ae_int_t n, const xparams _xparams = alglib::xdefault); 2763 2764 2765 /************************************************************************* 2766 Multiplication of MxN complex matrix by NxN random Haar distributed 2767 complex orthogonal matrix 2768 2769 INPUT PARAMETERS: 2770 A - matrix, array[0..M-1, 0..N-1] 2771 M, N- matrix size 2772 2773 OUTPUT PARAMETERS: 2774 A - A*Q, where Q is random NxN orthogonal matrix 2775 2776 -- ALGLIB routine -- 2777 04.12.2009 2778 Bochkanov Sergey 2779 *************************************************************************/ 2780 void cmatrixrndorthogonalfromtheright(complex_2d_array &a, const ae_int_t m, const ae_int_t n, const xparams _xparams = alglib::xdefault); 2781 2782 2783 /************************************************************************* 2784 Multiplication of MxN complex matrix by MxM random Haar distributed 2785 complex orthogonal matrix 2786 2787 INPUT PARAMETERS: 2788 A - matrix, array[0..M-1, 0..N-1] 2789 M, N- matrix size 2790 2791 OUTPUT PARAMETERS: 2792 A - Q*A, where Q is random MxM orthogonal matrix 2793 2794 -- ALGLIB routine -- 2795 04.12.2009 2796 Bochkanov Sergey 2797 *************************************************************************/ 2798 void cmatrixrndorthogonalfromtheleft(complex_2d_array &a, const ae_int_t m, const ae_int_t n, const xparams _xparams = alglib::xdefault); 2799 2800 2801 /************************************************************************* 2802 Symmetric multiplication of NxN matrix by random Haar distributed 2803 orthogonal matrix 2804 2805 INPUT PARAMETERS: 2806 A - matrix, array[0..N-1, 0..N-1] 2807 N - matrix size 2808 2809 OUTPUT PARAMETERS: 2810 A - Q'*A*Q, where Q is random NxN orthogonal matrix 2811 2812 -- ALGLIB routine -- 2813 04.12.2009 2814 Bochkanov Sergey 2815 *************************************************************************/ 2816 void smatrixrndmultiply(real_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 2817 2818 2819 /************************************************************************* 2820 Hermitian multiplication of NxN matrix by random Haar distributed 2821 complex orthogonal matrix 2822 2823 INPUT PARAMETERS: 2824 A - matrix, array[0..N-1, 0..N-1] 2825 N - matrix size 2826 2827 OUTPUT PARAMETERS: 2828 A - Q^H*A*Q, where Q is random NxN orthogonal matrix 2829 2830 -- ALGLIB routine -- 2831 04.12.2009 2832 Bochkanov Sergey 2833 *************************************************************************/ 2834 void hmatrixrndmultiply(complex_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 2835 #endif 2836 2837 #if defined(AE_COMPILE_SPARSE) || !defined(AE_PARTIAL_BUILD) 2838 /************************************************************************* 2839 This function serializes data structure to string. 2840 2841 Important properties of s_out: 2842 * it contains alphanumeric characters, dots, underscores, minus signs 2843 * these symbols are grouped into words, which are separated by spaces 2844 and Windows-style (CR+LF) newlines 2845 * although serializer uses spaces and CR+LF as separators, you can 2846 replace any separator character by arbitrary combination of spaces, 2847 tabs, Windows or Unix newlines. It allows flexible reformatting of 2848 the string in case you want to include it into text or XML file. 2849 But you should not insert separators into the middle of the "words" 2850 nor you should change case of letters. 2851 * s_out can be freely moved between 32-bit and 64-bit systems, little 2852 and big endian machines, and so on. You can serialize structure on 2853 32-bit machine and unserialize it on 64-bit one (or vice versa), or 2854 serialize it on SPARC and unserialize on x86. You can also 2855 serialize it in C++ version of ALGLIB and unserialize in C# one, 2856 and vice versa. 2857 *************************************************************************/ 2858 void sparseserialize(sparsematrix &obj, std::string &s_out); 2859 2860 2861 /************************************************************************* 2862 This function unserializes data structure from string. 2863 *************************************************************************/ 2864 void sparseunserialize(const std::string &s_in, sparsematrix &obj); 2865 2866 2867 2868 2869 /************************************************************************* 2870 This function serializes data structure to C++ stream. 2871 2872 Data stream generated by this function is same as string representation 2873 generated by string version of serializer - alphanumeric characters, 2874 dots, underscores, minus signs, which are grouped into words separated by 2875 spaces and CR+LF. 2876 2877 We recommend you to read comments on string version of serializer to find 2878 out more about serialization of AlGLIB objects. 2879 *************************************************************************/ 2880 void sparseserialize(sparsematrix &obj, std::ostream &s_out); 2881 2882 2883 /************************************************************************* 2884 This function unserializes data structure from stream. 2885 *************************************************************************/ 2886 void sparseunserialize(const std::istream &s_in, sparsematrix &obj); 2887 2888 2889 /************************************************************************* 2890 This function creates sparse matrix in a Hash-Table format. 2891 2892 This function creates Hast-Table matrix, which can be converted to CRS 2893 format after its initialization is over. Typical usage scenario for a 2894 sparse matrix is: 2895 1. creation in a Hash-Table format 2896 2. insertion of the matrix elements 2897 3. conversion to the CRS representation 2898 4. matrix is passed to some linear algebra algorithm 2899 2900 Some information about different matrix formats can be found below, in 2901 the "NOTES" section. 2902 2903 INPUT PARAMETERS 2904 M - number of rows in a matrix, M>=1 2905 N - number of columns in a matrix, N>=1 2906 K - K>=0, expected number of non-zero elements in a matrix. 2907 K can be inexact approximation, can be less than actual 2908 number of elements (table will grow when needed) or 2909 even zero). 2910 It is important to understand that although hash-table 2911 may grow automatically, it is better to provide good 2912 estimate of data size. 2913 2914 OUTPUT PARAMETERS 2915 S - sparse M*N matrix in Hash-Table representation. 2916 All elements of the matrix are zero. 2917 2918 NOTE 1 2919 2920 Hash-tables use memory inefficiently, and they have to keep some amount 2921 of the "spare memory" in order to have good performance. Hash table for 2922 matrix with K non-zero elements will need C*K*(8+2*sizeof(int)) bytes, 2923 where C is a small constant, about 1.5-2 in magnitude. 2924 2925 CRS storage, from the other side, is more memory-efficient, and needs 2926 just K*(8+sizeof(int))+M*sizeof(int) bytes, where M is a number of rows 2927 in a matrix. 2928 2929 When you convert from the Hash-Table to CRS representation, all unneeded 2930 memory will be freed. 2931 2932 NOTE 2 2933 2934 Comments of SparseMatrix structure outline information about different 2935 sparse storage formats. We recommend you to read them before starting to 2936 use ALGLIB sparse matrices. 2937 2938 NOTE 3 2939 2940 This function completely overwrites S with new sparse matrix. Previously 2941 allocated storage is NOT reused. If you want to reuse already allocated 2942 memory, call SparseCreateBuf function. 2943 2944 -- ALGLIB PROJECT -- 2945 Copyright 14.10.2011 by Bochkanov Sergey 2946 *************************************************************************/ 2947 void sparsecreate(const ae_int_t m, const ae_int_t n, const ae_int_t k, sparsematrix &s, const xparams _xparams = alglib::xdefault); 2948 void sparsecreate(const ae_int_t m, const ae_int_t n, sparsematrix &s, const xparams _xparams = alglib::xdefault); 2949 2950 2951 /************************************************************************* 2952 This version of SparseCreate function creates sparse matrix in Hash-Table 2953 format, reusing previously allocated storage as much as possible. Read 2954 comments for SparseCreate() for more information. 2955 2956 INPUT PARAMETERS 2957 M - number of rows in a matrix, M>=1 2958 N - number of columns in a matrix, N>=1 2959 K - K>=0, expected number of non-zero elements in a matrix. 2960 K can be inexact approximation, can be less than actual 2961 number of elements (table will grow when needed) or 2962 even zero). 2963 It is important to understand that although hash-table 2964 may grow automatically, it is better to provide good 2965 estimate of data size. 2966 S - SparseMatrix structure which MAY contain some already 2967 allocated storage. 2968 2969 OUTPUT PARAMETERS 2970 S - sparse M*N matrix in Hash-Table representation. 2971 All elements of the matrix are zero. 2972 Previously allocated storage is reused, if its size 2973 is compatible with expected number of non-zeros K. 2974 2975 -- ALGLIB PROJECT -- 2976 Copyright 14.01.2014 by Bochkanov Sergey 2977 *************************************************************************/ 2978 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); 2979 void sparsecreatebuf(const ae_int_t m, const ae_int_t n, const sparsematrix &s, const xparams _xparams = alglib::xdefault); 2980 2981 2982 /************************************************************************* 2983 This function creates sparse matrix in a CRS format (expert function for 2984 situations when you are running out of memory). 2985 2986 This function creates CRS matrix. Typical usage scenario for a CRS matrix 2987 is: 2988 1. creation (you have to tell number of non-zero elements at each row at 2989 this moment) 2990 2. insertion of the matrix elements (row by row, from left to right) 2991 3. matrix is passed to some linear algebra algorithm 2992 2993 This function is a memory-efficient alternative to SparseCreate(), but it 2994 is more complex because it requires you to know in advance how large your 2995 matrix is. Some information about different matrix formats can be found 2996 in comments on SparseMatrix structure. We recommend you to read them 2997 before starting to use ALGLIB sparse matrices.. 2998 2999 INPUT PARAMETERS 3000 M - number of rows in a matrix, M>=1 3001 N - number of columns in a matrix, N>=1 3002 NER - number of elements at each row, array[M], NER[I]>=0 3003 3004 OUTPUT PARAMETERS 3005 S - sparse M*N matrix in CRS representation. 3006 You have to fill ALL non-zero elements by calling 3007 SparseSet() BEFORE you try to use this matrix. 3008 3009 NOTE: this function completely overwrites S with new sparse matrix. 3010 Previously allocated storage is NOT reused. If you want to reuse 3011 already allocated memory, call SparseCreateCRSBuf function. 3012 3013 -- ALGLIB PROJECT -- 3014 Copyright 14.10.2011 by Bochkanov Sergey 3015 *************************************************************************/ 3016 void sparsecreatecrs(const ae_int_t m, const ae_int_t n, const integer_1d_array &ner, sparsematrix &s, const xparams _xparams = alglib::xdefault); 3017 3018 3019 /************************************************************************* 3020 This function creates sparse matrix in a CRS format (expert function for 3021 situations when you are running out of memory). This version of CRS 3022 matrix creation function may reuse memory already allocated in S. 3023 3024 This function creates CRS matrix. Typical usage scenario for a CRS matrix 3025 is: 3026 1. creation (you have to tell number of non-zero elements at each row at 3027 this moment) 3028 2. insertion of the matrix elements (row by row, from left to right) 3029 3. matrix is passed to some linear algebra algorithm 3030 3031 This function is a memory-efficient alternative to SparseCreate(), but it 3032 is more complex because it requires you to know in advance how large your 3033 matrix is. Some information about different matrix formats can be found 3034 in comments on SparseMatrix structure. We recommend you to read them 3035 before starting to use ALGLIB sparse matrices.. 3036 3037 INPUT PARAMETERS 3038 M - number of rows in a matrix, M>=1 3039 N - number of columns in a matrix, N>=1 3040 NER - number of elements at each row, array[M], NER[I]>=0 3041 S - sparse matrix structure with possibly preallocated 3042 memory. 3043 3044 OUTPUT PARAMETERS 3045 S - sparse M*N matrix in CRS representation. 3046 You have to fill ALL non-zero elements by calling 3047 SparseSet() BEFORE you try to use this matrix. 3048 3049 -- ALGLIB PROJECT -- 3050 Copyright 14.10.2011 by Bochkanov Sergey 3051 *************************************************************************/ 3052 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); 3053 3054 3055 /************************************************************************* 3056 This function creates sparse matrix in a SKS format (skyline storage 3057 format). In most cases you do not need this function - CRS format better 3058 suits most use cases. 3059 3060 INPUT PARAMETERS 3061 M, N - number of rows(M) and columns (N) in a matrix: 3062 * M=N (as for now, ALGLIB supports only square SKS) 3063 * N>=1 3064 * M>=1 3065 D - "bottom" bandwidths, array[M], D[I]>=0. 3066 I-th element stores number of non-zeros at I-th row, 3067 below the diagonal (diagonal itself is not included) 3068 U - "top" bandwidths, array[N], U[I]>=0. 3069 I-th element stores number of non-zeros at I-th row, 3070 above the diagonal (diagonal itself is not included) 3071 3072 OUTPUT PARAMETERS 3073 S - sparse M*N matrix in SKS representation. 3074 All elements are filled by zeros. 3075 You may use sparseset() to change their values. 3076 3077 NOTE: this function completely overwrites S with new sparse matrix. 3078 Previously allocated storage is NOT reused. If you want to reuse 3079 already allocated memory, call SparseCreateSKSBuf function. 3080 3081 -- ALGLIB PROJECT -- 3082 Copyright 13.01.2014 by Bochkanov Sergey 3083 *************************************************************************/ 3084 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); 3085 3086 3087 /************************************************************************* 3088 This is "buffered" version of SparseCreateSKS() which reuses memory 3089 previously allocated in S (of course, memory is reallocated if needed). 3090 3091 This function creates sparse matrix in a SKS format (skyline storage 3092 format). In most cases you do not need this function - CRS format better 3093 suits most use cases. 3094 3095 INPUT PARAMETERS 3096 M, N - number of rows(M) and columns (N) in a matrix: 3097 * M=N (as for now, ALGLIB supports only square SKS) 3098 * N>=1 3099 * M>=1 3100 D - "bottom" bandwidths, array[M], 0<=D[I]<=I. 3101 I-th element stores number of non-zeros at I-th row, 3102 below the diagonal (diagonal itself is not included) 3103 U - "top" bandwidths, array[N], 0<=U[I]<=I. 3104 I-th element stores number of non-zeros at I-th row, 3105 above the diagonal (diagonal itself is not included) 3106 3107 OUTPUT PARAMETERS 3108 S - sparse M*N matrix in SKS representation. 3109 All elements are filled by zeros. 3110 You may use sparseset() to change their values. 3111 3112 -- ALGLIB PROJECT -- 3113 Copyright 13.01.2014 by Bochkanov Sergey 3114 *************************************************************************/ 3115 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); 3116 3117 3118 /************************************************************************* 3119 This function creates sparse matrix in a SKS format (skyline storage 3120 format). Unlike more general sparsecreatesks(), this function creates 3121 sparse matrix with constant bandwidth. 3122 3123 You may want to use this function instead of sparsecreatesks() when your 3124 matrix has constant or nearly-constant bandwidth, and you want to 3125 simplify source code. 3126 3127 INPUT PARAMETERS 3128 M, N - number of rows(M) and columns (N) in a matrix: 3129 * M=N (as for now, ALGLIB supports only square SKS) 3130 * N>=1 3131 * M>=1 3132 BW - matrix bandwidth, BW>=0 3133 3134 OUTPUT PARAMETERS 3135 S - sparse M*N matrix in SKS representation. 3136 All elements are filled by zeros. 3137 You may use sparseset() to change their values. 3138 3139 NOTE: this function completely overwrites S with new sparse matrix. 3140 Previously allocated storage is NOT reused. If you want to reuse 3141 already allocated memory, call sparsecreatesksbandbuf function. 3142 3143 -- ALGLIB PROJECT -- 3144 Copyright 25.12.2017 by Bochkanov Sergey 3145 *************************************************************************/ 3146 void sparsecreatesksband(const ae_int_t m, const ae_int_t n, const ae_int_t bw, sparsematrix &s, const xparams _xparams = alglib::xdefault); 3147 3148 3149 /************************************************************************* 3150 This is "buffered" version of sparsecreatesksband() which reuses memory 3151 previously allocated in S (of course, memory is reallocated if needed). 3152 3153 You may want to use this function instead of sparsecreatesksbuf() when 3154 your matrix has constant or nearly-constant bandwidth, and you want to 3155 simplify source code. 3156 3157 INPUT PARAMETERS 3158 M, N - number of rows(M) and columns (N) in a matrix: 3159 * M=N (as for now, ALGLIB supports only square SKS) 3160 * N>=1 3161 * M>=1 3162 BW - bandwidth, BW>=0 3163 3164 OUTPUT PARAMETERS 3165 S - sparse M*N matrix in SKS representation. 3166 All elements are filled by zeros. 3167 You may use sparseset() to change their values. 3168 3169 -- ALGLIB PROJECT -- 3170 Copyright 13.01.2014 by Bochkanov Sergey 3171 *************************************************************************/ 3172 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); 3173 3174 3175 /************************************************************************* 3176 This function copies S0 to S1. 3177 This function completely deallocates memory owned by S1 before creating a 3178 copy of S0. If you want to reuse memory, use SparseCopyBuf. 3179 3180 NOTE: this function does not verify its arguments, it just copies all 3181 fields of the structure. 3182 3183 -- ALGLIB PROJECT -- 3184 Copyright 14.10.2011 by Bochkanov Sergey 3185 *************************************************************************/ 3186 void sparsecopy(const sparsematrix &s0, sparsematrix &s1, const xparams _xparams = alglib::xdefault); 3187 3188 3189 /************************************************************************* 3190 This function copies S0 to S1. 3191 Memory already allocated in S1 is reused as much as possible. 3192 3193 NOTE: this function does not verify its arguments, it just copies all 3194 fields of the structure. 3195 3196 -- ALGLIB PROJECT -- 3197 Copyright 14.10.2011 by Bochkanov Sergey 3198 *************************************************************************/ 3199 void sparsecopybuf(const sparsematrix &s0, const sparsematrix &s1, const xparams _xparams = alglib::xdefault); 3200 3201 3202 /************************************************************************* 3203 This function efficiently swaps contents of S0 and S1. 3204 3205 -- ALGLIB PROJECT -- 3206 Copyright 16.01.2014 by Bochkanov Sergey 3207 *************************************************************************/ 3208 void sparseswap(const sparsematrix &s0, const sparsematrix &s1, const xparams _xparams = alglib::xdefault); 3209 3210 3211 /************************************************************************* 3212 This function adds value to S[i,j] - element of the sparse matrix. Matrix 3213 must be in a Hash-Table mode. 3214 3215 In case S[i,j] already exists in the table, V i added to its value. In 3216 case S[i,j] is non-existent, it is inserted in the table. Table 3217 automatically grows when necessary. 3218 3219 INPUT PARAMETERS 3220 S - sparse M*N matrix in Hash-Table representation. 3221 Exception will be thrown for CRS matrix. 3222 I - row index of the element to modify, 0<=I<M 3223 J - column index of the element to modify, 0<=J<N 3224 V - value to add, must be finite number 3225 3226 OUTPUT PARAMETERS 3227 S - modified matrix 3228 3229 NOTE 1: when S[i,j] is exactly zero after modification, it is deleted 3230 from the table. 3231 3232 -- ALGLIB PROJECT -- 3233 Copyright 14.10.2011 by Bochkanov Sergey 3234 *************************************************************************/ 3235 void sparseadd(const sparsematrix &s, const ae_int_t i, const ae_int_t j, const double v, const xparams _xparams = alglib::xdefault); 3236 3237 3238 /************************************************************************* 3239 This function modifies S[i,j] - element of the sparse matrix. 3240 3241 For Hash-based storage format: 3242 * this function can be called at any moment - during matrix initialization 3243 or later 3244 * new value can be zero or non-zero. In case new value of S[i,j] is zero, 3245 this element is deleted from the table. 3246 * this function has no effect when called with zero V for non-existent 3247 element. 3248 3249 For CRS-bases storage format: 3250 * this function can be called ONLY DURING MATRIX INITIALIZATION 3251 * zero values are stored in the matrix similarly to non-zero ones 3252 * elements must be initialized in correct order - from top row to bottom, 3253 within row - from left to right. 3254 3255 For SKS storage: 3256 * this function can be called at any moment - during matrix initialization 3257 or later 3258 * zero values are stored in the matrix similarly to non-zero ones 3259 * this function CAN NOT be called for non-existent (outside of the band 3260 specified during SKS matrix creation) elements. Say, if you created SKS 3261 matrix with bandwidth=2 and tried to call sparseset(s,0,10,VAL), an 3262 exception will be generated. 3263 3264 INPUT PARAMETERS 3265 S - sparse M*N matrix in Hash-Table, SKS or CRS format. 3266 I - row index of the element to modify, 0<=I<M 3267 J - column index of the element to modify, 0<=J<N 3268 V - value to set, must be finite number, can be zero 3269 3270 OUTPUT PARAMETERS 3271 S - modified matrix 3272 3273 -- ALGLIB PROJECT -- 3274 Copyright 14.10.2011 by Bochkanov Sergey 3275 *************************************************************************/ 3276 void sparseset(const sparsematrix &s, const ae_int_t i, const ae_int_t j, const double v, const xparams _xparams = alglib::xdefault); 3277 3278 3279 /************************************************************************* 3280 This function returns S[i,j] - element of the sparse matrix. Matrix can 3281 be in any mode (Hash-Table, CRS, SKS), but this function is less efficient 3282 for CRS matrices. Hash-Table and SKS matrices can find element in O(1) 3283 time, while CRS matrices need O(log(RS)) time, where RS is an number of 3284 non-zero elements in a row. 3285 3286 INPUT PARAMETERS 3287 S - sparse M*N matrix 3288 I - row index of the element to modify, 0<=I<M 3289 J - column index of the element to modify, 0<=J<N 3290 3291 RESULT 3292 value of S[I,J] or zero (in case no element with such index is found) 3293 3294 -- ALGLIB PROJECT -- 3295 Copyright 14.10.2011 by Bochkanov Sergey 3296 *************************************************************************/ 3297 double sparseget(const sparsematrix &s, const ae_int_t i, const ae_int_t j, const xparams _xparams = alglib::xdefault); 3298 3299 3300 /************************************************************************* 3301 This function checks whether S[i,j] is present in the sparse matrix. It 3302 returns True even for elements that are numerically zero (but still 3303 have place allocated for them). 3304 3305 The matrix can be in any mode (Hash-Table, CRS, SKS), but this function 3306 is less efficient for CRS matrices. Hash-Table and SKS matrices can find 3307 element in O(1) time, while CRS matrices need O(log(RS)) time, where RS 3308 is an number of non-zero elements in a row. 3309 3310 INPUT PARAMETERS 3311 S - sparse M*N matrix 3312 I - row index of the element to modify, 0<=I<M 3313 J - column index of the element to modify, 0<=J<N 3314 3315 RESULT 3316 whether S[I,J] is present in the data structure or not 3317 3318 -- ALGLIB PROJECT -- 3319 Copyright 14.10.2020 by Bochkanov Sergey 3320 *************************************************************************/ 3321 bool sparseexists(const sparsematrix &s, const ae_int_t i, const ae_int_t j, const xparams _xparams = alglib::xdefault); 3322 3323 3324 /************************************************************************* 3325 This function returns I-th diagonal element of the sparse matrix. 3326 3327 Matrix can be in any mode (Hash-Table or CRS storage), but this function 3328 is most efficient for CRS matrices - it requires less than 50 CPU cycles 3329 to extract diagonal element. For Hash-Table matrices we still have O(1) 3330 query time, but function is many times slower. 3331 3332 INPUT PARAMETERS 3333 S - sparse M*N matrix in Hash-Table representation. 3334 Exception will be thrown for CRS matrix. 3335 I - index of the element to modify, 0<=I<min(M,N) 3336 3337 RESULT 3338 value of S[I,I] or zero (in case no element with such index is found) 3339 3340 -- ALGLIB PROJECT -- 3341 Copyright 14.10.2011 by Bochkanov Sergey 3342 *************************************************************************/ 3343 double sparsegetdiagonal(const sparsematrix &s, const ae_int_t i, const xparams _xparams = alglib::xdefault); 3344 3345 3346 /************************************************************************* 3347 This function calculates matrix-vector product S*x. Matrix S must be 3348 stored in CRS or SKS format (exception will be thrown otherwise). 3349 3350 INPUT PARAMETERS 3351 S - sparse M*N matrix in CRS or SKS format. 3352 X - array[N], input vector. For performance reasons we 3353 make only quick checks - we check that array size is 3354 at least N, but we do not check for NAN's or INF's. 3355 Y - output buffer, possibly preallocated. In case buffer 3356 size is too small to store result, this buffer is 3357 automatically resized. 3358 3359 OUTPUT PARAMETERS 3360 Y - array[M], S*x 3361 3362 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3363 You must convert your matrix with SparseConvertToCRS/SKS() before using 3364 this function. 3365 3366 -- ALGLIB PROJECT -- 3367 Copyright 14.10.2011 by Bochkanov Sergey 3368 *************************************************************************/ 3369 void sparsemv(const sparsematrix &s, const real_1d_array &x, real_1d_array &y, const xparams _xparams = alglib::xdefault); 3370 3371 3372 /************************************************************************* 3373 This function calculates matrix-vector product S^T*x. Matrix S must be 3374 stored in CRS or SKS format (exception will be thrown otherwise). 3375 3376 INPUT PARAMETERS 3377 S - sparse M*N matrix in CRS or SKS format. 3378 X - array[M], input vector. For performance reasons we 3379 make only quick checks - we check that array size is 3380 at least M, but we do not check for NAN's or INF's. 3381 Y - output buffer, possibly preallocated. In case buffer 3382 size is too small to store result, this buffer is 3383 automatically resized. 3384 3385 OUTPUT PARAMETERS 3386 Y - array[N], S^T*x 3387 3388 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3389 You must convert your matrix with SparseConvertToCRS/SKS() before using 3390 this function. 3391 3392 -- ALGLIB PROJECT -- 3393 Copyright 14.10.2011 by Bochkanov Sergey 3394 *************************************************************************/ 3395 void sparsemtv(const sparsematrix &s, const real_1d_array &x, real_1d_array &y, const xparams _xparams = alglib::xdefault); 3396 3397 3398 /************************************************************************* 3399 This function calculates generalized sparse matrix-vector product 3400 3401 y := alpha*op(S)*x + beta*y 3402 3403 Matrix S must be stored in CRS or SKS format (exception will be thrown 3404 otherwise). op(S) can be either S or S^T. 3405 3406 NOTE: this function expects Y to be large enough to store result. No 3407 automatic preallocation happens for smaller arrays. 3408 3409 INPUT PARAMETERS 3410 S - sparse matrix in CRS or SKS format. 3411 Alpha - source coefficient 3412 OpS - operation type: 3413 * OpS=0 => op(S) = S 3414 * OpS=1 => op(S) = S^T 3415 X - input vector, must have at least Cols(op(S))+IX elements 3416 IX - subvector offset 3417 Beta - destination coefficient 3418 Y - preallocated output array, must have at least Rows(op(S))+IY elements 3419 IY - subvector offset 3420 3421 OUTPUT PARAMETERS 3422 Y - elements [IY...IY+Rows(op(S))-1] are replaced by result, 3423 other elements are not modified 3424 3425 HANDLING OF SPECIAL CASES: 3426 * below M=Rows(op(S)) and N=Cols(op(S)). Although current ALGLIB version 3427 does not allow you to create zero-sized sparse matrices, internally 3428 ALGLIB can deal with such matrices. So, comments for M or N equal to 3429 zero are for internal use only. 3430 * if M=0, then subroutine does nothing. It does not even touch arrays. 3431 * if N=0 or Alpha=0.0, then: 3432 * if Beta=0, then Y is filled by zeros. S and X are not referenced at 3433 all. Initial values of Y are ignored (we do not multiply Y by zero, 3434 we just rewrite it by zeros) 3435 * if Beta<>0, then Y is replaced by Beta*Y 3436 * if M>0, N>0, Alpha<>0, but Beta=0, then Y is replaced by alpha*op(S)*x 3437 initial state of Y is ignored (rewritten without initial multiplication 3438 by zeros). 3439 3440 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3441 You must convert your matrix with SparseConvertToCRS/SKS() before using 3442 this function. 3443 3444 -- ALGLIB PROJECT -- 3445 Copyright 10.12.2019 by Bochkanov Sergey 3446 *************************************************************************/ 3447 void sparsegemv(const sparsematrix &s, const double alpha, const ae_int_t ops, const real_1d_array &x, const ae_int_t ix, const double beta, const real_1d_array &y, const ae_int_t iy, const xparams _xparams = alglib::xdefault); 3448 3449 3450 /************************************************************************* 3451 This function simultaneously calculates two matrix-vector products: 3452 S*x and S^T*x. 3453 S must be square (non-rectangular) matrix stored in CRS or SKS format 3454 (exception will be thrown otherwise). 3455 3456 INPUT PARAMETERS 3457 S - sparse N*N matrix in CRS or SKS format. 3458 X - array[N], input vector. For performance reasons we 3459 make only quick checks - we check that array size is 3460 at least N, but we do not check for NAN's or INF's. 3461 Y0 - output buffer, possibly preallocated. In case buffer 3462 size is too small to store result, this buffer is 3463 automatically resized. 3464 Y1 - output buffer, possibly preallocated. In case buffer 3465 size is too small to store result, this buffer is 3466 automatically resized. 3467 3468 OUTPUT PARAMETERS 3469 Y0 - array[N], S*x 3470 Y1 - array[N], S^T*x 3471 3472 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3473 You must convert your matrix with SparseConvertToCRS/SKS() before using 3474 this function. 3475 3476 -- ALGLIB PROJECT -- 3477 Copyright 14.10.2011 by Bochkanov Sergey 3478 *************************************************************************/ 3479 void sparsemv2(const sparsematrix &s, const real_1d_array &x, real_1d_array &y0, real_1d_array &y1, const xparams _xparams = alglib::xdefault); 3480 3481 3482 /************************************************************************* 3483 This function calculates matrix-vector product S*x, when S is symmetric 3484 matrix. Matrix S must be stored in CRS or SKS format (exception will be 3485 thrown otherwise). 3486 3487 INPUT PARAMETERS 3488 S - sparse M*M matrix in CRS or SKS format. 3489 IsUpper - whether upper or lower triangle of S is given: 3490 * if upper triangle is given, only S[i,j] for j>=i 3491 are used, and lower triangle is ignored (it can be 3492 empty - these elements are not referenced at all). 3493 * if lower triangle is given, only S[i,j] for j<=i 3494 are used, and upper triangle is ignored. 3495 X - array[N], input vector. For performance reasons we 3496 make only quick checks - we check that array size is 3497 at least N, but we do not check for NAN's or INF's. 3498 Y - output buffer, possibly preallocated. In case buffer 3499 size is too small to store result, this buffer is 3500 automatically resized. 3501 3502 OUTPUT PARAMETERS 3503 Y - array[M], S*x 3504 3505 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3506 You must convert your matrix with SparseConvertToCRS/SKS() before using 3507 this function. 3508 3509 -- ALGLIB PROJECT -- 3510 Copyright 14.10.2011 by Bochkanov Sergey 3511 *************************************************************************/ 3512 void sparsesmv(const sparsematrix &s, const bool isupper, const real_1d_array &x, real_1d_array &y, const xparams _xparams = alglib::xdefault); 3513 3514 3515 /************************************************************************* 3516 This function calculates vector-matrix-vector product x'*S*x, where S is 3517 symmetric matrix. Matrix S must be stored in CRS or SKS format (exception 3518 will be thrown otherwise). 3519 3520 INPUT PARAMETERS 3521 S - sparse M*M matrix in CRS or SKS format. 3522 IsUpper - whether upper or lower triangle of S is given: 3523 * if upper triangle is given, only S[i,j] for j>=i 3524 are used, and lower triangle is ignored (it can be 3525 empty - these elements are not referenced at all). 3526 * if lower triangle is given, only S[i,j] for j<=i 3527 are used, and upper triangle is ignored. 3528 X - array[N], input vector. For performance reasons we 3529 make only quick checks - we check that array size is 3530 at least N, but we do not check for NAN's or INF's. 3531 3532 RESULT 3533 x'*S*x 3534 3535 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3536 You must convert your matrix with SparseConvertToCRS/SKS() before using 3537 this function. 3538 3539 -- ALGLIB PROJECT -- 3540 Copyright 27.01.2014 by Bochkanov Sergey 3541 *************************************************************************/ 3542 double sparsevsmv(const sparsematrix &s, const bool isupper, const real_1d_array &x, const xparams _xparams = alglib::xdefault); 3543 3544 3545 /************************************************************************* 3546 This function calculates matrix-matrix product S*A. Matrix S must be 3547 stored in CRS or SKS format (exception will be thrown otherwise). 3548 3549 INPUT PARAMETERS 3550 S - sparse M*N matrix in CRS or SKS format. 3551 A - array[N][K], input dense matrix. For performance reasons 3552 we make only quick checks - we check that array size 3553 is at least N, but we do not check for NAN's or INF's. 3554 K - number of columns of matrix (A). 3555 B - output buffer, possibly preallocated. In case buffer 3556 size is too small to store result, this buffer is 3557 automatically resized. 3558 3559 OUTPUT PARAMETERS 3560 B - array[M][K], S*A 3561 3562 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3563 You must convert your matrix with SparseConvertToCRS/SKS() before using 3564 this function. 3565 3566 -- ALGLIB PROJECT -- 3567 Copyright 14.10.2011 by Bochkanov Sergey 3568 *************************************************************************/ 3569 void sparsemm(const sparsematrix &s, const real_2d_array &a, const ae_int_t k, real_2d_array &b, const xparams _xparams = alglib::xdefault); 3570 3571 3572 /************************************************************************* 3573 This function calculates matrix-matrix product S^T*A. Matrix S must be 3574 stored in CRS or SKS format (exception will be thrown otherwise). 3575 3576 INPUT PARAMETERS 3577 S - sparse M*N matrix in CRS or SKS format. 3578 A - array[M][K], input dense matrix. For performance reasons 3579 we make only quick checks - we check that array size is 3580 at least M, but we do not check for NAN's or INF's. 3581 K - number of columns of matrix (A). 3582 B - output buffer, possibly preallocated. In case buffer 3583 size is too small to store result, this buffer is 3584 automatically resized. 3585 3586 OUTPUT PARAMETERS 3587 B - array[N][K], S^T*A 3588 3589 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3590 You must convert your matrix with SparseConvertToCRS/SKS() before using 3591 this function. 3592 3593 -- ALGLIB PROJECT -- 3594 Copyright 14.10.2011 by Bochkanov Sergey 3595 *************************************************************************/ 3596 void sparsemtm(const sparsematrix &s, const real_2d_array &a, const ae_int_t k, real_2d_array &b, const xparams _xparams = alglib::xdefault); 3597 3598 3599 /************************************************************************* 3600 This function simultaneously calculates two matrix-matrix products: 3601 S*A and S^T*A. 3602 S must be square (non-rectangular) matrix stored in CRS or SKS format 3603 (exception will be thrown otherwise). 3604 3605 INPUT PARAMETERS 3606 S - sparse N*N matrix in CRS or SKS format. 3607 A - array[N][K], input dense matrix. For performance reasons 3608 we make only quick checks - we check that array size is 3609 at least N, but we do not check for NAN's or INF's. 3610 K - number of columns of matrix (A). 3611 B0 - output buffer, possibly preallocated. In case buffer 3612 size is too small to store result, this buffer is 3613 automatically resized. 3614 B1 - output buffer, possibly preallocated. In case buffer 3615 size is too small to store result, this buffer is 3616 automatically resized. 3617 3618 OUTPUT PARAMETERS 3619 B0 - array[N][K], S*A 3620 B1 - array[N][K], S^T*A 3621 3622 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3623 You must convert your matrix with SparseConvertToCRS/SKS() before using 3624 this function. 3625 3626 -- ALGLIB PROJECT -- 3627 Copyright 14.10.2011 by Bochkanov Sergey 3628 *************************************************************************/ 3629 void sparsemm2(const sparsematrix &s, const real_2d_array &a, const ae_int_t k, real_2d_array &b0, real_2d_array &b1, const xparams _xparams = alglib::xdefault); 3630 3631 3632 /************************************************************************* 3633 This function calculates matrix-matrix product S*A, when S is symmetric 3634 matrix. Matrix S must be stored in CRS or SKS format (exception will be 3635 thrown otherwise). 3636 3637 INPUT PARAMETERS 3638 S - sparse M*M matrix in CRS or SKS format. 3639 IsUpper - whether upper or lower triangle of S is given: 3640 * if upper triangle is given, only S[i,j] for j>=i 3641 are used, and lower triangle is ignored (it can be 3642 empty - these elements are not referenced at all). 3643 * if lower triangle is given, only S[i,j] for j<=i 3644 are used, and upper triangle is ignored. 3645 A - array[N][K], input dense matrix. For performance reasons 3646 we make only quick checks - we check that array size is 3647 at least N, but we do not check for NAN's or INF's. 3648 K - number of columns of matrix (A). 3649 B - output buffer, possibly preallocated. In case buffer 3650 size is too small to store result, this buffer is 3651 automatically resized. 3652 3653 OUTPUT PARAMETERS 3654 B - array[M][K], S*A 3655 3656 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3657 You must convert your matrix with SparseConvertToCRS/SKS() before using 3658 this function. 3659 3660 -- ALGLIB PROJECT -- 3661 Copyright 14.10.2011 by Bochkanov Sergey 3662 *************************************************************************/ 3663 void sparsesmm(const sparsematrix &s, const bool isupper, const real_2d_array &a, const ae_int_t k, real_2d_array &b, const xparams _xparams = alglib::xdefault); 3664 3665 3666 /************************************************************************* 3667 This function calculates matrix-vector product op(S)*x, when x is vector, 3668 S is symmetric triangular matrix, op(S) is transposition or no operation. 3669 Matrix S must be stored in CRS or SKS format (exception will be thrown 3670 otherwise). 3671 3672 INPUT PARAMETERS 3673 S - sparse square matrix in CRS or SKS format. 3674 IsUpper - whether upper or lower triangle of S is used: 3675 * if upper triangle is given, only S[i,j] for j>=i 3676 are used, and lower triangle is ignored (it can be 3677 empty - these elements are not referenced at all). 3678 * if lower triangle is given, only S[i,j] for j<=i 3679 are used, and upper triangle is ignored. 3680 IsUnit - unit or non-unit diagonal: 3681 * if True, diagonal elements of triangular matrix are 3682 considered equal to 1.0. Actual elements stored in 3683 S are not referenced at all. 3684 * if False, diagonal stored in S is used 3685 OpType - operation type: 3686 * if 0, S*x is calculated 3687 * if 1, (S^T)*x is calculated (transposition) 3688 X - array[N] which stores input vector. For performance 3689 reasons we make only quick checks - we check that 3690 array size is at least N, but we do not check for 3691 NAN's or INF's. 3692 Y - possibly preallocated input buffer. Automatically 3693 resized if its size is too small. 3694 3695 OUTPUT PARAMETERS 3696 Y - array[N], op(S)*x 3697 3698 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3699 You must convert your matrix with SparseConvertToCRS/SKS() before using 3700 this function. 3701 3702 -- ALGLIB PROJECT -- 3703 Copyright 20.01.2014 by Bochkanov Sergey 3704 *************************************************************************/ 3705 void sparsetrmv(const sparsematrix &s, const bool isupper, const bool isunit, const ae_int_t optype, const real_1d_array &x, real_1d_array &y, const xparams _xparams = alglib::xdefault); 3706 3707 3708 /************************************************************************* 3709 This function solves linear system op(S)*y=x where x is vector, S is 3710 symmetric triangular matrix, op(S) is transposition or no operation. 3711 Matrix S must be stored in CRS or SKS format (exception will be thrown 3712 otherwise). 3713 3714 INPUT PARAMETERS 3715 S - sparse square matrix in CRS or SKS format. 3716 IsUpper - whether upper or lower triangle of S is used: 3717 * if upper triangle is given, only S[i,j] for j>=i 3718 are used, and lower triangle is ignored (it can be 3719 empty - these elements are not referenced at all). 3720 * if lower triangle is given, only S[i,j] for j<=i 3721 are used, and upper triangle is ignored. 3722 IsUnit - unit or non-unit diagonal: 3723 * if True, diagonal elements of triangular matrix are 3724 considered equal to 1.0. Actual elements stored in 3725 S are not referenced at all. 3726 * if False, diagonal stored in S is used. It is your 3727 responsibility to make sure that diagonal is 3728 non-zero. 3729 OpType - operation type: 3730 * if 0, S*x is calculated 3731 * if 1, (S^T)*x is calculated (transposition) 3732 X - array[N] which stores input vector. For performance 3733 reasons we make only quick checks - we check that 3734 array size is at least N, but we do not check for 3735 NAN's or INF's. 3736 3737 OUTPUT PARAMETERS 3738 X - array[N], inv(op(S))*x 3739 3740 NOTE: this function throws exception when called for non-CRS/SKS matrix. 3741 You must convert your matrix with SparseConvertToCRS/SKS() before 3742 using this function. 3743 3744 NOTE: no assertion or tests are done during algorithm operation. It is 3745 your responsibility to provide invertible matrix to algorithm. 3746 3747 -- ALGLIB PROJECT -- 3748 Copyright 20.01.2014 by Bochkanov Sergey 3749 *************************************************************************/ 3750 void sparsetrsv(const sparsematrix &s, const bool isupper, const bool isunit, const ae_int_t optype, const real_1d_array &x, const xparams _xparams = alglib::xdefault); 3751 3752 3753 /************************************************************************* 3754 This function applies permutation given by permutation table P (as opposed 3755 to product form of permutation) to sparse symmetric matrix A, given by 3756 either upper or lower triangle: B := P*A*P'. 3757 3758 This function allocates completely new instance of B. Use buffered version 3759 SparseSymmPermTblBuf() if you want to reuse already allocated structure. 3760 3761 INPUT PARAMETERS 3762 A - sparse square matrix in CRS format. 3763 IsUpper - whether upper or lower triangle of A is used: 3764 * if upper triangle is given, only A[i,j] for j>=i 3765 are used, and lower triangle is ignored (it can be 3766 empty - these elements are not referenced at all). 3767 * if lower triangle is given, only A[i,j] for j<=i 3768 are used, and upper triangle is ignored. 3769 P - array[N] which stores permutation table; P[I]=J means 3770 that I-th row/column of matrix A is moved to J-th 3771 position. For performance reasons we do NOT check that 3772 P[] is a correct permutation (that there is no 3773 repetitions, just that all its elements are in [0,N) 3774 range. 3775 3776 OUTPUT PARAMETERS 3777 B - permuted matrix. Permutation is applied to A from 3778 the both sides, only upper or lower triangle (depending 3779 on IsUpper) is stored. 3780 3781 NOTE: this function throws exception when called for non-CRS matrix. You 3782 must convert your matrix with SparseConvertToCRS() before using this 3783 function. 3784 3785 -- ALGLIB PROJECT -- 3786 Copyright 05.10.2020 by Bochkanov Sergey. 3787 *************************************************************************/ 3788 void sparsesymmpermtbl(const sparsematrix &a, const bool isupper, const integer_1d_array &p, sparsematrix &b, const xparams _xparams = alglib::xdefault); 3789 3790 3791 /************************************************************************* 3792 This function is a buffered version of SparseSymmPermTbl() that reuses 3793 previously allocated storage in B as much as possible. 3794 3795 This function applies permutation given by permutation table P (as opposed 3796 to product form of permutation) to sparse symmetric matrix A, given by 3797 either upper or lower triangle: B := P*A*P'. 3798 3799 INPUT PARAMETERS 3800 A - sparse square matrix in CRS format. 3801 IsUpper - whether upper or lower triangle of A is used: 3802 * if upper triangle is given, only A[i,j] for j>=i 3803 are used, and lower triangle is ignored (it can be 3804 empty - these elements are not referenced at all). 3805 * if lower triangle is given, only A[i,j] for j<=i 3806 are used, and upper triangle is ignored. 3807 P - array[N] which stores permutation table; P[I]=J means 3808 that I-th row/column of matrix A is moved to J-th 3809 position. For performance reasons we do NOT check that 3810 P[] is a correct permutation (that there is no 3811 repetitions, just that all its elements are in [0,N) 3812 range. 3813 B - sparse matrix object that will hold output. 3814 Previously allocated memory will be reused as much as 3815 possible. 3816 3817 OUTPUT PARAMETERS 3818 B - permuted matrix. Permutation is applied to A from 3819 the both sides, only upper or lower triangle (depending 3820 on IsUpper) is stored. 3821 3822 NOTE: this function throws exception when called for non-CRS matrix. You 3823 must convert your matrix with SparseConvertToCRS() before using this 3824 function. 3825 3826 -- ALGLIB PROJECT -- 3827 Copyright 05.10.2020 by Bochkanov Sergey. 3828 *************************************************************************/ 3829 void sparsesymmpermtblbuf(const sparsematrix &a, const bool isupper, const integer_1d_array &p, const sparsematrix &b, const xparams _xparams = alglib::xdefault); 3830 3831 3832 /************************************************************************* 3833 This procedure resizes Hash-Table matrix. It can be called when you have 3834 deleted too many elements from the matrix, and you want to free unneeded 3835 memory. 3836 3837 -- ALGLIB PROJECT -- 3838 Copyright 14.10.2011 by Bochkanov Sergey 3839 *************************************************************************/ 3840 void sparseresizematrix(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 3841 3842 3843 /************************************************************************* 3844 This function is used to enumerate all elements of the sparse matrix. 3845 Before first call user initializes T0 and T1 counters by zero. These 3846 counters are used to remember current position in a matrix; after each 3847 call they are updated by the function. 3848 3849 Subsequent calls to this function return non-zero elements of the sparse 3850 matrix, one by one. If you enumerate CRS matrix, matrix is traversed from 3851 left to right, from top to bottom. In case you enumerate matrix stored as 3852 Hash table, elements are returned in random order. 3853 3854 EXAMPLE 3855 > T0=0 3856 > T1=0 3857 > while SparseEnumerate(S,T0,T1,I,J,V) do 3858 > ....do something with I,J,V 3859 3860 INPUT PARAMETERS 3861 S - sparse M*N matrix in Hash-Table or CRS representation. 3862 T0 - internal counter 3863 T1 - internal counter 3864 3865 OUTPUT PARAMETERS 3866 T0 - new value of the internal counter 3867 T1 - new value of the internal counter 3868 I - row index of non-zero element, 0<=I<M. 3869 J - column index of non-zero element, 0<=J<N 3870 V - value of the T-th element 3871 3872 RESULT 3873 True in case of success (next non-zero element was retrieved) 3874 False in case all non-zero elements were enumerated 3875 3876 NOTE: you may call SparseRewriteExisting() during enumeration, but it is 3877 THE ONLY matrix modification function you can call!!! Other 3878 matrix modification functions should not be called during enumeration! 3879 3880 -- ALGLIB PROJECT -- 3881 Copyright 14.03.2012 by Bochkanov Sergey 3882 *************************************************************************/ 3883 bool sparseenumerate(const sparsematrix &s, ae_int_t &t0, ae_int_t &t1, ae_int_t &i, ae_int_t &j, double &v, const xparams _xparams = alglib::xdefault); 3884 3885 3886 /************************************************************************* 3887 This function rewrites existing (non-zero) element. It returns True if 3888 element exists or False, when it is called for non-existing (zero) 3889 element. 3890 3891 This function works with any kind of the matrix. 3892 3893 The purpose of this function is to provide convenient thread-safe way to 3894 modify sparse matrix. Such modification (already existing element is 3895 rewritten) is guaranteed to be thread-safe without any synchronization, as 3896 long as different threads modify different elements. 3897 3898 INPUT PARAMETERS 3899 S - sparse M*N matrix in any kind of representation 3900 (Hash, SKS, CRS). 3901 I - row index of non-zero element to modify, 0<=I<M 3902 J - column index of non-zero element to modify, 0<=J<N 3903 V - value to rewrite, must be finite number 3904 3905 OUTPUT PARAMETERS 3906 S - modified matrix 3907 RESULT 3908 True in case when element exists 3909 False in case when element doesn't exist or it is zero 3910 3911 -- ALGLIB PROJECT -- 3912 Copyright 14.03.2012 by Bochkanov Sergey 3913 *************************************************************************/ 3914 bool sparserewriteexisting(const sparsematrix &s, const ae_int_t i, const ae_int_t j, const double v, const xparams _xparams = alglib::xdefault); 3915 3916 3917 /************************************************************************* 3918 This function returns I-th row of the sparse matrix. Matrix must be stored 3919 in CRS or SKS format. 3920 3921 INPUT PARAMETERS: 3922 S - sparse M*N matrix in CRS format 3923 I - row index, 0<=I<M 3924 IRow - output buffer, can be preallocated. In case buffer 3925 size is too small to store I-th row, it is 3926 automatically reallocated. 3927 3928 OUTPUT PARAMETERS: 3929 IRow - array[M], I-th row. 3930 3931 NOTE: this function has O(N) running time, where N is a column count. It 3932 allocates and fills N-element array, even although most of its 3933 elemets are zero. 3934 3935 NOTE: If you have O(non-zeros-per-row) time and memory requirements, use 3936 SparseGetCompressedRow() function. It returns data in compressed 3937 format. 3938 3939 NOTE: when incorrect I (outside of [0,M-1]) or matrix (non CRS/SKS) 3940 is passed, this function throws exception. 3941 3942 -- ALGLIB PROJECT -- 3943 Copyright 10.12.2014 by Bochkanov Sergey 3944 *************************************************************************/ 3945 void sparsegetrow(const sparsematrix &s, const ae_int_t i, real_1d_array &irow, const xparams _xparams = alglib::xdefault); 3946 3947 3948 /************************************************************************* 3949 This function returns I-th row of the sparse matrix IN COMPRESSED FORMAT - 3950 only non-zero elements are returned (with their indexes). Matrix must be 3951 stored in CRS or SKS format. 3952 3953 INPUT PARAMETERS: 3954 S - sparse M*N matrix in CRS format 3955 I - row index, 0<=I<M 3956 ColIdx - output buffer for column indexes, can be preallocated. 3957 In case buffer size is too small to store I-th row, it 3958 is automatically reallocated. 3959 Vals - output buffer for values, can be preallocated. In case 3960 buffer size is too small to store I-th row, it is 3961 automatically reallocated. 3962 3963 OUTPUT PARAMETERS: 3964 ColIdx - column indexes of non-zero elements, sorted by 3965 ascending. Symbolically non-zero elements are counted 3966 (i.e. if you allocated place for element, but it has 3967 zero numerical value - it is counted). 3968 Vals - values. Vals[K] stores value of matrix element with 3969 indexes (I,ColIdx[K]). Symbolically non-zero elements 3970 are counted (i.e. if you allocated place for element, 3971 but it has zero numerical value - it is counted). 3972 NZCnt - number of symbolically non-zero elements per row. 3973 3974 NOTE: when incorrect I (outside of [0,M-1]) or matrix (non CRS/SKS) 3975 is passed, this function throws exception. 3976 3977 NOTE: this function may allocate additional, unnecessary place for ColIdx 3978 and Vals arrays. It is dictated by performance reasons - on SKS 3979 matrices it is faster to allocate space at the beginning with 3980 some "extra"-space, than performing two passes over matrix - first 3981 time to calculate exact space required for data, second time - to 3982 store data itself. 3983 3984 -- ALGLIB PROJECT -- 3985 Copyright 10.12.2014 by Bochkanov Sergey 3986 *************************************************************************/ 3987 void sparsegetcompressedrow(const sparsematrix &s, const ae_int_t i, integer_1d_array &colidx, real_1d_array &vals, ae_int_t &nzcnt, const xparams _xparams = alglib::xdefault); 3988 3989 3990 /************************************************************************* 3991 This function performs efficient in-place transpose of SKS matrix. No 3992 additional memory is allocated during transposition. 3993 3994 This function supports only skyline storage format (SKS). 3995 3996 INPUT PARAMETERS 3997 S - sparse matrix in SKS format. 3998 3999 OUTPUT PARAMETERS 4000 S - sparse matrix, transposed. 4001 4002 -- ALGLIB PROJECT -- 4003 Copyright 16.01.2014 by Bochkanov Sergey 4004 *************************************************************************/ 4005 void sparsetransposesks(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4006 4007 4008 /************************************************************************* 4009 This function performs transpose of CRS matrix. 4010 4011 INPUT PARAMETERS 4012 S - sparse matrix in CRS format. 4013 4014 OUTPUT PARAMETERS 4015 S - sparse matrix, transposed. 4016 4017 NOTE: internal temporary copy is allocated for the purposes of 4018 transposition. It is deallocated after transposition. 4019 4020 -- ALGLIB PROJECT -- 4021 Copyright 30.01.2018 by Bochkanov Sergey 4022 *************************************************************************/ 4023 void sparsetransposecrs(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4024 4025 4026 /************************************************************************* 4027 This function performs copying with transposition of CRS matrix. 4028 4029 INPUT PARAMETERS 4030 S0 - sparse matrix in CRS format. 4031 4032 OUTPUT PARAMETERS 4033 S1 - sparse matrix, transposed 4034 4035 -- ALGLIB PROJECT -- 4036 Copyright 23.07.2018 by Bochkanov Sergey 4037 *************************************************************************/ 4038 void sparsecopytransposecrs(const sparsematrix &s0, sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4039 4040 4041 /************************************************************************* 4042 This function performs copying with transposition of CRS matrix (buffered 4043 version which reuses memory already allocated by the target as much as 4044 possible). 4045 4046 INPUT PARAMETERS 4047 S0 - sparse matrix in CRS format. 4048 4049 OUTPUT PARAMETERS 4050 S1 - sparse matrix, transposed; previously allocated memory is 4051 reused if possible. 4052 4053 -- ALGLIB PROJECT -- 4054 Copyright 23.07.2018 by Bochkanov Sergey 4055 *************************************************************************/ 4056 void sparsecopytransposecrsbuf(const sparsematrix &s0, const sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4057 4058 4059 /************************************************************************* 4060 This function performs in-place conversion to desired sparse storage 4061 format. 4062 4063 INPUT PARAMETERS 4064 S0 - sparse matrix in any format. 4065 Fmt - desired storage format of the output, as returned by 4066 SparseGetMatrixType() function: 4067 * 0 for hash-based storage 4068 * 1 for CRS 4069 * 2 for SKS 4070 4071 OUTPUT PARAMETERS 4072 S0 - sparse matrix in requested format. 4073 4074 NOTE: in-place conversion wastes a lot of memory which is used to store 4075 temporaries. If you perform a lot of repeated conversions, we 4076 recommend to use out-of-place buffered conversion functions, like 4077 SparseCopyToBuf(), which can reuse already allocated memory. 4078 4079 -- ALGLIB PROJECT -- 4080 Copyright 16.01.2014 by Bochkanov Sergey 4081 *************************************************************************/ 4082 void sparseconvertto(const sparsematrix &s0, const ae_int_t fmt, const xparams _xparams = alglib::xdefault); 4083 4084 4085 /************************************************************************* 4086 This function performs out-of-place conversion to desired sparse storage 4087 format. S0 is copied to S1 and converted on-the-fly. Memory allocated in 4088 S1 is reused to maximum extent possible. 4089 4090 INPUT PARAMETERS 4091 S0 - sparse matrix in any format. 4092 Fmt - desired storage format of the output, as returned by 4093 SparseGetMatrixType() function: 4094 * 0 for hash-based storage 4095 * 1 for CRS 4096 * 2 for SKS 4097 4098 OUTPUT PARAMETERS 4099 S1 - sparse matrix in requested format. 4100 4101 -- ALGLIB PROJECT -- 4102 Copyright 16.01.2014 by Bochkanov Sergey 4103 *************************************************************************/ 4104 void sparsecopytobuf(const sparsematrix &s0, const ae_int_t fmt, const sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4105 4106 4107 /************************************************************************* 4108 This function performs in-place conversion to Hash table storage. 4109 4110 INPUT PARAMETERS 4111 S - sparse matrix in CRS format. 4112 4113 OUTPUT PARAMETERS 4114 S - sparse matrix in Hash table format. 4115 4116 NOTE: this function has no effect when called with matrix which is 4117 already in Hash table mode. 4118 4119 NOTE: in-place conversion involves allocation of temporary arrays. If you 4120 perform a lot of repeated in- place conversions, it may lead to 4121 memory fragmentation. Consider using out-of-place SparseCopyToHashBuf() 4122 function in this case. 4123 4124 -- ALGLIB PROJECT -- 4125 Copyright 20.07.2012 by Bochkanov Sergey 4126 *************************************************************************/ 4127 void sparseconverttohash(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4128 4129 4130 /************************************************************************* 4131 This function performs out-of-place conversion to Hash table storage 4132 format. S0 is copied to S1 and converted on-the-fly. 4133 4134 INPUT PARAMETERS 4135 S0 - sparse matrix in any format. 4136 4137 OUTPUT PARAMETERS 4138 S1 - sparse matrix in Hash table format. 4139 4140 NOTE: if S0 is stored as Hash-table, it is just copied without conversion. 4141 4142 NOTE: this function de-allocates memory occupied by S1 before starting 4143 conversion. If you perform a lot of repeated conversions, it may 4144 lead to memory fragmentation. In this case we recommend you to use 4145 SparseCopyToHashBuf() function which re-uses memory in S1 as much as 4146 possible. 4147 4148 -- ALGLIB PROJECT -- 4149 Copyright 20.07.2012 by Bochkanov Sergey 4150 *************************************************************************/ 4151 void sparsecopytohash(const sparsematrix &s0, sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4152 4153 4154 /************************************************************************* 4155 This function performs out-of-place conversion to Hash table storage 4156 format. S0 is copied to S1 and converted on-the-fly. Memory allocated in 4157 S1 is reused to maximum extent possible. 4158 4159 INPUT PARAMETERS 4160 S0 - sparse matrix in any format. 4161 4162 OUTPUT PARAMETERS 4163 S1 - sparse matrix in Hash table format. 4164 4165 NOTE: if S0 is stored as Hash-table, it is just copied without conversion. 4166 4167 -- ALGLIB PROJECT -- 4168 Copyright 20.07.2012 by Bochkanov Sergey 4169 *************************************************************************/ 4170 void sparsecopytohashbuf(const sparsematrix &s0, const sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4171 4172 4173 /************************************************************************* 4174 This function converts matrix to CRS format. 4175 4176 Some algorithms (linear algebra ones, for example) require matrices in 4177 CRS format. This function allows to perform in-place conversion. 4178 4179 INPUT PARAMETERS 4180 S - sparse M*N matrix in any format 4181 4182 OUTPUT PARAMETERS 4183 S - matrix in CRS format 4184 4185 NOTE: this function has no effect when called with matrix which is 4186 already in CRS mode. 4187 4188 NOTE: this function allocates temporary memory to store a copy of the 4189 matrix. If you perform a lot of repeated conversions, we recommend 4190 you to use SparseCopyToCRSBuf() function, which can reuse 4191 previously allocated memory. 4192 4193 -- ALGLIB PROJECT -- 4194 Copyright 14.10.2011 by Bochkanov Sergey 4195 *************************************************************************/ 4196 void sparseconverttocrs(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4197 4198 4199 /************************************************************************* 4200 This function performs out-of-place conversion to CRS format. S0 is 4201 copied to S1 and converted on-the-fly. 4202 4203 INPUT PARAMETERS 4204 S0 - sparse matrix in any format. 4205 4206 OUTPUT PARAMETERS 4207 S1 - sparse matrix in CRS format. 4208 4209 NOTE: if S0 is stored as CRS, it is just copied without conversion. 4210 4211 NOTE: this function de-allocates memory occupied by S1 before starting CRS 4212 conversion. If you perform a lot of repeated CRS conversions, it may 4213 lead to memory fragmentation. In this case we recommend you to use 4214 SparseCopyToCRSBuf() function which re-uses memory in S1 as much as 4215 possible. 4216 4217 -- ALGLIB PROJECT -- 4218 Copyright 20.07.2012 by Bochkanov Sergey 4219 *************************************************************************/ 4220 void sparsecopytocrs(const sparsematrix &s0, sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4221 4222 4223 /************************************************************************* 4224 This function performs out-of-place conversion to CRS format. S0 is 4225 copied to S1 and converted on-the-fly. Memory allocated in S1 is reused to 4226 maximum extent possible. 4227 4228 INPUT PARAMETERS 4229 S0 - sparse matrix in any format. 4230 S1 - matrix which may contain some pre-allocated memory, or 4231 can be just uninitialized structure. 4232 4233 OUTPUT PARAMETERS 4234 S1 - sparse matrix in CRS format. 4235 4236 NOTE: if S0 is stored as CRS, it is just copied without conversion. 4237 4238 -- ALGLIB PROJECT -- 4239 Copyright 20.07.2012 by Bochkanov Sergey 4240 *************************************************************************/ 4241 void sparsecopytocrsbuf(const sparsematrix &s0, const sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4242 4243 4244 /************************************************************************* 4245 This function performs in-place conversion to SKS format. 4246 4247 INPUT PARAMETERS 4248 S - sparse matrix in any format. 4249 4250 OUTPUT PARAMETERS 4251 S - sparse matrix in SKS format. 4252 4253 NOTE: this function has no effect when called with matrix which is 4254 already in SKS mode. 4255 4256 NOTE: in-place conversion involves allocation of temporary arrays. If you 4257 perform a lot of repeated in- place conversions, it may lead to 4258 memory fragmentation. Consider using out-of-place SparseCopyToSKSBuf() 4259 function in this case. 4260 4261 -- ALGLIB PROJECT -- 4262 Copyright 15.01.2014 by Bochkanov Sergey 4263 *************************************************************************/ 4264 void sparseconverttosks(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4265 4266 4267 /************************************************************************* 4268 This function performs out-of-place conversion to SKS storage format. 4269 S0 is copied to S1 and converted on-the-fly. 4270 4271 INPUT PARAMETERS 4272 S0 - sparse matrix in any format. 4273 4274 OUTPUT PARAMETERS 4275 S1 - sparse matrix in SKS format. 4276 4277 NOTE: if S0 is stored as SKS, it is just copied without conversion. 4278 4279 NOTE: this function de-allocates memory occupied by S1 before starting 4280 conversion. If you perform a lot of repeated conversions, it may 4281 lead to memory fragmentation. In this case we recommend you to use 4282 SparseCopyToSKSBuf() function which re-uses memory in S1 as much as 4283 possible. 4284 4285 -- ALGLIB PROJECT -- 4286 Copyright 20.07.2012 by Bochkanov Sergey 4287 *************************************************************************/ 4288 void sparsecopytosks(const sparsematrix &s0, sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4289 4290 4291 /************************************************************************* 4292 This function performs out-of-place conversion to SKS format. S0 is 4293 copied to S1 and converted on-the-fly. Memory allocated in S1 is reused 4294 to maximum extent possible. 4295 4296 INPUT PARAMETERS 4297 S0 - sparse matrix in any format. 4298 4299 OUTPUT PARAMETERS 4300 S1 - sparse matrix in SKS format. 4301 4302 NOTE: if S0 is stored as SKS, it is just copied without conversion. 4303 4304 -- ALGLIB PROJECT -- 4305 Copyright 20.07.2012 by Bochkanov Sergey 4306 *************************************************************************/ 4307 void sparsecopytosksbuf(const sparsematrix &s0, const sparsematrix &s1, const xparams _xparams = alglib::xdefault); 4308 4309 4310 /************************************************************************* 4311 This function returns type of the matrix storage format. 4312 4313 INPUT PARAMETERS: 4314 S - sparse matrix. 4315 4316 RESULT: 4317 sparse storage format used by matrix: 4318 0 - Hash-table 4319 1 - CRS (compressed row storage) 4320 2 - SKS (skyline) 4321 4322 NOTE: future versions of ALGLIB may include additional sparse storage 4323 formats. 4324 4325 4326 -- ALGLIB PROJECT -- 4327 Copyright 20.07.2012 by Bochkanov Sergey 4328 *************************************************************************/ 4329 ae_int_t sparsegetmatrixtype(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4330 4331 4332 /************************************************************************* 4333 This function checks matrix storage format and returns True when matrix is 4334 stored using Hash table representation. 4335 4336 INPUT PARAMETERS: 4337 S - sparse matrix. 4338 4339 RESULT: 4340 True if matrix type is Hash table 4341 False if matrix type is not Hash table 4342 4343 -- ALGLIB PROJECT -- 4344 Copyright 20.07.2012 by Bochkanov Sergey 4345 *************************************************************************/ 4346 bool sparseishash(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4347 4348 4349 /************************************************************************* 4350 This function checks matrix storage format and returns True when matrix is 4351 stored using CRS representation. 4352 4353 INPUT PARAMETERS: 4354 S - sparse matrix. 4355 4356 RESULT: 4357 True if matrix type is CRS 4358 False if matrix type is not CRS 4359 4360 -- ALGLIB PROJECT -- 4361 Copyright 20.07.2012 by Bochkanov Sergey 4362 *************************************************************************/ 4363 bool sparseiscrs(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4364 4365 4366 /************************************************************************* 4367 This function checks matrix storage format and returns True when matrix is 4368 stored using SKS representation. 4369 4370 INPUT PARAMETERS: 4371 S - sparse matrix. 4372 4373 RESULT: 4374 True if matrix type is SKS 4375 False if matrix type is not SKS 4376 4377 -- ALGLIB PROJECT -- 4378 Copyright 20.07.2012 by Bochkanov Sergey 4379 *************************************************************************/ 4380 bool sparseissks(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4381 4382 4383 /************************************************************************* 4384 The function frees all memory occupied by sparse matrix. Sparse matrix 4385 structure becomes unusable after this call. 4386 4387 OUTPUT PARAMETERS 4388 S - sparse matrix to delete 4389 4390 -- ALGLIB PROJECT -- 4391 Copyright 24.07.2012 by Bochkanov Sergey 4392 *************************************************************************/ 4393 void sparsefree(sparsematrix &s, const xparams _xparams = alglib::xdefault); 4394 4395 4396 /************************************************************************* 4397 The function returns number of rows of a sparse matrix. 4398 4399 RESULT: number of rows of a sparse matrix. 4400 4401 -- ALGLIB PROJECT -- 4402 Copyright 23.08.2012 by Bochkanov Sergey 4403 *************************************************************************/ 4404 ae_int_t sparsegetnrows(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4405 4406 4407 /************************************************************************* 4408 The function returns number of columns of a sparse matrix. 4409 4410 RESULT: number of columns of a sparse matrix. 4411 4412 -- ALGLIB PROJECT -- 4413 Copyright 23.08.2012 by Bochkanov Sergey 4414 *************************************************************************/ 4415 ae_int_t sparsegetncols(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4416 4417 4418 /************************************************************************* 4419 The function returns number of strictly upper triangular non-zero elements 4420 in the matrix. It counts SYMBOLICALLY non-zero elements, i.e. entries 4421 in the sparse matrix data structure. If some element has zero numerical 4422 value, it is still counted. 4423 4424 This function has different cost for different types of matrices: 4425 * for hash-based matrices it involves complete pass over entire hash-table 4426 with O(NNZ) cost, where NNZ is number of non-zero elements 4427 * for CRS and SKS matrix types cost of counting is O(N) (N - matrix size). 4428 4429 RESULT: number of non-zero elements strictly above main diagonal 4430 4431 -- ALGLIB PROJECT -- 4432 Copyright 12.02.2014 by Bochkanov Sergey 4433 *************************************************************************/ 4434 ae_int_t sparsegetuppercount(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4435 4436 4437 /************************************************************************* 4438 The function returns number of strictly lower triangular non-zero elements 4439 in the matrix. It counts SYMBOLICALLY non-zero elements, i.e. entries 4440 in the sparse matrix data structure. If some element has zero numerical 4441 value, it is still counted. 4442 4443 This function has different cost for different types of matrices: 4444 * for hash-based matrices it involves complete pass over entire hash-table 4445 with O(NNZ) cost, where NNZ is number of non-zero elements 4446 * for CRS and SKS matrix types cost of counting is O(N) (N - matrix size). 4447 4448 RESULT: number of non-zero elements strictly below main diagonal 4449 4450 -- ALGLIB PROJECT -- 4451 Copyright 12.02.2014 by Bochkanov Sergey 4452 *************************************************************************/ 4453 ae_int_t sparsegetlowercount(const sparsematrix &s, const xparams _xparams = alglib::xdefault); 4454 #endif 4455 4456 #if defined(AE_COMPILE_HSSCHUR) || !defined(AE_PARTIAL_BUILD) 4457 4458 #endif 4459 4460 #if defined(AE_COMPILE_EVD) || !defined(AE_PARTIAL_BUILD) 4461 /************************************************************************* 4462 This function initializes subspace iteration solver. This solver is used 4463 to solve symmetric real eigenproblems where just a few (top K) eigenvalues 4464 and corresponding eigenvectors is required. 4465 4466 This solver can be significantly faster than complete EVD decomposition 4467 in the following case: 4468 * when only just a small fraction of top eigenpairs of dense matrix is 4469 required. When K approaches N, this solver is slower than complete dense 4470 EVD 4471 * when problem matrix is sparse (and/or is not known explicitly, i.e. only 4472 matrix-matrix product can be performed) 4473 4474 USAGE (explicit dense/sparse matrix): 4475 1. User initializes algorithm state with eigsubspacecreate() call 4476 2. [optional] User tunes solver parameters by calling eigsubspacesetcond() 4477 or other functions 4478 3. User calls eigsubspacesolvedense() or eigsubspacesolvesparse() methods, 4479 which take algorithm state and 2D array or alglib.sparsematrix object. 4480 4481 USAGE (out-of-core mode): 4482 1. User initializes algorithm state with eigsubspacecreate() call 4483 2. [optional] User tunes solver parameters by calling eigsubspacesetcond() 4484 or other functions 4485 3. User activates out-of-core mode of the solver and repeatedly calls 4486 communication functions in a loop like below: 4487 > alglib.eigsubspaceoocstart(state) 4488 > while alglib.eigsubspaceooccontinue(state) do 4489 > alglib.eigsubspaceoocgetrequestinfo(state, out RequestType, out M) 4490 > alglib.eigsubspaceoocgetrequestdata(state, out X) 4491 > [calculate Y=A*X, with X=R^NxM] 4492 > alglib.eigsubspaceoocsendresult(state, in Y) 4493 > alglib.eigsubspaceoocstop(state, out W, out Z, out Report) 4494 4495 INPUT PARAMETERS: 4496 N - problem dimensionality, N>0 4497 K - number of top eigenvector to calculate, 0<K<=N. 4498 4499 OUTPUT PARAMETERS: 4500 State - structure which stores algorithm state 4501 4502 NOTE: if you solve many similar EVD problems you may find it useful to 4503 reuse previous subspace as warm-start point for new EVD problem. It 4504 can be done with eigsubspacesetwarmstart() function. 4505 4506 -- ALGLIB -- 4507 Copyright 16.01.2017 by Bochkanov Sergey 4508 *************************************************************************/ 4509 void eigsubspacecreate(const ae_int_t n, const ae_int_t k, eigsubspacestate &state, const xparams _xparams = alglib::xdefault); 4510 4511 4512 /************************************************************************* 4513 Buffered version of constructor which aims to reuse previously allocated 4514 memory as much as possible. 4515 4516 -- ALGLIB -- 4517 Copyright 16.01.2017 by Bochkanov Sergey 4518 *************************************************************************/ 4519 void eigsubspacecreatebuf(const ae_int_t n, const ae_int_t k, const eigsubspacestate &state, const xparams _xparams = alglib::xdefault); 4520 4521 4522 /************************************************************************* 4523 This function sets stopping critera for the solver: 4524 * error in eigenvector/value allowed by solver 4525 * maximum number of iterations to perform 4526 4527 INPUT PARAMETERS: 4528 State - solver structure 4529 Eps - eps>=0, with non-zero value used to tell solver that 4530 it can stop after all eigenvalues converged with 4531 error roughly proportional to eps*MAX(LAMBDA_MAX), 4532 where LAMBDA_MAX is a maximum eigenvalue. 4533 Zero value means that no check for precision is 4534 performed. 4535 MaxIts - maxits>=0, with non-zero value used to tell solver 4536 that it can stop after maxits steps (no matter how 4537 precise current estimate is) 4538 4539 NOTE: passing eps=0 and maxits=0 results in automatic selection of 4540 moderate eps as stopping criteria (1.0E-6 in current implementation, 4541 but it may change without notice). 4542 4543 NOTE: very small values of eps are possible (say, 1.0E-12), although the 4544 larger problem you solve (N and/or K), the harder it is to find 4545 precise eigenvectors because rounding errors tend to accumulate. 4546 4547 NOTE: passing non-zero eps results in some performance penalty, roughly 4548 equal to 2N*(2K)^2 FLOPs per iteration. These additional computations 4549 are required in order to estimate current error in eigenvalues via 4550 Rayleigh-Ritz process. 4551 Most of this additional time is spent in construction of ~2Kx2K 4552 symmetric subproblem whose eigenvalues are checked with exact 4553 eigensolver. 4554 This additional time is negligible if you search for eigenvalues of 4555 the large dense matrix, but may become noticeable on highly sparse 4556 EVD problems, where cost of matrix-matrix product is low. 4557 If you set eps to exactly zero, Rayleigh-Ritz phase is completely 4558 turned off. 4559 4560 -- ALGLIB -- 4561 Copyright 16.01.2017 by Bochkanov Sergey 4562 *************************************************************************/ 4563 void eigsubspacesetcond(const eigsubspacestate &state, const double eps, const ae_int_t maxits, const xparams _xparams = alglib::xdefault); 4564 4565 4566 /************************************************************************* 4567 This function sets warm-start mode of the solver: next call to the solver 4568 will reuse previous subspace as warm-start point. It can significantly 4569 speed-up convergence when you solve many similar eigenproblems. 4570 4571 INPUT PARAMETERS: 4572 State - solver structure 4573 UseWarmStart- either True or False 4574 4575 -- ALGLIB -- 4576 Copyright 12.11.2017 by Bochkanov Sergey 4577 *************************************************************************/ 4578 void eigsubspacesetwarmstart(const eigsubspacestate &state, const bool usewarmstart, const xparams _xparams = alglib::xdefault); 4579 4580 4581 /************************************************************************* 4582 This function initiates out-of-core mode of subspace eigensolver. It 4583 should be used in conjunction with other out-of-core-related functions of 4584 this subspackage in a loop like below: 4585 4586 > alglib.eigsubspaceoocstart(state) 4587 > while alglib.eigsubspaceooccontinue(state) do 4588 > alglib.eigsubspaceoocgetrequestinfo(state, out RequestType, out M) 4589 > alglib.eigsubspaceoocgetrequestdata(state, out X) 4590 > [calculate Y=A*X, with X=R^NxM] 4591 > alglib.eigsubspaceoocsendresult(state, in Y) 4592 > alglib.eigsubspaceoocstop(state, out W, out Z, out Report) 4593 4594 INPUT PARAMETERS: 4595 State - solver object 4596 MType - matrix type: 4597 * 0 for real symmetric matrix (solver assumes that 4598 matrix being processed is symmetric; symmetric 4599 direct eigensolver is used for smaller subproblems 4600 arising during solution of larger "full" task) 4601 Future versions of ALGLIB may introduce support for 4602 other matrix types; for now, only symmetric 4603 eigenproblems are supported. 4604 4605 4606 -- ALGLIB -- 4607 Copyright 16.01.2017 by Bochkanov Sergey 4608 *************************************************************************/ 4609 void eigsubspaceoocstart(const eigsubspacestate &state, const ae_int_t mtype, const xparams _xparams = alglib::xdefault); 4610 4611 4612 /************************************************************************* 4613 This function performs subspace iteration in the out-of-core mode. It 4614 should be used in conjunction with other out-of-core-related functions of 4615 this subspackage in a loop like below: 4616 4617 > alglib.eigsubspaceoocstart(state) 4618 > while alglib.eigsubspaceooccontinue(state) do 4619 > alglib.eigsubspaceoocgetrequestinfo(state, out RequestType, out M) 4620 > alglib.eigsubspaceoocgetrequestdata(state, out X) 4621 > [calculate Y=A*X, with X=R^NxM] 4622 > alglib.eigsubspaceoocsendresult(state, in Y) 4623 > alglib.eigsubspaceoocstop(state, out W, out Z, out Report) 4624 4625 4626 -- ALGLIB -- 4627 Copyright 16.01.2017 by Bochkanov Sergey 4628 *************************************************************************/ 4629 bool eigsubspaceooccontinue(const eigsubspacestate &state, const xparams _xparams = alglib::xdefault); 4630 4631 4632 /************************************************************************* 4633 This function is used to retrieve information about out-of-core request 4634 sent by solver to user code: request type (current version of the solver 4635 sends only requests for matrix-matrix products) and request size (size of 4636 the matrices being multiplied). 4637 4638 This function returns just request metrics; in order to get contents of 4639 the matrices being multiplied, use eigsubspaceoocgetrequestdata(). 4640 4641 It should be used in conjunction with other out-of-core-related functions 4642 of this subspackage in a loop like below: 4643 4644 > alglib.eigsubspaceoocstart(state) 4645 > while alglib.eigsubspaceooccontinue(state) do 4646 > alglib.eigsubspaceoocgetrequestinfo(state, out RequestType, out M) 4647 > alglib.eigsubspaceoocgetrequestdata(state, out X) 4648 > [calculate Y=A*X, with X=R^NxM] 4649 > alglib.eigsubspaceoocsendresult(state, in Y) 4650 > alglib.eigsubspaceoocstop(state, out W, out Z, out Report) 4651 4652 INPUT PARAMETERS: 4653 State - solver running in out-of-core mode 4654 4655 OUTPUT PARAMETERS: 4656 RequestType - type of the request to process: 4657 * 0 - for matrix-matrix product A*X, with A being 4658 NxN matrix whose eigenvalues/vectors are needed, 4659 and X being NxREQUESTSIZE one which is returned 4660 by the eigsubspaceoocgetrequestdata(). 4661 RequestSize - size of the X matrix (number of columns), usually 4662 it is several times larger than number of vectors 4663 K requested by user. 4664 4665 4666 -- ALGLIB -- 4667 Copyright 16.01.2017 by Bochkanov Sergey 4668 *************************************************************************/ 4669 void eigsubspaceoocgetrequestinfo(const eigsubspacestate &state, ae_int_t &requesttype, ae_int_t &requestsize, const xparams _xparams = alglib::xdefault); 4670 4671 4672 /************************************************************************* 4673 This function is used to retrieve information about out-of-core request 4674 sent by solver to user code: matrix X (array[N,RequestSize) which have to 4675 be multiplied by out-of-core matrix A in a product A*X. 4676 4677 This function returns just request data; in order to get size of the data 4678 prior to processing requestm, use eigsubspaceoocgetrequestinfo(). 4679 4680 It should be used in conjunction with other out-of-core-related functions 4681 of this subspackage in a loop like below: 4682 4683 > alglib.eigsubspaceoocstart(state) 4684 > while alglib.eigsubspaceooccontinue(state) do 4685 > alglib.eigsubspaceoocgetrequestinfo(state, out RequestType, out M) 4686 > alglib.eigsubspaceoocgetrequestdata(state, out X) 4687 > [calculate Y=A*X, with X=R^NxM] 4688 > alglib.eigsubspaceoocsendresult(state, in Y) 4689 > alglib.eigsubspaceoocstop(state, out W, out Z, out Report) 4690 4691 INPUT PARAMETERS: 4692 State - solver running in out-of-core mode 4693 X - possibly preallocated storage; reallocated if 4694 needed, left unchanged, if large enough to store 4695 request data. 4696 4697 OUTPUT PARAMETERS: 4698 X - array[N,RequestSize] or larger, leading rectangle 4699 is filled with dense matrix X. 4700 4701 4702 -- ALGLIB -- 4703 Copyright 16.01.2017 by Bochkanov Sergey 4704 *************************************************************************/ 4705 void eigsubspaceoocgetrequestdata(const eigsubspacestate &state, real_2d_array &x, const xparams _xparams = alglib::xdefault); 4706 4707 4708 /************************************************************************* 4709 This function is used to send user reply to out-of-core request sent by 4710 solver. Usually it is product A*X for returned by solver matrix X. 4711 4712 It should be used in conjunction with other out-of-core-related functions 4713 of this subspackage in a loop like below: 4714 4715 > alglib.eigsubspaceoocstart(state) 4716 > while alglib.eigsubspaceooccontinue(state) do 4717 > alglib.eigsubspaceoocgetrequestinfo(state, out RequestType, out M) 4718 > alglib.eigsubspaceoocgetrequestdata(state, out X) 4719 > [calculate Y=A*X, with X=R^NxM] 4720 > alglib.eigsubspaceoocsendresult(state, in Y) 4721 > alglib.eigsubspaceoocstop(state, out W, out Z, out Report) 4722 4723 INPUT PARAMETERS: 4724 State - solver running in out-of-core mode 4725 AX - array[N,RequestSize] or larger, leading rectangle 4726 is filled with product A*X. 4727 4728 4729 -- ALGLIB -- 4730 Copyright 16.01.2017 by Bochkanov Sergey 4731 *************************************************************************/ 4732 void eigsubspaceoocsendresult(const eigsubspacestate &state, const real_2d_array &ax, const xparams _xparams = alglib::xdefault); 4733 4734 4735 /************************************************************************* 4736 This function finalizes out-of-core mode of subspace eigensolver. It 4737 should be used in conjunction with other out-of-core-related functions of 4738 this subspackage in a loop like below: 4739 4740 > alglib.eigsubspaceoocstart(state) 4741 > while alglib.eigsubspaceooccontinue(state) do 4742 > alglib.eigsubspaceoocgetrequestinfo(state, out RequestType, out M) 4743 > alglib.eigsubspaceoocgetrequestdata(state, out X) 4744 > [calculate Y=A*X, with X=R^NxM] 4745 > alglib.eigsubspaceoocsendresult(state, in Y) 4746 > alglib.eigsubspaceoocstop(state, out W, out Z, out Report) 4747 4748 INPUT PARAMETERS: 4749 State - solver state 4750 4751 OUTPUT PARAMETERS: 4752 W - array[K], depending on solver settings: 4753 * top K eigenvalues ordered by descending - if 4754 eigenvectors are returned in Z 4755 * zeros - if invariant subspace is returned in Z 4756 Z - array[N,K], depending on solver settings either: 4757 * matrix of eigenvectors found 4758 * orthogonal basis of K-dimensional invariant subspace 4759 Rep - report with additional parameters 4760 4761 -- ALGLIB -- 4762 Copyright 16.01.2017 by Bochkanov Sergey 4763 *************************************************************************/ 4764 void eigsubspaceoocstop(const eigsubspacestate &state, real_1d_array &w, real_2d_array &z, eigsubspacereport &rep, const xparams _xparams = alglib::xdefault); 4765 4766 4767 /************************************************************************* 4768 This function runs subspace eigensolver for dense NxN symmetric matrix A, 4769 given by its upper or lower triangle. 4770 4771 This function can not process nonsymmetric matrices. 4772 4773 INPUT PARAMETERS: 4774 State - solver state 4775 A - array[N,N], symmetric NxN matrix given by one of its 4776 triangles 4777 IsUpper - whether upper or lower triangle of A is given (the 4778 other one is not referenced at all). 4779 4780 OUTPUT PARAMETERS: 4781 W - array[K], top K eigenvalues ordered by descending 4782 of their absolute values 4783 Z - array[N,K], matrix of eigenvectors found 4784 Rep - report with additional parameters 4785 4786 NOTE: internally this function allocates a copy of NxN dense A. You should 4787 take it into account when working with very large matrices occupying 4788 almost all RAM. 4789 4790 ! FREE EDITION OF ALGLIB: 4791 ! 4792 ! Free Edition of ALGLIB supports following important features for this 4793 ! function: 4794 ! * C++ version: x64 SIMD support using C++ intrinsics 4795 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 4796 ! 4797 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 4798 ! Reference Manual in order to find out how to activate SIMD support 4799 ! in ALGLIB. 4800 4801 ! COMMERCIAL EDITION OF ALGLIB: 4802 ! 4803 ! Commercial Edition of ALGLIB includes following important improvements 4804 ! of this function: 4805 ! * high-performance native backend with same C# interface (C# version) 4806 ! * multithreading support (C++ and C# versions) 4807 ! * hardware vendor (Intel) implementations of linear algebra primitives 4808 ! (C++ and C# versions, x86/x64 platform) 4809 ! 4810 ! We recommend you to read 'Working with commercial version' section of 4811 ! ALGLIB Reference Manual in order to find out how to use performance- 4812 ! related features provided by commercial edition of ALGLIB. 4813 4814 -- ALGLIB -- 4815 Copyright 16.01.2017 by Bochkanov Sergey 4816 *************************************************************************/ 4817 void eigsubspacesolvedenses(const eigsubspacestate &state, const real_2d_array &a, const bool isupper, real_1d_array &w, real_2d_array &z, eigsubspacereport &rep, const xparams _xparams = alglib::xdefault); 4818 4819 4820 /************************************************************************* 4821 This function runs eigensolver for dense NxN symmetric matrix A, given by 4822 upper or lower triangle. 4823 4824 This function can not process nonsymmetric matrices. 4825 4826 INPUT PARAMETERS: 4827 State - solver state 4828 A - NxN symmetric matrix given by one of its triangles 4829 IsUpper - whether upper or lower triangle of A is given (the 4830 other one is not referenced at all). 4831 4832 OUTPUT PARAMETERS: 4833 W - array[K], top K eigenvalues ordered by descending 4834 of their absolute values 4835 Z - array[N,K], matrix of eigenvectors found 4836 Rep - report with additional parameters 4837 4838 -- ALGLIB -- 4839 Copyright 16.01.2017 by Bochkanov Sergey 4840 *************************************************************************/ 4841 void eigsubspacesolvesparses(const eigsubspacestate &state, const sparsematrix &a, const bool isupper, real_1d_array &w, real_2d_array &z, eigsubspacereport &rep, const xparams _xparams = alglib::xdefault); 4842 4843 4844 /************************************************************************* 4845 Finding the eigenvalues and eigenvectors of a symmetric matrix 4846 4847 The algorithm finds eigen pairs of a symmetric matrix by reducing it to 4848 tridiagonal form and using the QL/QR algorithm. 4849 4850 ! COMMERCIAL EDITION OF ALGLIB: 4851 ! 4852 ! Commercial Edition of ALGLIB includes following important improvements 4853 ! of this function: 4854 ! * high-performance native backend with same C# interface (C# version) 4855 ! * hardware vendor (Intel) implementations of linear algebra primitives 4856 ! (C++ and C# versions, x86/x64 platform) 4857 ! 4858 ! We recommend you to read 'Working with commercial version' section of 4859 ! ALGLIB Reference Manual in order to find out how to use performance- 4860 ! related features provided by commercial edition of ALGLIB. 4861 4862 Input parameters: 4863 A - symmetric matrix which is given by its upper or lower 4864 triangular part. 4865 Array whose indexes range within [0..N-1, 0..N-1]. 4866 N - size of matrix A. 4867 ZNeeded - flag controlling whether the eigenvectors are needed or not. 4868 If ZNeeded is equal to: 4869 * 0, the eigenvectors are not returned; 4870 * 1, the eigenvectors are returned. 4871 IsUpper - storage format. 4872 4873 Output parameters: 4874 D - eigenvalues in ascending order. 4875 Array whose index ranges within [0..N-1]. 4876 Z - if ZNeeded is equal to: 4877 * 0, Z hasn't changed; 4878 * 1, Z contains the eigenvectors. 4879 Array whose indexes range within [0..N-1, 0..N-1]. 4880 The eigenvectors are stored in the matrix columns. 4881 4882 Result: 4883 True, if the algorithm has converged. 4884 False, if the algorithm hasn't converged (rare case). 4885 4886 -- ALGLIB -- 4887 Copyright 2005-2008 by Bochkanov Sergey 4888 *************************************************************************/ 4889 bool smatrixevd(const real_2d_array &a, const ae_int_t n, const ae_int_t zneeded, const bool isupper, real_1d_array &d, real_2d_array &z, const xparams _xparams = alglib::xdefault); 4890 4891 4892 /************************************************************************* 4893 Subroutine for finding the eigenvalues (and eigenvectors) of a symmetric 4894 matrix in a given half open interval (A, B] by using a bisection and 4895 inverse iteration 4896 4897 ! COMMERCIAL EDITION OF ALGLIB: 4898 ! 4899 ! Commercial Edition of ALGLIB includes following important improvements 4900 ! of this function: 4901 ! * high-performance native backend with same C# interface (C# version) 4902 ! * hardware vendor (Intel) implementations of linear algebra primitives 4903 ! (C++ and C# versions, x86/x64 platform) 4904 ! 4905 ! We recommend you to read 'Working with commercial version' section of 4906 ! ALGLIB Reference Manual in order to find out how to use performance- 4907 ! related features provided by commercial edition of ALGLIB. 4908 4909 Input parameters: 4910 A - symmetric matrix which is given by its upper or lower 4911 triangular part. Array [0..N-1, 0..N-1]. 4912 N - size of matrix A. 4913 ZNeeded - flag controlling whether the eigenvectors are needed or not. 4914 If ZNeeded is equal to: 4915 * 0, the eigenvectors are not returned; 4916 * 1, the eigenvectors are returned. 4917 IsUpperA - storage format of matrix A. 4918 B1, B2 - half open interval (B1, B2] to search eigenvalues in. 4919 4920 Output parameters: 4921 M - number of eigenvalues found in a given half-interval (M>=0). 4922 W - array of the eigenvalues found. 4923 Array whose index ranges within [0..M-1]. 4924 Z - if ZNeeded is equal to: 4925 * 0, Z hasn't changed; 4926 * 1, Z contains eigenvectors. 4927 Array whose indexes range within [0..N-1, 0..M-1]. 4928 The eigenvectors are stored in the matrix columns. 4929 4930 Result: 4931 True, if successful. M contains the number of eigenvalues in the given 4932 half-interval (could be equal to 0), W contains the eigenvalues, 4933 Z contains the eigenvectors (if needed). 4934 4935 False, if the bisection method subroutine wasn't able to find the 4936 eigenvalues in the given interval or if the inverse iteration subroutine 4937 wasn't able to find all the corresponding eigenvectors. 4938 In that case, the eigenvalues and eigenvectors are not returned, 4939 M is equal to 0. 4940 4941 -- ALGLIB -- 4942 Copyright 07.01.2006 by Bochkanov Sergey 4943 *************************************************************************/ 4944 bool smatrixevdr(const real_2d_array &a, const ae_int_t n, const ae_int_t zneeded, const bool isupper, const double b1, const double b2, ae_int_t &m, real_1d_array &w, real_2d_array &z, const xparams _xparams = alglib::xdefault); 4945 4946 4947 /************************************************************************* 4948 Subroutine for finding the eigenvalues and eigenvectors of a symmetric 4949 matrix with given indexes by using bisection and inverse iteration methods. 4950 4951 Input parameters: 4952 A - symmetric matrix which is given by its upper or lower 4953 triangular part. Array whose indexes range within [0..N-1, 0..N-1]. 4954 N - size of matrix A. 4955 ZNeeded - flag controlling whether the eigenvectors are needed or not. 4956 If ZNeeded is equal to: 4957 * 0, the eigenvectors are not returned; 4958 * 1, the eigenvectors are returned. 4959 IsUpperA - storage format of matrix A. 4960 I1, I2 - index interval for searching (from I1 to I2). 4961 0 <= I1 <= I2 <= N-1. 4962 4963 Output parameters: 4964 W - array of the eigenvalues found. 4965 Array whose index ranges within [0..I2-I1]. 4966 Z - if ZNeeded is equal to: 4967 * 0, Z hasn't changed; 4968 * 1, Z contains eigenvectors. 4969 Array whose indexes range within [0..N-1, 0..I2-I1]. 4970 In that case, the eigenvectors are stored in the matrix columns. 4971 4972 Result: 4973 True, if successful. W contains the eigenvalues, Z contains the 4974 eigenvectors (if needed). 4975 4976 False, if the bisection method subroutine wasn't able to find the 4977 eigenvalues in the given interval or if the inverse iteration subroutine 4978 wasn't able to find all the corresponding eigenvectors. 4979 In that case, the eigenvalues and eigenvectors are not returned. 4980 4981 -- ALGLIB -- 4982 Copyright 07.01.2006 by Bochkanov Sergey 4983 *************************************************************************/ 4984 bool smatrixevdi(const real_2d_array &a, const ae_int_t n, const ae_int_t zneeded, const bool isupper, const ae_int_t i1, const ae_int_t i2, real_1d_array &w, real_2d_array &z, const xparams _xparams = alglib::xdefault); 4985 4986 4987 /************************************************************************* 4988 Finding the eigenvalues and eigenvectors of a Hermitian matrix 4989 4990 The algorithm finds eigen pairs of a Hermitian matrix by reducing it to 4991 real tridiagonal form and using the QL/QR algorithm. 4992 4993 ! COMMERCIAL EDITION OF ALGLIB: 4994 ! 4995 ! Commercial Edition of ALGLIB includes following important improvements 4996 ! of this function: 4997 ! * high-performance native backend with same C# interface (C# version) 4998 ! * hardware vendor (Intel) implementations of linear algebra primitives 4999 ! (C++ and C# versions, x86/x64 platform) 5000 ! 5001 ! We recommend you to read 'Working with commercial version' section of 5002 ! ALGLIB Reference Manual in order to find out how to use performance- 5003 ! related features provided by commercial edition of ALGLIB. 5004 5005 Input parameters: 5006 A - Hermitian matrix which is given by its upper or lower 5007 triangular part. 5008 Array whose indexes range within [0..N-1, 0..N-1]. 5009 N - size of matrix A. 5010 IsUpper - storage format. 5011 ZNeeded - flag controlling whether the eigenvectors are needed or 5012 not. If ZNeeded is equal to: 5013 * 0, the eigenvectors are not returned; 5014 * 1, the eigenvectors are returned. 5015 5016 Output parameters: 5017 D - eigenvalues in ascending order. 5018 Array whose index ranges within [0..N-1]. 5019 Z - if ZNeeded is equal to: 5020 * 0, Z hasn't changed; 5021 * 1, Z contains the eigenvectors. 5022 Array whose indexes range within [0..N-1, 0..N-1]. 5023 The eigenvectors are stored in the matrix columns. 5024 5025 Result: 5026 True, if the algorithm has converged. 5027 False, if the algorithm hasn't converged (rare case). 5028 5029 Note: 5030 eigenvectors of Hermitian matrix are defined up to multiplication by 5031 a complex number L, such that |L|=1. 5032 5033 -- ALGLIB -- 5034 Copyright 2005, 23 March 2007 by Bochkanov Sergey 5035 *************************************************************************/ 5036 bool hmatrixevd(const complex_2d_array &a, const ae_int_t n, const ae_int_t zneeded, const bool isupper, real_1d_array &d, complex_2d_array &z, const xparams _xparams = alglib::xdefault); 5037 5038 5039 /************************************************************************* 5040 Subroutine for finding the eigenvalues (and eigenvectors) of a Hermitian 5041 matrix in a given half-interval (A, B] by using a bisection and inverse 5042 iteration 5043 5044 Input parameters: 5045 A - Hermitian matrix which is given by its upper or lower 5046 triangular part. Array whose indexes range within 5047 [0..N-1, 0..N-1]. 5048 N - size of matrix A. 5049 ZNeeded - flag controlling whether the eigenvectors are needed or 5050 not. If ZNeeded is equal to: 5051 * 0, the eigenvectors are not returned; 5052 * 1, the eigenvectors are returned. 5053 IsUpperA - storage format of matrix A. 5054 B1, B2 - half-interval (B1, B2] to search eigenvalues in. 5055 5056 Output parameters: 5057 M - number of eigenvalues found in a given half-interval, M>=0 5058 W - array of the eigenvalues found. 5059 Array whose index ranges within [0..M-1]. 5060 Z - if ZNeeded is equal to: 5061 * 0, Z hasn't changed; 5062 * 1, Z contains eigenvectors. 5063 Array whose indexes range within [0..N-1, 0..M-1]. 5064 The eigenvectors are stored in the matrix columns. 5065 5066 Result: 5067 True, if successful. M contains the number of eigenvalues in the given 5068 half-interval (could be equal to 0), W contains the eigenvalues, 5069 Z contains the eigenvectors (if needed). 5070 5071 False, if the bisection method subroutine wasn't able to find the 5072 eigenvalues in the given interval or if the inverse iteration 5073 subroutine wasn't able to find all the corresponding eigenvectors. 5074 In that case, the eigenvalues and eigenvectors are not returned, M is 5075 equal to 0. 5076 5077 Note: 5078 eigen vectors of Hermitian matrix are defined up to multiplication by 5079 a complex number L, such as |L|=1. 5080 5081 -- ALGLIB -- 5082 Copyright 07.01.2006, 24.03.2007 by Bochkanov Sergey. 5083 *************************************************************************/ 5084 bool hmatrixevdr(const complex_2d_array &a, const ae_int_t n, const ae_int_t zneeded, const bool isupper, const double b1, const double b2, ae_int_t &m, real_1d_array &w, complex_2d_array &z, const xparams _xparams = alglib::xdefault); 5085 5086 5087 /************************************************************************* 5088 Subroutine for finding the eigenvalues and eigenvectors of a Hermitian 5089 matrix with given indexes by using bisection and inverse iteration methods 5090 5091 Input parameters: 5092 A - Hermitian matrix which is given by its upper or lower 5093 triangular part. 5094 Array whose indexes range within [0..N-1, 0..N-1]. 5095 N - size of matrix A. 5096 ZNeeded - flag controlling whether the eigenvectors are needed or 5097 not. If ZNeeded is equal to: 5098 * 0, the eigenvectors are not returned; 5099 * 1, the eigenvectors are returned. 5100 IsUpperA - storage format of matrix A. 5101 I1, I2 - index interval for searching (from I1 to I2). 5102 0 <= I1 <= I2 <= N-1. 5103 5104 Output parameters: 5105 W - array of the eigenvalues found. 5106 Array whose index ranges within [0..I2-I1]. 5107 Z - if ZNeeded is equal to: 5108 * 0, Z hasn't changed; 5109 * 1, Z contains eigenvectors. 5110 Array whose indexes range within [0..N-1, 0..I2-I1]. 5111 In that case, the eigenvectors are stored in the matrix 5112 columns. 5113 5114 Result: 5115 True, if successful. W contains the eigenvalues, Z contains the 5116 eigenvectors (if needed). 5117 5118 False, if the bisection method subroutine wasn't able to find the 5119 eigenvalues in the given interval or if the inverse iteration 5120 subroutine wasn't able to find all the corresponding eigenvectors. 5121 In that case, the eigenvalues and eigenvectors are not returned. 5122 5123 Note: 5124 eigen vectors of Hermitian matrix are defined up to multiplication by 5125 a complex number L, such as |L|=1. 5126 5127 -- ALGLIB -- 5128 Copyright 07.01.2006, 24.03.2007 by Bochkanov Sergey. 5129 *************************************************************************/ 5130 bool hmatrixevdi(const complex_2d_array &a, const ae_int_t n, const ae_int_t zneeded, const bool isupper, const ae_int_t i1, const ae_int_t i2, real_1d_array &w, complex_2d_array &z, const xparams _xparams = alglib::xdefault); 5131 5132 5133 /************************************************************************* 5134 Finding the eigenvalues and eigenvectors of a tridiagonal symmetric matrix 5135 5136 The algorithm finds the eigen pairs of a tridiagonal symmetric matrix by 5137 using an QL/QR algorithm with implicit shifts. 5138 5139 ! COMMERCIAL EDITION OF ALGLIB: 5140 ! 5141 ! Commercial Edition of ALGLIB includes following important improvements 5142 ! of this function: 5143 ! * high-performance native backend with same C# interface (C# version) 5144 ! * hardware vendor (Intel) implementations of linear algebra primitives 5145 ! (C++ and C# versions, x86/x64 platform) 5146 ! 5147 ! We recommend you to read 'Working with commercial version' section of 5148 ! ALGLIB Reference Manual in order to find out how to use performance- 5149 ! related features provided by commercial edition of ALGLIB. 5150 5151 Input parameters: 5152 D - the main diagonal of a tridiagonal matrix. 5153 Array whose index ranges within [0..N-1]. 5154 E - the secondary diagonal of a tridiagonal matrix. 5155 Array whose index ranges within [0..N-2]. 5156 N - size of matrix A. 5157 ZNeeded - flag controlling whether the eigenvectors are needed or not. 5158 If ZNeeded is equal to: 5159 * 0, the eigenvectors are not needed; 5160 * 1, the eigenvectors of a tridiagonal matrix 5161 are multiplied by the square matrix Z. It is used if the 5162 tridiagonal matrix is obtained by the similarity 5163 transformation of a symmetric matrix; 5164 * 2, the eigenvectors of a tridiagonal matrix replace the 5165 square matrix Z; 5166 * 3, matrix Z contains the first row of the eigenvectors 5167 matrix. 5168 Z - if ZNeeded=1, Z contains the square matrix by which the 5169 eigenvectors are multiplied. 5170 Array whose indexes range within [0..N-1, 0..N-1]. 5171 5172 Output parameters: 5173 D - eigenvalues in ascending order. 5174 Array whose index ranges within [0..N-1]. 5175 Z - if ZNeeded is equal to: 5176 * 0, Z hasn't changed; 5177 * 1, Z contains the product of a given matrix (from the left) 5178 and the eigenvectors matrix (from the right); 5179 * 2, Z contains the eigenvectors. 5180 * 3, Z contains the first row of the eigenvectors matrix. 5181 If ZNeeded<3, Z is the array whose indexes range within [0..N-1, 0..N-1]. 5182 In that case, the eigenvectors are stored in the matrix columns. 5183 If ZNeeded=3, Z is the array whose indexes range within [0..0, 0..N-1]. 5184 5185 Result: 5186 True, if the algorithm has converged. 5187 False, if the algorithm hasn't converged. 5188 5189 -- LAPACK routine (version 3.0) -- 5190 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 5191 Courant Institute, Argonne National Lab, and Rice University 5192 September 30, 1994 5193 *************************************************************************/ 5194 bool smatrixtdevd(real_1d_array &d, const real_1d_array &e, const ae_int_t n, const ae_int_t zneeded, real_2d_array &z, const xparams _xparams = alglib::xdefault); 5195 5196 5197 /************************************************************************* 5198 Subroutine for finding the tridiagonal matrix eigenvalues/vectors in a 5199 given half-interval (A, B] by using bisection and inverse iteration. 5200 5201 Input parameters: 5202 D - the main diagonal of a tridiagonal matrix. 5203 Array whose index ranges within [0..N-1]. 5204 E - the secondary diagonal of a tridiagonal matrix. 5205 Array whose index ranges within [0..N-2]. 5206 N - size of matrix, N>=0. 5207 ZNeeded - flag controlling whether the eigenvectors are needed or not. 5208 If ZNeeded is equal to: 5209 * 0, the eigenvectors are not needed; 5210 * 1, the eigenvectors of a tridiagonal matrix are multiplied 5211 by the square matrix Z. It is used if the tridiagonal 5212 matrix is obtained by the similarity transformation 5213 of a symmetric matrix. 5214 * 2, the eigenvectors of a tridiagonal matrix replace matrix Z. 5215 A, B - half-interval (A, B] to search eigenvalues in. 5216 Z - if ZNeeded is equal to: 5217 * 0, Z isn't used and remains unchanged; 5218 * 1, Z contains the square matrix (array whose indexes range 5219 within [0..N-1, 0..N-1]) which reduces the given symmetric 5220 matrix to tridiagonal form; 5221 * 2, Z isn't used (but changed on the exit). 5222 5223 Output parameters: 5224 D - array of the eigenvalues found. 5225 Array whose index ranges within [0..M-1]. 5226 M - number of eigenvalues found in the given half-interval (M>=0). 5227 Z - if ZNeeded is equal to: 5228 * 0, doesn't contain any information; 5229 * 1, contains the product of a given NxN matrix Z (from the 5230 left) and NxM matrix of the eigenvectors found (from the 5231 right). Array whose indexes range within [0..N-1, 0..M-1]. 5232 * 2, contains the matrix of the eigenvectors found. 5233 Array whose indexes range within [0..N-1, 0..M-1]. 5234 5235 Result: 5236 5237 True, if successful. In that case, M contains the number of eigenvalues 5238 in the given half-interval (could be equal to 0), D contains the eigenvalues, 5239 Z contains the eigenvectors (if needed). 5240 It should be noted that the subroutine changes the size of arrays D and Z. 5241 5242 False, if the bisection method subroutine wasn't able to find the 5243 eigenvalues in the given interval or if the inverse iteration subroutine 5244 wasn't able to find all the corresponding eigenvectors. In that case, 5245 the eigenvalues and eigenvectors are not returned, M is equal to 0. 5246 5247 -- ALGLIB -- 5248 Copyright 31.03.2008 by Bochkanov Sergey 5249 *************************************************************************/ 5250 bool smatrixtdevdr(real_1d_array &d, const real_1d_array &e, const ae_int_t n, const ae_int_t zneeded, const double a, const double b, ae_int_t &m, real_2d_array &z, const xparams _xparams = alglib::xdefault); 5251 5252 5253 /************************************************************************* 5254 Subroutine for finding tridiagonal matrix eigenvalues/vectors with given 5255 indexes (in ascending order) by using the bisection and inverse iteraion. 5256 5257 Input parameters: 5258 D - the main diagonal of a tridiagonal matrix. 5259 Array whose index ranges within [0..N-1]. 5260 E - the secondary diagonal of a tridiagonal matrix. 5261 Array whose index ranges within [0..N-2]. 5262 N - size of matrix. N>=0. 5263 ZNeeded - flag controlling whether the eigenvectors are needed or not. 5264 If ZNeeded is equal to: 5265 * 0, the eigenvectors are not needed; 5266 * 1, the eigenvectors of a tridiagonal matrix are multiplied 5267 by the square matrix Z. It is used if the 5268 tridiagonal matrix is obtained by the similarity transformation 5269 of a symmetric matrix. 5270 * 2, the eigenvectors of a tridiagonal matrix replace 5271 matrix Z. 5272 I1, I2 - index interval for searching (from I1 to I2). 5273 0 <= I1 <= I2 <= N-1. 5274 Z - if ZNeeded is equal to: 5275 * 0, Z isn't used and remains unchanged; 5276 * 1, Z contains the square matrix (array whose indexes range within [0..N-1, 0..N-1]) 5277 which reduces the given symmetric matrix to tridiagonal form; 5278 * 2, Z isn't used (but changed on the exit). 5279 5280 Output parameters: 5281 D - array of the eigenvalues found. 5282 Array whose index ranges within [0..I2-I1]. 5283 Z - if ZNeeded is equal to: 5284 * 0, doesn't contain any information; 5285 * 1, contains the product of a given NxN matrix Z (from the left) and 5286 Nx(I2-I1) matrix of the eigenvectors found (from the right). 5287 Array whose indexes range within [0..N-1, 0..I2-I1]. 5288 * 2, contains the matrix of the eigenvalues found. 5289 Array whose indexes range within [0..N-1, 0..I2-I1]. 5290 5291 5292 Result: 5293 5294 True, if successful. In that case, D contains the eigenvalues, 5295 Z contains the eigenvectors (if needed). 5296 It should be noted that the subroutine changes the size of arrays D and Z. 5297 5298 False, if the bisection method subroutine wasn't able to find the eigenvalues 5299 in the given interval or if the inverse iteration subroutine wasn't able 5300 to find all the corresponding eigenvectors. In that case, the eigenvalues 5301 and eigenvectors are not returned. 5302 5303 -- ALGLIB -- 5304 Copyright 25.12.2005 by Bochkanov Sergey 5305 *************************************************************************/ 5306 bool smatrixtdevdi(real_1d_array &d, const real_1d_array &e, const ae_int_t n, const ae_int_t zneeded, const ae_int_t i1, const ae_int_t i2, real_2d_array &z, const xparams _xparams = alglib::xdefault); 5307 5308 5309 /************************************************************************* 5310 Finding eigenvalues and eigenvectors of a general (unsymmetric) matrix 5311 5312 ! COMMERCIAL EDITION OF ALGLIB: 5313 ! 5314 ! Commercial Edition of ALGLIB includes following important improvements 5315 ! of this function: 5316 ! * high-performance native backend with same C# interface (C# version) 5317 ! * hardware vendor (Intel) implementations of linear algebra primitives 5318 ! (C++ and C# versions, x86/x64 platform) 5319 ! 5320 ! We recommend you to read 'Working with commercial version' section of 5321 ! ALGLIB Reference Manual in order to find out how to use performance- 5322 ! related features provided by commercial edition of ALGLIB. 5323 5324 The algorithm finds eigenvalues and eigenvectors of a general matrix by 5325 using the QR algorithm with multiple shifts. The algorithm can find 5326 eigenvalues and both left and right eigenvectors. 5327 5328 The right eigenvector is a vector x such that A*x = w*x, and the left 5329 eigenvector is a vector y such that y'*A = w*y' (here y' implies a complex 5330 conjugate transposition of vector y). 5331 5332 Input parameters: 5333 A - matrix. Array whose indexes range within [0..N-1, 0..N-1]. 5334 N - size of matrix A. 5335 VNeeded - flag controlling whether eigenvectors are needed or not. 5336 If VNeeded is equal to: 5337 * 0, eigenvectors are not returned; 5338 * 1, right eigenvectors are returned; 5339 * 2, left eigenvectors are returned; 5340 * 3, both left and right eigenvectors are returned. 5341 5342 Output parameters: 5343 WR - real parts of eigenvalues. 5344 Array whose index ranges within [0..N-1]. 5345 WR - imaginary parts of eigenvalues. 5346 Array whose index ranges within [0..N-1]. 5347 VL, VR - arrays of left and right eigenvectors (if they are needed). 5348 If WI[i]=0, the respective eigenvalue is a real number, 5349 and it corresponds to the column number I of matrices VL/VR. 5350 If WI[i]>0, we have a pair of complex conjugate numbers with 5351 positive and negative imaginary parts: 5352 the first eigenvalue WR[i] + sqrt(-1)*WI[i]; 5353 the second eigenvalue WR[i+1] + sqrt(-1)*WI[i+1]; 5354 WI[i]>0 5355 WI[i+1] = -WI[i] < 0 5356 In that case, the eigenvector corresponding to the first 5357 eigenvalue is located in i and i+1 columns of matrices 5358 VL/VR (the column number i contains the real part, and the 5359 column number i+1 contains the imaginary part), and the vector 5360 corresponding to the second eigenvalue is a complex conjugate to 5361 the first vector. 5362 Arrays whose indexes range within [0..N-1, 0..N-1]. 5363 5364 Result: 5365 True, if the algorithm has converged. 5366 False, if the algorithm has not converged. 5367 5368 Note 1: 5369 Some users may ask the following question: what if WI[N-1]>0? 5370 WI[N] must contain an eigenvalue which is complex conjugate to the 5371 N-th eigenvalue, but the array has only size N? 5372 The answer is as follows: such a situation cannot occur because the 5373 algorithm finds a pairs of eigenvalues, therefore, if WI[i]>0, I is 5374 strictly less than N-1. 5375 5376 Note 2: 5377 The algorithm performance depends on the value of the internal parameter 5378 NS of the InternalSchurDecomposition subroutine which defines the number 5379 of shifts in the QR algorithm (similarly to the block width in block-matrix 5380 algorithms of linear algebra). If you require maximum performance 5381 on your machine, it is recommended to adjust this parameter manually. 5382 5383 5384 See also the InternalTREVC subroutine. 5385 5386 The algorithm is based on the LAPACK 3.0 library. 5387 *************************************************************************/ 5388 bool rmatrixevd(const real_2d_array &a, const ae_int_t n, const ae_int_t vneeded, real_1d_array &wr, real_1d_array &wi, real_2d_array &vl, real_2d_array &vr, const xparams _xparams = alglib::xdefault); 5389 #endif 5390 5391 #if defined(AE_COMPILE_DLU) || !defined(AE_PARTIAL_BUILD) 5392 5393 #endif 5394 5395 #if defined(AE_COMPILE_SPTRF) || !defined(AE_PARTIAL_BUILD) 5396 5397 #endif 5398 5399 #if defined(AE_COMPILE_AMDORDERING) || !defined(AE_PARTIAL_BUILD) 5400 5401 #endif 5402 5403 #if defined(AE_COMPILE_SPCHOL) || !defined(AE_PARTIAL_BUILD) 5404 5405 #endif 5406 5407 #if defined(AE_COMPILE_TRFAC) || !defined(AE_PARTIAL_BUILD) 5408 /************************************************************************* 5409 LU decomposition of a general real matrix with row pivoting 5410 5411 A is represented as A = P*L*U, where: 5412 * L is lower unitriangular matrix 5413 * U is upper triangular matrix 5414 * P = P0*P1*...*PK, K=min(M,N)-1, 5415 Pi - permutation matrix for I and Pivots[I] 5416 5417 INPUT PARAMETERS: 5418 A - array[0..M-1, 0..N-1]. 5419 M - number of rows in matrix A. 5420 N - number of columns in matrix A. 5421 5422 5423 OUTPUT PARAMETERS: 5424 A - matrices L and U in compact form: 5425 * L is stored under main diagonal 5426 * U is stored on and above main diagonal 5427 Pivots - permutation matrix in compact form. 5428 array[0..Min(M-1,N-1)]. 5429 5430 ! FREE EDITION OF ALGLIB: 5431 ! 5432 ! Free Edition of ALGLIB supports following important features for this 5433 ! function: 5434 ! * C++ version: x64 SIMD support using C++ intrinsics 5435 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 5436 ! 5437 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 5438 ! Reference Manual in order to find out how to activate SIMD support 5439 ! in ALGLIB. 5440 5441 ! COMMERCIAL EDITION OF ALGLIB: 5442 ! 5443 ! Commercial Edition of ALGLIB includes following important improvements 5444 ! of this function: 5445 ! * high-performance native backend with same C# interface (C# version) 5446 ! * multithreading support (C++ and C# versions) 5447 ! * hardware vendor (Intel) implementations of linear algebra primitives 5448 ! (C++ and C# versions, x86/x64 platform) 5449 ! 5450 ! We recommend you to read 'Working with commercial version' section of 5451 ! ALGLIB Reference Manual in order to find out how to use performance- 5452 ! related features provided by commercial edition of ALGLIB. 5453 5454 -- ALGLIB routine -- 5455 10.01.2010 5456 Bochkanov Sergey 5457 *************************************************************************/ 5458 void rmatrixlu(real_2d_array &a, const ae_int_t m, const ae_int_t n, integer_1d_array &pivots, const xparams _xparams = alglib::xdefault); 5459 5460 5461 /************************************************************************* 5462 LU decomposition of a general complex matrix with row pivoting 5463 5464 A is represented as A = P*L*U, where: 5465 * L is lower unitriangular matrix 5466 * U is upper triangular matrix 5467 * P = P0*P1*...*PK, K=min(M,N)-1, 5468 Pi - permutation matrix for I and Pivots[I] 5469 5470 INPUT PARAMETERS: 5471 A - array[0..M-1, 0..N-1]. 5472 M - number of rows in matrix A. 5473 N - number of columns in matrix A. 5474 5475 5476 OUTPUT PARAMETERS: 5477 A - matrices L and U in compact form: 5478 * L is stored under main diagonal 5479 * U is stored on and above main diagonal 5480 Pivots - permutation matrix in compact form. 5481 array[0..Min(M-1,N-1)]. 5482 5483 ! FREE EDITION OF ALGLIB: 5484 ! 5485 ! Free Edition of ALGLIB supports following important features for this 5486 ! function: 5487 ! * C++ version: x64 SIMD support using C++ intrinsics 5488 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 5489 ! 5490 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 5491 ! Reference Manual in order to find out how to activate SIMD support 5492 ! in ALGLIB. 5493 5494 ! COMMERCIAL EDITION OF ALGLIB: 5495 ! 5496 ! Commercial Edition of ALGLIB includes following important improvements 5497 ! of this function: 5498 ! * high-performance native backend with same C# interface (C# version) 5499 ! * multithreading support (C++ and C# versions) 5500 ! * hardware vendor (Intel) implementations of linear algebra primitives 5501 ! (C++ and C# versions, x86/x64 platform) 5502 ! 5503 ! We recommend you to read 'Working with commercial version' section of 5504 ! ALGLIB Reference Manual in order to find out how to use performance- 5505 ! related features provided by commercial edition of ALGLIB. 5506 5507 -- ALGLIB routine -- 5508 10.01.2010 5509 Bochkanov Sergey 5510 *************************************************************************/ 5511 void cmatrixlu(complex_2d_array &a, const ae_int_t m, const ae_int_t n, integer_1d_array &pivots, const xparams _xparams = alglib::xdefault); 5512 5513 5514 /************************************************************************* 5515 Cache-oblivious Cholesky decomposition 5516 5517 The algorithm computes Cholesky decomposition of a Hermitian positive- 5518 definite matrix. The result of an algorithm is a representation of A as 5519 A=U'*U or A=L*L' (here X' denotes conj(X^T)). 5520 5521 INPUT PARAMETERS: 5522 A - upper or lower triangle of a factorized matrix. 5523 array with elements [0..N-1, 0..N-1]. 5524 N - size of matrix A. 5525 IsUpper - if IsUpper=True, then A contains an upper triangle of 5526 a symmetric matrix, otherwise A contains a lower one. 5527 5528 OUTPUT PARAMETERS: 5529 A - the result of factorization. If IsUpper=True, then 5530 the upper triangle contains matrix U, so that A = U'*U, 5531 and the elements below the main diagonal are not modified. 5532 Similarly, if IsUpper = False. 5533 5534 RESULT: 5535 If the matrix is positive-definite, the function returns True. 5536 Otherwise, the function returns False. Contents of A is not determined 5537 in such case. 5538 5539 ! FREE EDITION OF ALGLIB: 5540 ! 5541 ! Free Edition of ALGLIB supports following important features for this 5542 ! function: 5543 ! * C++ version: x64 SIMD support using C++ intrinsics 5544 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 5545 ! 5546 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 5547 ! Reference Manual in order to find out how to activate SIMD support 5548 ! in ALGLIB. 5549 5550 ! COMMERCIAL EDITION OF ALGLIB: 5551 ! 5552 ! Commercial Edition of ALGLIB includes following important improvements 5553 ! of this function: 5554 ! * high-performance native backend with same C# interface (C# version) 5555 ! * multithreading support (C++ and C# versions) 5556 ! * hardware vendor (Intel) implementations of linear algebra primitives 5557 ! (C++ and C# versions, x86/x64 platform) 5558 ! 5559 ! We recommend you to read 'Working with commercial version' section of 5560 ! ALGLIB Reference Manual in order to find out how to use performance- 5561 ! related features provided by commercial edition of ALGLIB. 5562 5563 -- ALGLIB routine -- 5564 15.12.2009-22.01.2018 5565 Bochkanov Sergey 5566 *************************************************************************/ 5567 bool hpdmatrixcholesky(complex_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 5568 5569 5570 /************************************************************************* 5571 Cache-oblivious Cholesky decomposition 5572 5573 The algorithm computes Cholesky decomposition of a symmetric positive- 5574 definite matrix. The result of an algorithm is a representation of A as 5575 A=U^T*U or A=L*L^T 5576 5577 INPUT PARAMETERS: 5578 A - upper or lower triangle of a factorized matrix. 5579 array with elements [0..N-1, 0..N-1]. 5580 N - size of matrix A. 5581 IsUpper - if IsUpper=True, then A contains an upper triangle of 5582 a symmetric matrix, otherwise A contains a lower one. 5583 5584 OUTPUT PARAMETERS: 5585 A - the result of factorization. If IsUpper=True, then 5586 the upper triangle contains matrix U, so that A = U^T*U, 5587 and the elements below the main diagonal are not modified. 5588 Similarly, if IsUpper = False. 5589 5590 RESULT: 5591 If the matrix is positive-definite, the function returns True. 5592 Otherwise, the function returns False. Contents of A is not determined 5593 in such case. 5594 5595 ! FREE EDITION OF ALGLIB: 5596 ! 5597 ! Free Edition of ALGLIB supports following important features for this 5598 ! function: 5599 ! * C++ version: x64 SIMD support using C++ intrinsics 5600 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 5601 ! 5602 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 5603 ! Reference Manual in order to find out how to activate SIMD support 5604 ! in ALGLIB. 5605 5606 ! COMMERCIAL EDITION OF ALGLIB: 5607 ! 5608 ! Commercial Edition of ALGLIB includes following important improvements 5609 ! of this function: 5610 ! * high-performance native backend with same C# interface (C# version) 5611 ! * multithreading support (C++ and C# versions) 5612 ! * hardware vendor (Intel) implementations of linear algebra primitives 5613 ! (C++ and C# versions, x86/x64 platform) 5614 ! 5615 ! We recommend you to read 'Working with commercial version' section of 5616 ! ALGLIB Reference Manual in order to find out how to use performance- 5617 ! related features provided by commercial edition of ALGLIB. 5618 5619 -- ALGLIB routine -- 5620 15.12.2009 5621 Bochkanov Sergey 5622 *************************************************************************/ 5623 bool spdmatrixcholesky(real_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 5624 5625 5626 /************************************************************************* 5627 Update of Cholesky decomposition: rank-1 update to original A. "Buffered" 5628 version which uses preallocated buffer which is saved between subsequent 5629 function calls. 5630 5631 This function uses internally allocated buffer which is not saved between 5632 subsequent calls. So, if you perform a lot of subsequent updates, 5633 we recommend you to use "buffered" version of this function: 5634 SPDMatrixCholeskyUpdateAdd1Buf(). 5635 5636 INPUT PARAMETERS: 5637 A - upper or lower Cholesky factor. 5638 array with elements [0..N-1, 0..N-1]. 5639 Exception is thrown if array size is too small. 5640 N - size of matrix A, N>0 5641 IsUpper - if IsUpper=True, then A contains upper Cholesky factor; 5642 otherwise A contains a lower one. 5643 U - array[N], rank-1 update to A: A_mod = A + u*u' 5644 Exception is thrown if array size is too small. 5645 BufR - possibly preallocated buffer; automatically resized if 5646 needed. It is recommended to reuse this buffer if you 5647 perform a lot of subsequent decompositions. 5648 5649 OUTPUT PARAMETERS: 5650 A - updated factorization. If IsUpper=True, then the upper 5651 triangle contains matrix U, and the elements below the main 5652 diagonal are not modified. Similarly, if IsUpper = False. 5653 5654 NOTE: this function always succeeds, so it does not return completion code 5655 5656 NOTE: this function checks sizes of input arrays, but it does NOT checks 5657 for presence of infinities or NAN's. 5658 5659 -- ALGLIB -- 5660 03.02.2014 5661 Sergey Bochkanov 5662 *************************************************************************/ 5663 void spdmatrixcholeskyupdateadd1(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &u, const xparams _xparams = alglib::xdefault); 5664 5665 5666 /************************************************************************* 5667 Update of Cholesky decomposition: "fixing" some variables. 5668 5669 This function uses internally allocated buffer which is not saved between 5670 subsequent calls. So, if you perform a lot of subsequent updates, 5671 we recommend you to use "buffered" version of this function: 5672 SPDMatrixCholeskyUpdateFixBuf(). 5673 5674 "FIXING" EXPLAINED: 5675 5676 Suppose we have N*N positive definite matrix A. "Fixing" some variable 5677 means filling corresponding row/column of A by zeros, and setting 5678 diagonal element to 1. 5679 5680 For example, if we fix 2nd variable in 4*4 matrix A, it becomes Af: 5681 5682 ( A00 A01 A02 A03 ) ( Af00 0 Af02 Af03 ) 5683 ( A10 A11 A12 A13 ) ( 0 1 0 0 ) 5684 ( A20 A21 A22 A23 ) => ( Af20 0 Af22 Af23 ) 5685 ( A30 A31 A32 A33 ) ( Af30 0 Af32 Af33 ) 5686 5687 If we have Cholesky decomposition of A, it must be recalculated after 5688 variables were fixed. However, it is possible to use efficient 5689 algorithm, which needs O(K*N^2) time to "fix" K variables, given 5690 Cholesky decomposition of original, "unfixed" A. 5691 5692 INPUT PARAMETERS: 5693 A - upper or lower Cholesky factor. 5694 array with elements [0..N-1, 0..N-1]. 5695 Exception is thrown if array size is too small. 5696 N - size of matrix A, N>0 5697 IsUpper - if IsUpper=True, then A contains upper Cholesky factor; 5698 otherwise A contains a lower one. 5699 Fix - array[N], I-th element is True if I-th variable must be 5700 fixed. Exception is thrown if array size is too small. 5701 BufR - possibly preallocated buffer; automatically resized if 5702 needed. It is recommended to reuse this buffer if you 5703 perform a lot of subsequent decompositions. 5704 5705 OUTPUT PARAMETERS: 5706 A - updated factorization. If IsUpper=True, then the upper 5707 triangle contains matrix U, and the elements below the main 5708 diagonal are not modified. Similarly, if IsUpper = False. 5709 5710 NOTE: this function always succeeds, so it does not return completion code 5711 5712 NOTE: this function checks sizes of input arrays, but it does NOT checks 5713 for presence of infinities or NAN's. 5714 5715 NOTE: this function is efficient only for moderate amount of updated 5716 variables - say, 0.1*N or 0.3*N. For larger amount of variables it 5717 will still work, but you may get better performance with 5718 straightforward Cholesky. 5719 5720 -- ALGLIB -- 5721 03.02.2014 5722 Sergey Bochkanov 5723 *************************************************************************/ 5724 void spdmatrixcholeskyupdatefix(const real_2d_array &a, const ae_int_t n, const bool isupper, const boolean_1d_array &fix, const xparams _xparams = alglib::xdefault); 5725 5726 5727 /************************************************************************* 5728 Update of Cholesky decomposition: rank-1 update to original A. "Buffered" 5729 version which uses preallocated buffer which is saved between subsequent 5730 function calls. 5731 5732 See comments for SPDMatrixCholeskyUpdateAdd1() for more information. 5733 5734 INPUT PARAMETERS: 5735 A - upper or lower Cholesky factor. 5736 array with elements [0..N-1, 0..N-1]. 5737 Exception is thrown if array size is too small. 5738 N - size of matrix A, N>0 5739 IsUpper - if IsUpper=True, then A contains upper Cholesky factor; 5740 otherwise A contains a lower one. 5741 U - array[N], rank-1 update to A: A_mod = A + u*u' 5742 Exception is thrown if array size is too small. 5743 BufR - possibly preallocated buffer; automatically resized if 5744 needed. It is recommended to reuse this buffer if you 5745 perform a lot of subsequent decompositions. 5746 5747 OUTPUT PARAMETERS: 5748 A - updated factorization. If IsUpper=True, then the upper 5749 triangle contains matrix U, and the elements below the main 5750 diagonal are not modified. Similarly, if IsUpper = False. 5751 5752 -- ALGLIB -- 5753 03.02.2014 5754 Sergey Bochkanov 5755 *************************************************************************/ 5756 void spdmatrixcholeskyupdateadd1buf(const real_2d_array &a, const ae_int_t n, const bool isupper, const real_1d_array &u, real_1d_array &bufr, const xparams _xparams = alglib::xdefault); 5757 5758 5759 /************************************************************************* 5760 Update of Cholesky decomposition: "fixing" some variables. "Buffered" 5761 version which uses preallocated buffer which is saved between subsequent 5762 function calls. 5763 5764 See comments for SPDMatrixCholeskyUpdateFix() for more information. 5765 5766 INPUT PARAMETERS: 5767 A - upper or lower Cholesky factor. 5768 array with elements [0..N-1, 0..N-1]. 5769 Exception is thrown if array size is too small. 5770 N - size of matrix A, N>0 5771 IsUpper - if IsUpper=True, then A contains upper Cholesky factor; 5772 otherwise A contains a lower one. 5773 Fix - array[N], I-th element is True if I-th variable must be 5774 fixed. Exception is thrown if array size is too small. 5775 BufR - possibly preallocated buffer; automatically resized if 5776 needed. It is recommended to reuse this buffer if you 5777 perform a lot of subsequent decompositions. 5778 5779 OUTPUT PARAMETERS: 5780 A - updated factorization. If IsUpper=True, then the upper 5781 triangle contains matrix U, and the elements below the main 5782 diagonal are not modified. Similarly, if IsUpper = False. 5783 5784 -- ALGLIB -- 5785 03.02.2014 5786 Sergey Bochkanov 5787 *************************************************************************/ 5788 void spdmatrixcholeskyupdatefixbuf(const real_2d_array &a, const ae_int_t n, const bool isupper, const boolean_1d_array &fix, real_1d_array &bufr, const xparams _xparams = alglib::xdefault); 5789 5790 5791 /************************************************************************* 5792 Sparse LU decomposition with column pivoting for sparsity and row pivoting 5793 for stability. Input must be square sparse matrix stored in CRS format. 5794 5795 The algorithm computes LU decomposition of a general square matrix 5796 (rectangular ones are not supported). The result of an algorithm is a 5797 representation of A as A = P*L*U*Q, where: 5798 * L is lower unitriangular matrix 5799 * U is upper triangular matrix 5800 * P = P0*P1*...*PK, K=N-1, Pi - permutation matrix for I and P[I] 5801 * Q = QK*...*Q1*Q0, K=N-1, Qi - permutation matrix for I and Q[I] 5802 5803 This function pivots columns for higher sparsity, and then pivots rows for 5804 stability (larger element at the diagonal). 5805 5806 INPUT PARAMETERS: 5807 A - sparse NxN matrix in CRS format. An exception is generated 5808 if matrix is non-CRS or non-square. 5809 PivotType- pivoting strategy: 5810 * 0 for best pivoting available (2 in current version) 5811 * 1 for row-only pivoting (NOT RECOMMENDED) 5812 * 2 for complete pivoting which produces most sparse outputs 5813 5814 OUTPUT PARAMETERS: 5815 A - the result of factorization, matrices L and U stored in 5816 compact form using CRS sparse storage format: 5817 * lower unitriangular L is stored strictly under main diagonal 5818 * upper triangilar U is stored ON and ABOVE main diagonal 5819 P - row permutation matrix in compact form, array[N] 5820 Q - col permutation matrix in compact form, array[N] 5821 5822 This function always succeeds, i.e. it ALWAYS returns valid factorization, 5823 but for your convenience it also returns boolean value which helps to 5824 detect symbolically degenerate matrices: 5825 * function returns TRUE, if the matrix was factorized AND symbolically 5826 non-degenerate 5827 * function returns FALSE, if the matrix was factorized but U has strictly 5828 zero elements at the diagonal (the factorization is returned anyway). 5829 5830 5831 -- ALGLIB routine -- 5832 03.09.2018 5833 Bochkanov Sergey 5834 *************************************************************************/ 5835 bool sparselu(const sparsematrix &a, const ae_int_t pivottype, integer_1d_array &p, integer_1d_array &q, const xparams _xparams = alglib::xdefault); 5836 5837 5838 /************************************************************************* 5839 Sparse Cholesky decomposition for skyline matrixm using in-place algorithm 5840 without allocating additional storage. 5841 5842 The algorithm computes Cholesky decomposition of a symmetric positive- 5843 definite sparse matrix. The result of an algorithm is a representation of 5844 A as A=U^T*U or A=L*L^T 5845 5846 This function allows to perform very efficient decomposition of low-profile 5847 matrices (average bandwidth is ~5-10 elements). For larger matrices it is 5848 recommended to use supernodal Cholesky decomposition: SparseCholeskyP() or 5849 SparseCholeskyAnalyze()/SparseCholeskyFactorize(). 5850 5851 INPUT PARAMETERS: 5852 A - sparse matrix in skyline storage (SKS) format. 5853 N - size of matrix A (can be smaller than actual size of A) 5854 IsUpper - if IsUpper=True, then factorization is performed on upper 5855 triangle. Another triangle is ignored (it may contant some 5856 data, but it is not changed). 5857 5858 5859 OUTPUT PARAMETERS: 5860 A - the result of factorization, stored in SKS. If IsUpper=True, 5861 then the upper triangle contains matrix U, such that 5862 A = U^T*U. Lower triangle is not changed. 5863 Similarly, if IsUpper = False. In this case L is returned, 5864 and we have A = L*(L^T). 5865 Note that THIS function does not perform permutation of 5866 rows to reduce bandwidth. 5867 5868 RESULT: 5869 If the matrix is positive-definite, the function returns True. 5870 Otherwise, the function returns False. Contents of A is not determined 5871 in such case. 5872 5873 NOTE: for performance reasons this function does NOT check that input 5874 matrix includes only finite values. It is your responsibility to 5875 make sure that there are no infinite or NAN values in the matrix. 5876 5877 -- ALGLIB routine -- 5878 16.01.2014 5879 Bochkanov Sergey 5880 *************************************************************************/ 5881 bool sparsecholeskyskyline(const sparsematrix &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 5882 5883 5884 /************************************************************************* 5885 Sparse Cholesky decomposition for a matrix stored in any sparse storage, 5886 without rows/cols permutation. 5887 5888 This function is the most convenient (less parameters to specify), although 5889 less efficient, version of sparse Cholesky. 5890 5891 Internally it: 5892 * calls SparseCholeskyAnalyze() function to perform symbolic analysis 5893 phase with no permutation being configured. 5894 * calls SparseCholeskyFactorize() function to perform numerical phase of 5895 the factorization 5896 5897 Following alternatives may result in better performance: 5898 * using SparseCholeskyP(), which selects best pivoting available, which 5899 almost always results in improved sparsity and cache locality 5900 * using SparseCholeskyAnalyze() and SparseCholeskyFactorize() functions 5901 directly, which may improve performance of repetitive factorizations 5902 with same sparsity patterns. 5903 5904 The latter also allows one to perform LDLT factorization of indefinite 5905 matrix (one with strictly diagonal D, which is known to be stable only 5906 in few special cases, like quasi-definite matrices). 5907 5908 INPUT PARAMETERS: 5909 A - a square NxN sparse matrix, stored in any storage format. 5910 IsUpper - if IsUpper=True, then factorization is performed on upper 5911 triangle. Another triangle is ignored on input, dropped 5912 on output. Similarly, if IsUpper=False, the lower triangle 5913 is processed. 5914 5915 OUTPUT PARAMETERS: 5916 A - the result of factorization, stored in CRS format: 5917 * if IsUpper=True, then the upper triangle contains matrix 5918 U such that A = U^T*U and the lower triangle is empty. 5919 * similarly, if IsUpper=False, then lower triangular L is 5920 returned and we have A = L*(L^T). 5921 Note that THIS function does not perform permutation of 5922 the rows to reduce fill-in. 5923 5924 RESULT: 5925 If the matrix is positive-definite, the function returns True. 5926 Otherwise, the function returns False. Contents of A is undefined 5927 in such case. 5928 5929 NOTE: for performance reasons this function does NOT check that input 5930 matrix includes only finite values. It is your responsibility to 5931 make sure that there are no infinite or NAN values in the matrix. 5932 5933 -- ALGLIB routine -- 5934 16.09.2020 5935 Bochkanov Sergey 5936 *************************************************************************/ 5937 bool sparsecholesky(const sparsematrix &a, const bool isupper, const xparams _xparams = alglib::xdefault); 5938 5939 5940 /************************************************************************* 5941 Sparse Cholesky decomposition for a matrix stored in any sparse storage 5942 format, with performance-enhancing permutation of rows/cols. 5943 5944 Present version is configured to perform supernodal permutation which 5945 sparsity reducing ordering. 5946 5947 This function is a wrapper around generic sparse decomposition functions 5948 that internally: 5949 * calls SparseCholeskyAnalyze() function to perform symbolic analysis 5950 phase with best available permutation being configured. 5951 * calls SparseCholeskyFactorize() function to perform numerical phase of 5952 the factorization. 5953 5954 NOTE: using SparseCholeskyAnalyze() and SparseCholeskyFactorize() directly 5955 may improve performance of repetitive factorizations with same 5956 sparsity patterns. It also allows one to perform LDLT factorization 5957 of indefinite matrix - a factorization with strictly diagonal D, 5958 which is known to be stable only in few special cases, like quasi- 5959 definite matrices. 5960 5961 INPUT PARAMETERS: 5962 A - a square NxN sparse matrix, stored in any storage format. 5963 IsUpper - if IsUpper=True, then factorization is performed on upper 5964 triangle. Another triangle is ignored on input, dropped 5965 on output. Similarly, if IsUpper=False, the lower triangle 5966 is processed. 5967 5968 OUTPUT PARAMETERS: 5969 A - the result of factorization, stored in CRS format: 5970 * if IsUpper=True, then the upper triangle contains matrix 5971 U such that A = U^T*U and the lower triangle is empty. 5972 * similarly, if IsUpper=False, then lower triangular L is 5973 returned and we have A = L*(L^T). 5974 P - a row/column permutation, a product of P0*P1*...*Pk, k=N-1, 5975 with Pi being permutation of rows/cols I and P[I] 5976 5977 RESULT: 5978 If the matrix is positive-definite, the function returns True. 5979 Otherwise, the function returns False. Contents of A is undefined 5980 in such case. 5981 5982 NOTE: for performance reasons this function does NOT check that input 5983 matrix includes only finite values. It is your responsibility to 5984 make sure that there are no infinite or NAN values in the matrix. 5985 5986 -- ALGLIB routine -- 5987 16.09.2020 5988 Bochkanov Sergey 5989 *************************************************************************/ 5990 bool sparsecholeskyp(const sparsematrix &a, const bool isupper, integer_1d_array &p, const xparams _xparams = alglib::xdefault); 5991 5992 5993 /************************************************************************* 5994 Sparse Cholesky/LDLT decomposition: symbolic analysis phase. 5995 5996 This function is a part of the 'expert' sparse Cholesky API: 5997 * SparseCholeskyAnalyze(), that performs symbolic analysis phase and loads 5998 matrix to be factorized into internal storage 5999 * SparseCholeskySetModType(), that allows to use modified Cholesky/LDLT 6000 with lower bounds on pivot magnitudes and additional overflow safeguards 6001 * SparseCholeskyFactorize(), that performs numeric factorization using 6002 precomputed symbolic analysis and internally stored matrix - and outputs 6003 result 6004 * SparseCholeskyReload(), that reloads one more matrix with same sparsity 6005 pattern into internal storage so one may reuse previously allocated 6006 temporaries and previously performed symbolic analysis 6007 6008 This specific function performs preliminary analysis of the Cholesky/LDLT 6009 factorization. It allows to choose different permutation types and to 6010 choose between classic Cholesky and indefinite LDLT factorization (the 6011 latter is computed with strictly diagonal D, i.e. without Bunch-Kauffman 6012 pivoting). 6013 6014 NOTE: L*D*LT family of factorization may be used to factorize indefinite 6015 matrices. However, numerical stability is guaranteed ONLY for a class 6016 of quasi-definite matrices. 6017 6018 NOTE: all internal processing is performed with lower triangular matrices 6019 stored in CRS format. Any other storage formats and/or upper 6020 triangular storage means that one format conversion and/or one 6021 transposition will be performed internally for the analysis and 6022 factorization phases. Thus, highest performance is achieved when 6023 input is a lower triangular CRS matrix. 6024 6025 INPUT PARAMETERS: 6026 A - sparse square matrix in any sparse storage format. 6027 IsUpper - whether upper or lower triangle is decomposed (the 6028 other one is ignored). 6029 FactType - factorization type: 6030 * 0 for traditional Cholesky of SPD matrix 6031 * 1 for LDLT decomposition with strictly diagonal D, 6032 which may have non-positive entries. 6033 PermType - permutation type: 6034 *-1 for absence of permutation 6035 * 0 for best fill-in reducing permutation available, 6036 which is 3 in the current version 6037 * 1 for supernodal ordering (improves locality and 6038 performance, does NOT change fill-in factor) 6039 * 2 for original AMD ordering 6040 * 3 for improved AMD (approximate minimum degree) 6041 ordering with better handling of matrices with 6042 dense rows/columns 6043 6044 OUTPUT PARAMETERS: 6045 Analysis - contains: 6046 * symbolic analysis of the matrix structure which will 6047 be used later to guide numerical factorization. 6048 * specific numeric values loaded into internal memory 6049 waiting for the factorization to be performed 6050 6051 This function fails if and only if the matrix A is symbolically degenerate 6052 i.e. has diagonal element which is exactly zero. In such case False is 6053 returned, contents of Analysis object is undefined. 6054 6055 -- ALGLIB routine -- 6056 20.09.2020 6057 Bochkanov Sergey 6058 *************************************************************************/ 6059 bool sparsecholeskyanalyze(const sparsematrix &a, const bool isupper, const ae_int_t facttype, const ae_int_t permtype, sparsedecompositionanalysis &analysis, const xparams _xparams = alglib::xdefault); 6060 6061 6062 /************************************************************************* 6063 Sparse Cholesky decomposition: numerical analysis phase. 6064 6065 This function is a part of the 'expert' sparse Cholesky API: 6066 * SparseCholeskyAnalyze(), that performs symbolic analysis phase and loads 6067 matrix to be factorized into internal storage 6068 * SparseCholeskySetModType(), that allows to use modified Cholesky/LDLT 6069 with lower bounds on pivot magnitudes and additional overflow safeguards 6070 * SparseCholeskyFactorize(), that performs numeric factorization using 6071 precomputed symbolic analysis and internally stored matrix - and outputs 6072 result 6073 * SparseCholeskyReload(), that reloads one more matrix with same sparsity 6074 pattern into internal storage so one may reuse previously allocated 6075 temporaries and previously performed symbolic analysis 6076 6077 Depending on settings specified during SparseCholeskyAnalyze() call it may 6078 produce classic Cholesky or L*D*LT decomposition (with strictly diagonal 6079 D), without permutation or with performance-enhancing permutation P. 6080 6081 NOTE: all internal processing is performed with lower triangular matrices 6082 stored in CRS format. Any other storage formats and/or upper 6083 triangular storage means that one format conversion and/or one 6084 transposition will be performed internally for the analysis and 6085 factorization phases. Thus, highest performance is achieved when 6086 input is a lower triangular CRS matrix, and lower triangular output 6087 is requested. 6088 6089 NOTE: L*D*LT family of factorization may be used to factorize indefinite 6090 matrices. However, numerical stability is guaranteed ONLY for a class 6091 of quasi-definite matrices. 6092 6093 INPUT PARAMETERS: 6094 Analysis - prior analysis with internally stored matrix which will 6095 be factorized 6096 NeedUpper - whether upper triangular or lower triangular output is 6097 needed 6098 6099 OUTPUT PARAMETERS: 6100 A - Cholesky decomposition of A stored in lower triangular 6101 CRS format, i.e. A=L*L' (or upper triangular CRS, with 6102 A=U'*U, depending on NeedUpper parameter). 6103 D - array[N], diagonal factor. If no diagonal factor was 6104 required during analysis phase, still returned but 6105 filled with 1's 6106 P - array[N], pivots. Permutation matrix P is a product of 6107 P(0)*P(1)*...*P(N-1), where P(i) is a permutation of 6108 row/col I and P[I] (with P[I]>=I). 6109 If no permutation was requested during analysis phase, 6110 still returned but filled with identity permutation. 6111 6112 The function returns True when factorization resulted in nondegenerate 6113 matrix. False is returned when factorization fails (Cholesky factorization 6114 of indefinite matrix) or LDLT factorization has exactly zero elements at 6115 the diagonal. In the latter case contents of A, D and P is undefined. 6116 6117 The analysis object is not changed during the factorization. Subsequent 6118 calls to SparseCholeskyFactorize() will result in same factorization being 6119 performed one more time. 6120 6121 -- ALGLIB routine -- 6122 20.09.2020 6123 Bochkanov Sergey 6124 *************************************************************************/ 6125 bool sparsecholeskyfactorize(const sparsedecompositionanalysis &analysis, const bool needupper, sparsematrix &a, real_1d_array &d, integer_1d_array &p, const xparams _xparams = alglib::xdefault); 6126 6127 6128 /************************************************************************* 6129 Sparse Cholesky decomposition: update internally stored matrix with 6130 another one with exactly same sparsity pattern. 6131 6132 This function is a part of the 'expert' sparse Cholesky API: 6133 * SparseCholeskyAnalyze(), that performs symbolic analysis phase and loads 6134 matrix to be factorized into internal storage 6135 * SparseCholeskySetModType(), that allows to use modified Cholesky/LDLT 6136 with lower bounds on pivot magnitudes and additional overflow safeguards 6137 * SparseCholeskyFactorize(), that performs numeric factorization using 6138 precomputed symbolic analysis and internally stored matrix - and outputs 6139 result 6140 * SparseCholeskyReload(), that reloads one more matrix with same sparsity 6141 pattern into internal storage so one may reuse previously allocated 6142 temporaries and previously performed symbolic analysis 6143 6144 This specific function replaces internally stored numerical values with 6145 ones from another sparse matrix (but having exactly same sparsity pattern 6146 as one that was used for initial SparseCholeskyAnalyze() call). 6147 6148 NOTE: all internal processing is performed with lower triangular matrices 6149 stored in CRS format. Any other storage formats and/or upper 6150 triangular storage means that one format conversion and/or one 6151 transposition will be performed internally for the analysis and 6152 factorization phases. Thus, highest performance is achieved when 6153 input is a lower triangular CRS matrix. 6154 6155 INPUT PARAMETERS: 6156 Analysis - analysis object 6157 A - sparse square matrix in any sparse storage format. It 6158 MUST have exactly same sparsity pattern as that of the 6159 matrix that was passed to SparseCholeskyAnalyze(). 6160 Any difference (missing elements or additional elements) 6161 may result in unpredictable and undefined behavior - 6162 an algorithm may fail due to memory access violation. 6163 IsUpper - whether upper or lower triangle is decomposed (the 6164 other one is ignored). 6165 6166 OUTPUT PARAMETERS: 6167 Analysis - contains: 6168 * symbolic analysis of the matrix structure which will 6169 be used later to guide numerical factorization. 6170 * specific numeric values loaded into internal memory 6171 waiting for the factorization to be performed 6172 6173 -- ALGLIB routine -- 6174 20.09.2020 6175 Bochkanov Sergey 6176 *************************************************************************/ 6177 void sparsecholeskyreload(const sparsedecompositionanalysis &analysis, const sparsematrix &a, const bool isupper, const xparams _xparams = alglib::xdefault); 6178 #endif 6179 6180 #if defined(AE_COMPILE_BDSVD) || !defined(AE_PARTIAL_BUILD) 6181 /************************************************************************* 6182 Singular value decomposition of a bidiagonal matrix (extended algorithm) 6183 6184 COMMERCIAL EDITION OF ALGLIB: 6185 6186 ! Commercial version of ALGLIB includes one important improvement of 6187 ! this function, which can be used from C++ and C#: 6188 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB) 6189 ! 6190 ! Intel MKL gives approximately constant (with respect to number of 6191 ! worker threads) acceleration factor which depends on CPU being used, 6192 ! problem size and "baseline" ALGLIB edition which is used for 6193 ! comparison. 6194 ! 6195 ! Generally, commercial ALGLIB is several times faster than open-source 6196 ! generic C edition, and many times faster than open-source C# edition. 6197 ! 6198 ! Multithreaded acceleration is NOT supported for this function. 6199 ! 6200 ! We recommend you to read 'Working with commercial version' section of 6201 ! ALGLIB Reference Manual in order to find out how to use performance- 6202 ! related features provided by commercial edition of ALGLIB. 6203 6204 The algorithm performs the singular value decomposition of a bidiagonal 6205 matrix B (upper or lower) representing it as B = Q*S*P^T, where Q and P - 6206 orthogonal matrices, S - diagonal matrix with non-negative elements on the 6207 main diagonal, in descending order. 6208 6209 The algorithm finds singular values. In addition, the algorithm can 6210 calculate matrices Q and P (more precisely, not the matrices, but their 6211 product with given matrices U and VT - U*Q and (P^T)*VT)). Of course, 6212 matrices U and VT can be of any type, including identity. Furthermore, the 6213 algorithm can calculate Q'*C (this product is calculated more effectively 6214 than U*Q, because this calculation operates with rows instead of matrix 6215 columns). 6216 6217 The feature of the algorithm is its ability to find all singular values 6218 including those which are arbitrarily close to 0 with relative accuracy 6219 close to machine precision. If the parameter IsFractionalAccuracyRequired 6220 is set to True, all singular values will have high relative accuracy close 6221 to machine precision. If the parameter is set to False, only the biggest 6222 singular value will have relative accuracy close to machine precision. 6223 The absolute error of other singular values is equal to the absolute error 6224 of the biggest singular value. 6225 6226 Input parameters: 6227 D - main diagonal of matrix B. 6228 Array whose index ranges within [0..N-1]. 6229 E - superdiagonal (or subdiagonal) of matrix B. 6230 Array whose index ranges within [0..N-2]. 6231 N - size of matrix B. 6232 IsUpper - True, if the matrix is upper bidiagonal. 6233 IsFractionalAccuracyRequired - 6234 THIS PARAMETER IS IGNORED SINCE ALGLIB 3.5.0 6235 SINGULAR VALUES ARE ALWAYS SEARCHED WITH HIGH ACCURACY. 6236 U - matrix to be multiplied by Q. 6237 Array whose indexes range within [0..NRU-1, 0..N-1]. 6238 The matrix can be bigger, in that case only the submatrix 6239 [0..NRU-1, 0..N-1] will be multiplied by Q. 6240 NRU - number of rows in matrix U. 6241 C - matrix to be multiplied by Q'. 6242 Array whose indexes range within [0..N-1, 0..NCC-1]. 6243 The matrix can be bigger, in that case only the submatrix 6244 [0..N-1, 0..NCC-1] will be multiplied by Q'. 6245 NCC - number of columns in matrix C. 6246 VT - matrix to be multiplied by P^T. 6247 Array whose indexes range within [0..N-1, 0..NCVT-1]. 6248 The matrix can be bigger, in that case only the submatrix 6249 [0..N-1, 0..NCVT-1] will be multiplied by P^T. 6250 NCVT - number of columns in matrix VT. 6251 6252 Output parameters: 6253 D - singular values of matrix B in descending order. 6254 U - if NRU>0, contains matrix U*Q. 6255 VT - if NCVT>0, contains matrix (P^T)*VT. 6256 C - if NCC>0, contains matrix Q'*C. 6257 6258 Result: 6259 True, if the algorithm has converged. 6260 False, if the algorithm hasn't converged (rare case). 6261 6262 NOTE: multiplication U*Q is performed by means of transposition to internal 6263 buffer, multiplication and backward transposition. It helps to avoid 6264 costly columnwise operations and speed-up algorithm. 6265 6266 Additional information: 6267 The type of convergence is controlled by the internal parameter TOL. 6268 If the parameter is greater than 0, the singular values will have 6269 relative accuracy TOL. If TOL<0, the singular values will have 6270 absolute accuracy ABS(TOL)*norm(B). 6271 By default, |TOL| falls within the range of 10*Epsilon and 100*Epsilon, 6272 where Epsilon is the machine precision. It is not recommended to use 6273 TOL less than 10*Epsilon since this will considerably slow down the 6274 algorithm and may not lead to error decreasing. 6275 6276 History: 6277 * 31 March, 2007. 6278 changed MAXITR from 6 to 12. 6279 6280 -- LAPACK routine (version 3.0) -- 6281 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 6282 Courant Institute, Argonne National Lab, and Rice University 6283 October 31, 1999. 6284 *************************************************************************/ 6285 bool rmatrixbdsvd(real_1d_array &d, const real_1d_array &e, const ae_int_t n, const bool isupper, const bool isfractionalaccuracyrequired, real_2d_array &u, const ae_int_t nru, real_2d_array &c, const ae_int_t ncc, real_2d_array &vt, const ae_int_t ncvt, const xparams _xparams = alglib::xdefault); 6286 #endif 6287 6288 #if defined(AE_COMPILE_SVD) || !defined(AE_PARTIAL_BUILD) 6289 /************************************************************************* 6290 Singular value decomposition of a rectangular matrix. 6291 6292 ! COMMERCIAL EDITION OF ALGLIB: 6293 ! 6294 ! Commercial Edition of ALGLIB includes following important improvements 6295 ! of this function: 6296 ! * high-performance native backend with same C# interface (C# version) 6297 ! * hardware vendor (Intel) implementations of linear algebra primitives 6298 ! (C++ and C# versions, x86/x64 platform) 6299 ! 6300 ! We recommend you to read 'Working with commercial version' section of 6301 ! ALGLIB Reference Manual in order to find out how to use performance- 6302 ! related features provided by commercial edition of ALGLIB. 6303 6304 The algorithm calculates the singular value decomposition of a matrix of 6305 size MxN: A = U * S * V^T 6306 6307 The algorithm finds the singular values and, optionally, matrices U and V^T. 6308 The algorithm can find both first min(M,N) columns of matrix U and rows of 6309 matrix V^T (singular vectors), and matrices U and V^T wholly (of sizes MxM 6310 and NxN respectively). 6311 6312 Take into account that the subroutine does not return matrix V but V^T. 6313 6314 Input parameters: 6315 A - matrix to be decomposed. 6316 Array whose indexes range within [0..M-1, 0..N-1]. 6317 M - number of rows in matrix A. 6318 N - number of columns in matrix A. 6319 UNeeded - 0, 1 or 2. See the description of the parameter U. 6320 VTNeeded - 0, 1 or 2. See the description of the parameter VT. 6321 AdditionalMemory - 6322 If the parameter: 6323 * equals 0, the algorithm doesn't use additional 6324 memory (lower requirements, lower performance). 6325 * equals 1, the algorithm uses additional 6326 memory of size min(M,N)*min(M,N) of real numbers. 6327 It often speeds up the algorithm. 6328 * equals 2, the algorithm uses additional 6329 memory of size M*min(M,N) of real numbers. 6330 It allows to get a maximum performance. 6331 The recommended value of the parameter is 2. 6332 6333 Output parameters: 6334 W - contains singular values in descending order. 6335 U - if UNeeded=0, U isn't changed, the left singular vectors 6336 are not calculated. 6337 if Uneeded=1, U contains left singular vectors (first 6338 min(M,N) columns of matrix U). Array whose indexes range 6339 within [0..M-1, 0..Min(M,N)-1]. 6340 if UNeeded=2, U contains matrix U wholly. Array whose 6341 indexes range within [0..M-1, 0..M-1]. 6342 VT - if VTNeeded=0, VT isn't changed, the right singular vectors 6343 are not calculated. 6344 if VTNeeded=1, VT contains right singular vectors (first 6345 min(M,N) rows of matrix V^T). Array whose indexes range 6346 within [0..min(M,N)-1, 0..N-1]. 6347 if VTNeeded=2, VT contains matrix V^T wholly. Array whose 6348 indexes range within [0..N-1, 0..N-1]. 6349 6350 -- ALGLIB -- 6351 Copyright 2005 by Bochkanov Sergey 6352 *************************************************************************/ 6353 bool rmatrixsvd(const real_2d_array &a, const ae_int_t m, const ae_int_t n, const ae_int_t uneeded, const ae_int_t vtneeded, const ae_int_t additionalmemory, real_1d_array &w, real_2d_array &u, real_2d_array &vt, const xparams _xparams = alglib::xdefault); 6354 #endif 6355 6356 #if defined(AE_COMPILE_RCOND) || !defined(AE_PARTIAL_BUILD) 6357 /************************************************************************* 6358 Estimate of a matrix condition number (1-norm) 6359 6360 The algorithm calculates a lower bound of the condition number. In this case, 6361 the algorithm does not return a lower bound of the condition number, but an 6362 inverse number (to avoid an overflow in case of a singular matrix). 6363 6364 Input parameters: 6365 A - matrix. Array whose indexes range within [0..N-1, 0..N-1]. 6366 N - size of matrix A. 6367 6368 Result: 1/LowerBound(cond(A)) 6369 6370 NOTE: 6371 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6372 0.0 is returned in such cases. 6373 *************************************************************************/ 6374 double rmatrixrcond1(const real_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6375 6376 6377 /************************************************************************* 6378 Estimate of a matrix condition number (infinity-norm). 6379 6380 The algorithm calculates a lower bound of the condition number. In this case, 6381 the algorithm does not return a lower bound of the condition number, but an 6382 inverse number (to avoid an overflow in case of a singular matrix). 6383 6384 Input parameters: 6385 A - matrix. Array whose indexes range within [0..N-1, 0..N-1]. 6386 N - size of matrix A. 6387 6388 Result: 1/LowerBound(cond(A)) 6389 6390 NOTE: 6391 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6392 0.0 is returned in such cases. 6393 *************************************************************************/ 6394 double rmatrixrcondinf(const real_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6395 6396 6397 /************************************************************************* 6398 Condition number estimate of a symmetric positive definite matrix. 6399 6400 The algorithm calculates a lower bound of the condition number. In this case, 6401 the algorithm does not return a lower bound of the condition number, but an 6402 inverse number (to avoid an overflow in case of a singular matrix). 6403 6404 It should be noted that 1-norm and inf-norm of condition numbers of symmetric 6405 matrices are equal, so the algorithm doesn't take into account the 6406 differences between these types of norms. 6407 6408 Input parameters: 6409 A - symmetric positive definite matrix which is given by its 6410 upper or lower triangle depending on the value of 6411 IsUpper. Array with elements [0..N-1, 0..N-1]. 6412 N - size of matrix A. 6413 IsUpper - storage format. 6414 6415 Result: 6416 1/LowerBound(cond(A)), if matrix A is positive definite, 6417 -1, if matrix A is not positive definite, and its condition number 6418 could not be found by this algorithm. 6419 6420 NOTE: 6421 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6422 0.0 is returned in such cases. 6423 *************************************************************************/ 6424 double spdmatrixrcond(const real_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 6425 6426 6427 /************************************************************************* 6428 Triangular matrix: estimate of a condition number (1-norm) 6429 6430 The algorithm calculates a lower bound of the condition number. In this case, 6431 the algorithm does not return a lower bound of the condition number, but an 6432 inverse number (to avoid an overflow in case of a singular matrix). 6433 6434 Input parameters: 6435 A - matrix. Array[0..N-1, 0..N-1]. 6436 N - size of A. 6437 IsUpper - True, if the matrix is upper triangular. 6438 IsUnit - True, if the matrix has a unit diagonal. 6439 6440 Result: 1/LowerBound(cond(A)) 6441 6442 NOTE: 6443 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6444 0.0 is returned in such cases. 6445 *************************************************************************/ 6446 double rmatrixtrrcond1(const real_2d_array &a, const ae_int_t n, const bool isupper, const bool isunit, const xparams _xparams = alglib::xdefault); 6447 6448 6449 /************************************************************************* 6450 Triangular matrix: estimate of a matrix condition number (infinity-norm). 6451 6452 The algorithm calculates a lower bound of the condition number. In this case, 6453 the algorithm does not return a lower bound of the condition number, but an 6454 inverse number (to avoid an overflow in case of a singular matrix). 6455 6456 Input parameters: 6457 A - matrix. Array whose indexes range within [0..N-1, 0..N-1]. 6458 N - size of matrix A. 6459 IsUpper - True, if the matrix is upper triangular. 6460 IsUnit - True, if the matrix has a unit diagonal. 6461 6462 Result: 1/LowerBound(cond(A)) 6463 6464 NOTE: 6465 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6466 0.0 is returned in such cases. 6467 *************************************************************************/ 6468 double rmatrixtrrcondinf(const real_2d_array &a, const ae_int_t n, const bool isupper, const bool isunit, const xparams _xparams = alglib::xdefault); 6469 6470 6471 /************************************************************************* 6472 Condition number estimate of a Hermitian positive definite matrix. 6473 6474 The algorithm calculates a lower bound of the condition number. In this case, 6475 the algorithm does not return a lower bound of the condition number, but an 6476 inverse number (to avoid an overflow in case of a singular matrix). 6477 6478 It should be noted that 1-norm and inf-norm of condition numbers of symmetric 6479 matrices are equal, so the algorithm doesn't take into account the 6480 differences between these types of norms. 6481 6482 Input parameters: 6483 A - Hermitian positive definite matrix which is given by its 6484 upper or lower triangle depending on the value of 6485 IsUpper. Array with elements [0..N-1, 0..N-1]. 6486 N - size of matrix A. 6487 IsUpper - storage format. 6488 6489 Result: 6490 1/LowerBound(cond(A)), if matrix A is positive definite, 6491 -1, if matrix A is not positive definite, and its condition number 6492 could not be found by this algorithm. 6493 6494 NOTE: 6495 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6496 0.0 is returned in such cases. 6497 *************************************************************************/ 6498 double hpdmatrixrcond(const complex_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 6499 6500 6501 /************************************************************************* 6502 Estimate of a matrix condition number (1-norm) 6503 6504 The algorithm calculates a lower bound of the condition number. In this case, 6505 the algorithm does not return a lower bound of the condition number, but an 6506 inverse number (to avoid an overflow in case of a singular matrix). 6507 6508 Input parameters: 6509 A - matrix. Array whose indexes range within [0..N-1, 0..N-1]. 6510 N - size of matrix A. 6511 6512 Result: 1/LowerBound(cond(A)) 6513 6514 NOTE: 6515 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6516 0.0 is returned in such cases. 6517 *************************************************************************/ 6518 double cmatrixrcond1(const complex_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6519 6520 6521 /************************************************************************* 6522 Estimate of a matrix condition number (infinity-norm). 6523 6524 The algorithm calculates a lower bound of the condition number. In this case, 6525 the algorithm does not return a lower bound of the condition number, but an 6526 inverse number (to avoid an overflow in case of a singular matrix). 6527 6528 Input parameters: 6529 A - matrix. Array whose indexes range within [0..N-1, 0..N-1]. 6530 N - size of matrix A. 6531 6532 Result: 1/LowerBound(cond(A)) 6533 6534 NOTE: 6535 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6536 0.0 is returned in such cases. 6537 *************************************************************************/ 6538 double cmatrixrcondinf(const complex_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6539 6540 6541 /************************************************************************* 6542 Estimate of the condition number of a matrix given by its LU decomposition (1-norm) 6543 6544 The algorithm calculates a lower bound of the condition number. In this case, 6545 the algorithm does not return a lower bound of the condition number, but an 6546 inverse number (to avoid an overflow in case of a singular matrix). 6547 6548 Input parameters: 6549 LUA - LU decomposition of a matrix in compact form. Output of 6550 the RMatrixLU subroutine. 6551 N - size of matrix A. 6552 6553 Result: 1/LowerBound(cond(A)) 6554 6555 NOTE: 6556 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6557 0.0 is returned in such cases. 6558 *************************************************************************/ 6559 double rmatrixlurcond1(const real_2d_array &lua, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6560 6561 6562 /************************************************************************* 6563 Estimate of the condition number of a matrix given by its LU decomposition 6564 (infinity norm). 6565 6566 The algorithm calculates a lower bound of the condition number. In this case, 6567 the algorithm does not return a lower bound of the condition number, but an 6568 inverse number (to avoid an overflow in case of a singular matrix). 6569 6570 Input parameters: 6571 LUA - LU decomposition of a matrix in compact form. Output of 6572 the RMatrixLU subroutine. 6573 N - size of matrix A. 6574 6575 Result: 1/LowerBound(cond(A)) 6576 6577 NOTE: 6578 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6579 0.0 is returned in such cases. 6580 *************************************************************************/ 6581 double rmatrixlurcondinf(const real_2d_array &lua, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6582 6583 6584 /************************************************************************* 6585 Condition number estimate of a symmetric positive definite matrix given by 6586 Cholesky decomposition. 6587 6588 The algorithm calculates a lower bound of the condition number. In this 6589 case, the algorithm does not return a lower bound of the condition number, 6590 but an inverse number (to avoid an overflow in case of a singular matrix). 6591 6592 It should be noted that 1-norm and inf-norm condition numbers of symmetric 6593 matrices are equal, so the algorithm doesn't take into account the 6594 differences between these types of norms. 6595 6596 Input parameters: 6597 CD - Cholesky decomposition of matrix A, 6598 output of SMatrixCholesky subroutine. 6599 N - size of matrix A. 6600 6601 Result: 1/LowerBound(cond(A)) 6602 6603 NOTE: 6604 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6605 0.0 is returned in such cases. 6606 *************************************************************************/ 6607 double spdmatrixcholeskyrcond(const real_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 6608 6609 6610 /************************************************************************* 6611 Condition number estimate of a Hermitian positive definite matrix given by 6612 Cholesky decomposition. 6613 6614 The algorithm calculates a lower bound of the condition number. In this 6615 case, the algorithm does not return a lower bound of the condition number, 6616 but an inverse number (to avoid an overflow in case of a singular matrix). 6617 6618 It should be noted that 1-norm and inf-norm condition numbers of symmetric 6619 matrices are equal, so the algorithm doesn't take into account the 6620 differences between these types of norms. 6621 6622 Input parameters: 6623 CD - Cholesky decomposition of matrix A, 6624 output of SMatrixCholesky subroutine. 6625 N - size of matrix A. 6626 6627 Result: 1/LowerBound(cond(A)) 6628 6629 NOTE: 6630 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6631 0.0 is returned in such cases. 6632 *************************************************************************/ 6633 double hpdmatrixcholeskyrcond(const complex_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 6634 6635 6636 /************************************************************************* 6637 Estimate of the condition number of a matrix given by its LU decomposition (1-norm) 6638 6639 The algorithm calculates a lower bound of the condition number. In this case, 6640 the algorithm does not return a lower bound of the condition number, but an 6641 inverse number (to avoid an overflow in case of a singular matrix). 6642 6643 Input parameters: 6644 LUA - LU decomposition of a matrix in compact form. Output of 6645 the CMatrixLU subroutine. 6646 N - size of matrix A. 6647 6648 Result: 1/LowerBound(cond(A)) 6649 6650 NOTE: 6651 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6652 0.0 is returned in such cases. 6653 *************************************************************************/ 6654 double cmatrixlurcond1(const complex_2d_array &lua, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6655 6656 6657 /************************************************************************* 6658 Estimate of the condition number of a matrix given by its LU decomposition 6659 (infinity norm). 6660 6661 The algorithm calculates a lower bound of the condition number. In this case, 6662 the algorithm does not return a lower bound of the condition number, but an 6663 inverse number (to avoid an overflow in case of a singular matrix). 6664 6665 Input parameters: 6666 LUA - LU decomposition of a matrix in compact form. Output of 6667 the CMatrixLU subroutine. 6668 N - size of matrix A. 6669 6670 Result: 1/LowerBound(cond(A)) 6671 6672 NOTE: 6673 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6674 0.0 is returned in such cases. 6675 *************************************************************************/ 6676 double cmatrixlurcondinf(const complex_2d_array &lua, const ae_int_t n, const xparams _xparams = alglib::xdefault); 6677 6678 6679 /************************************************************************* 6680 Triangular matrix: estimate of a condition number (1-norm) 6681 6682 The algorithm calculates a lower bound of the condition number. In this case, 6683 the algorithm does not return a lower bound of the condition number, but an 6684 inverse number (to avoid an overflow in case of a singular matrix). 6685 6686 Input parameters: 6687 A - matrix. Array[0..N-1, 0..N-1]. 6688 N - size of A. 6689 IsUpper - True, if the matrix is upper triangular. 6690 IsUnit - True, if the matrix has a unit diagonal. 6691 6692 Result: 1/LowerBound(cond(A)) 6693 6694 NOTE: 6695 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6696 0.0 is returned in such cases. 6697 *************************************************************************/ 6698 double cmatrixtrrcond1(const complex_2d_array &a, const ae_int_t n, const bool isupper, const bool isunit, const xparams _xparams = alglib::xdefault); 6699 6700 6701 /************************************************************************* 6702 Triangular matrix: estimate of a matrix condition number (infinity-norm). 6703 6704 The algorithm calculates a lower bound of the condition number. In this case, 6705 the algorithm does not return a lower bound of the condition number, but an 6706 inverse number (to avoid an overflow in case of a singular matrix). 6707 6708 Input parameters: 6709 A - matrix. Array whose indexes range within [0..N-1, 0..N-1]. 6710 N - size of matrix A. 6711 IsUpper - True, if the matrix is upper triangular. 6712 IsUnit - True, if the matrix has a unit diagonal. 6713 6714 Result: 1/LowerBound(cond(A)) 6715 6716 NOTE: 6717 if k(A) is very large, then matrix is assumed degenerate, k(A)=INF, 6718 0.0 is returned in such cases. 6719 *************************************************************************/ 6720 double cmatrixtrrcondinf(const complex_2d_array &a, const ae_int_t n, const bool isupper, const bool isunit, const xparams _xparams = alglib::xdefault); 6721 #endif 6722 6723 #if defined(AE_COMPILE_FBLS) || !defined(AE_PARTIAL_BUILD) 6724 6725 #endif 6726 6727 #if defined(AE_COMPILE_NORMESTIMATOR) || !defined(AE_PARTIAL_BUILD) 6728 /************************************************************************* 6729 This procedure initializes matrix norm estimator. 6730 6731 USAGE: 6732 1. User initializes algorithm state with NormEstimatorCreate() call 6733 2. User calls NormEstimatorEstimateSparse() (or NormEstimatorIteration()) 6734 3. User calls NormEstimatorResults() to get solution. 6735 6736 INPUT PARAMETERS: 6737 M - number of rows in the matrix being estimated, M>0 6738 N - number of columns in the matrix being estimated, N>0 6739 NStart - number of random starting vectors 6740 recommended value - at least 5. 6741 NIts - number of iterations to do with best starting vector 6742 recommended value - at least 5. 6743 6744 OUTPUT PARAMETERS: 6745 State - structure which stores algorithm state 6746 6747 6748 NOTE: this algorithm is effectively deterministic, i.e. it always returns 6749 same result when repeatedly called for the same matrix. In fact, algorithm 6750 uses randomized starting vectors, but internal random numbers generator 6751 always generates same sequence of the random values (it is a feature, not 6752 bug). 6753 6754 Algorithm can be made non-deterministic with NormEstimatorSetSeed(0) call. 6755 6756 -- ALGLIB -- 6757 Copyright 06.12.2011 by Bochkanov Sergey 6758 *************************************************************************/ 6759 void normestimatorcreate(const ae_int_t m, const ae_int_t n, const ae_int_t nstart, const ae_int_t nits, normestimatorstate &state, const xparams _xparams = alglib::xdefault); 6760 6761 6762 /************************************************************************* 6763 This function changes seed value used by algorithm. In some cases we need 6764 deterministic processing, i.e. subsequent calls must return equal results, 6765 in other cases we need non-deterministic algorithm which returns different 6766 results for the same matrix on every pass. 6767 6768 Setting zero seed will lead to non-deterministic algorithm, while non-zero 6769 value will make our algorithm deterministic. 6770 6771 INPUT PARAMETERS: 6772 State - norm estimator state, must be initialized with a call 6773 to NormEstimatorCreate() 6774 SeedVal - seed value, >=0. Zero value = non-deterministic algo. 6775 6776 -- ALGLIB -- 6777 Copyright 06.12.2011 by Bochkanov Sergey 6778 *************************************************************************/ 6779 void normestimatorsetseed(const normestimatorstate &state, const ae_int_t seedval, const xparams _xparams = alglib::xdefault); 6780 6781 6782 /************************************************************************* 6783 This function estimates norm of the sparse M*N matrix A. 6784 6785 INPUT PARAMETERS: 6786 State - norm estimator state, must be initialized with a call 6787 to NormEstimatorCreate() 6788 A - sparse M*N matrix, must be converted to CRS format 6789 prior to calling this function. 6790 6791 After this function is over you can call NormEstimatorResults() to get 6792 estimate of the norm(A). 6793 6794 -- ALGLIB -- 6795 Copyright 06.12.2011 by Bochkanov Sergey 6796 *************************************************************************/ 6797 void normestimatorestimatesparse(const normestimatorstate &state, const sparsematrix &a, const xparams _xparams = alglib::xdefault); 6798 6799 6800 /************************************************************************* 6801 Matrix norm estimation results 6802 6803 INPUT PARAMETERS: 6804 State - algorithm state 6805 6806 OUTPUT PARAMETERS: 6807 Nrm - estimate of the matrix norm, Nrm>=0 6808 6809 -- ALGLIB -- 6810 Copyright 06.12.2011 by Bochkanov Sergey 6811 *************************************************************************/ 6812 void normestimatorresults(const normestimatorstate &state, double &nrm, const xparams _xparams = alglib::xdefault); 6813 #endif 6814 6815 #if defined(AE_COMPILE_MATINV) || !defined(AE_PARTIAL_BUILD) 6816 /************************************************************************* 6817 Inversion of a matrix given by its LU decomposition. 6818 6819 INPUT PARAMETERS: 6820 A - LU decomposition of the matrix 6821 (output of RMatrixLU subroutine). 6822 Pivots - table of permutations 6823 (the output of RMatrixLU subroutine). 6824 N - size of matrix A (optional) : 6825 * if given, only principal NxN submatrix is processed and 6826 overwritten. other elements are unchanged. 6827 * if not given, size is automatically determined from 6828 matrix size (A must be square matrix) 6829 6830 OUTPUT PARAMETERS: 6831 Info - return code: 6832 * -3 A is singular, or VERY close to singular. 6833 it is filled by zeros in such cases. 6834 * 1 task is solved (but matrix A may be ill-conditioned, 6835 check R1/RInf parameters for condition numbers). 6836 Rep - solver report, see below for more info 6837 A - inverse of matrix A. 6838 Array whose indexes range within [0..N-1, 0..N-1]. 6839 6840 SOLVER REPORT 6841 6842 Subroutine sets following fields of the Rep structure: 6843 * R1 reciprocal of condition number: 1/cond(A), 1-norm. 6844 * RInf reciprocal of condition number: 1/cond(A), inf-norm. 6845 6846 ! FREE EDITION OF ALGLIB: 6847 ! 6848 ! Free Edition of ALGLIB supports following important features for this 6849 ! function: 6850 ! * C++ version: x64 SIMD support using C++ intrinsics 6851 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 6852 ! 6853 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 6854 ! Reference Manual in order to find out how to activate SIMD support 6855 ! in ALGLIB. 6856 6857 ! COMMERCIAL EDITION OF ALGLIB: 6858 ! 6859 ! Commercial Edition of ALGLIB includes following important improvements 6860 ! of this function: 6861 ! * high-performance native backend with same C# interface (C# version) 6862 ! * multithreading support (C++ and C# versions) 6863 ! * hardware vendor (Intel) implementations of linear algebra primitives 6864 ! (C++ and C# versions, x86/x64 platform) 6865 ! 6866 ! We recommend you to read 'Working with commercial version' section of 6867 ! ALGLIB Reference Manual in order to find out how to use performance- 6868 ! related features provided by commercial edition of ALGLIB. 6869 6870 -- ALGLIB routine -- 6871 05.02.2010 6872 Bochkanov Sergey 6873 *************************************************************************/ 6874 void rmatrixluinverse(real_2d_array &a, const integer_1d_array &pivots, const ae_int_t n, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 6875 void rmatrixluinverse(real_2d_array &a, const integer_1d_array &pivots, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 6876 6877 6878 /************************************************************************* 6879 Inversion of a general matrix. 6880 6881 Input parameters: 6882 A - matrix. 6883 N - size of matrix A (optional) : 6884 * if given, only principal NxN submatrix is processed and 6885 overwritten. other elements are unchanged. 6886 * if not given, size is automatically determined from 6887 matrix size (A must be square matrix) 6888 6889 Output parameters: 6890 Info - return code, same as in RMatrixLUInverse 6891 Rep - solver report, same as in RMatrixLUInverse 6892 A - inverse of matrix A, same as in RMatrixLUInverse 6893 6894 Result: 6895 True, if the matrix is not singular. 6896 False, if the matrix is singular. 6897 6898 ! FREE EDITION OF ALGLIB: 6899 ! 6900 ! Free Edition of ALGLIB supports following important features for this 6901 ! function: 6902 ! * C++ version: x64 SIMD support using C++ intrinsics 6903 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 6904 ! 6905 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 6906 ! Reference Manual in order to find out how to activate SIMD support 6907 ! in ALGLIB. 6908 6909 ! COMMERCIAL EDITION OF ALGLIB: 6910 ! 6911 ! Commercial Edition of ALGLIB includes following important improvements 6912 ! of this function: 6913 ! * high-performance native backend with same C# interface (C# version) 6914 ! * multithreading support (C++ and C# versions) 6915 ! * hardware vendor (Intel) implementations of linear algebra primitives 6916 ! (C++ and C# versions, x86/x64 platform) 6917 ! 6918 ! We recommend you to read 'Working with commercial version' section of 6919 ! ALGLIB Reference Manual in order to find out how to use performance- 6920 ! related features provided by commercial edition of ALGLIB. 6921 6922 -- ALGLIB -- 6923 Copyright 2005-2010 by Bochkanov Sergey 6924 *************************************************************************/ 6925 void rmatrixinverse(real_2d_array &a, const ae_int_t n, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 6926 void rmatrixinverse(real_2d_array &a, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 6927 6928 6929 /************************************************************************* 6930 Inversion of a matrix given by its LU decomposition. 6931 6932 INPUT PARAMETERS: 6933 A - LU decomposition of the matrix 6934 (output of CMatrixLU subroutine). 6935 Pivots - table of permutations 6936 (the output of CMatrixLU subroutine). 6937 N - size of matrix A (optional) : 6938 * if given, only principal NxN submatrix is processed and 6939 overwritten. other elements are unchanged. 6940 * if not given, size is automatically determined from 6941 matrix size (A must be square matrix) 6942 6943 OUTPUT PARAMETERS: 6944 Info - return code, same as in RMatrixLUInverse 6945 Rep - solver report, same as in RMatrixLUInverse 6946 A - inverse of matrix A, same as in RMatrixLUInverse 6947 6948 ! FREE EDITION OF ALGLIB: 6949 ! 6950 ! Free Edition of ALGLIB supports following important features for this 6951 ! function: 6952 ! * C++ version: x64 SIMD support using C++ intrinsics 6953 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 6954 ! 6955 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 6956 ! Reference Manual in order to find out how to activate SIMD support 6957 ! in ALGLIB. 6958 6959 ! COMMERCIAL EDITION OF ALGLIB: 6960 ! 6961 ! Commercial Edition of ALGLIB includes following important improvements 6962 ! of this function: 6963 ! * high-performance native backend with same C# interface (C# version) 6964 ! * multithreading support (C++ and C# versions) 6965 ! * hardware vendor (Intel) implementations of linear algebra primitives 6966 ! (C++ and C# versions, x86/x64 platform) 6967 ! 6968 ! We recommend you to read 'Working with commercial version' section of 6969 ! ALGLIB Reference Manual in order to find out how to use performance- 6970 ! related features provided by commercial edition of ALGLIB. 6971 6972 -- ALGLIB routine -- 6973 05.02.2010 6974 Bochkanov Sergey 6975 *************************************************************************/ 6976 void cmatrixluinverse(complex_2d_array &a, const integer_1d_array &pivots, const ae_int_t n, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 6977 void cmatrixluinverse(complex_2d_array &a, const integer_1d_array &pivots, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 6978 6979 6980 /************************************************************************* 6981 Inversion of a general matrix. 6982 6983 Input parameters: 6984 A - matrix 6985 N - size of matrix A (optional) : 6986 * if given, only principal NxN submatrix is processed and 6987 overwritten. other elements are unchanged. 6988 * if not given, size is automatically determined from 6989 matrix size (A must be square matrix) 6990 6991 Output parameters: 6992 Info - return code, same as in RMatrixLUInverse 6993 Rep - solver report, same as in RMatrixLUInverse 6994 A - inverse of matrix A, same as in RMatrixLUInverse 6995 6996 ! FREE EDITION OF ALGLIB: 6997 ! 6998 ! Free Edition of ALGLIB supports following important features for this 6999 ! function: 7000 ! * C++ version: x64 SIMD support using C++ intrinsics 7001 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 7002 ! 7003 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 7004 ! Reference Manual in order to find out how to activate SIMD support 7005 ! in ALGLIB. 7006 7007 ! COMMERCIAL EDITION OF ALGLIB: 7008 ! 7009 ! Commercial Edition of ALGLIB includes following important improvements 7010 ! of this function: 7011 ! * high-performance native backend with same C# interface (C# version) 7012 ! * multithreading support (C++ and C# versions) 7013 ! * hardware vendor (Intel) implementations of linear algebra primitives 7014 ! (C++ and C# versions, x86/x64 platform) 7015 ! 7016 ! We recommend you to read 'Working with commercial version' section of 7017 ! ALGLIB Reference Manual in order to find out how to use performance- 7018 ! related features provided by commercial edition of ALGLIB. 7019 7020 -- ALGLIB -- 7021 Copyright 2005 by Bochkanov Sergey 7022 *************************************************************************/ 7023 void cmatrixinverse(complex_2d_array &a, const ae_int_t n, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7024 void cmatrixinverse(complex_2d_array &a, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7025 7026 7027 /************************************************************************* 7028 Inversion of a symmetric positive definite matrix which is given 7029 by Cholesky decomposition. 7030 7031 Input parameters: 7032 A - Cholesky decomposition of the matrix to be inverted: 7033 A=U'*U or A = L*L'. 7034 Output of SPDMatrixCholesky subroutine. 7035 N - size of matrix A (optional) : 7036 * if given, only principal NxN submatrix is processed and 7037 overwritten. other elements are unchanged. 7038 * if not given, size is automatically determined from 7039 matrix size (A must be square matrix) 7040 IsUpper - storage type (optional): 7041 * if True, symmetric matrix A is given by its upper 7042 triangle, and the lower triangle isn't used/changed by 7043 function 7044 * if False, symmetric matrix A is given by its lower 7045 triangle, and the upper triangle isn't used/changed by 7046 function 7047 * if not given, lower half is used. 7048 7049 Output parameters: 7050 Info - return code, same as in RMatrixLUInverse 7051 Rep - solver report, same as in RMatrixLUInverse 7052 A - inverse of matrix A, same as in RMatrixLUInverse 7053 7054 ! FREE EDITION OF ALGLIB: 7055 ! 7056 ! Free Edition of ALGLIB supports following important features for this 7057 ! function: 7058 ! * C++ version: x64 SIMD support using C++ intrinsics 7059 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 7060 ! 7061 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 7062 ! Reference Manual in order to find out how to activate SIMD support 7063 ! in ALGLIB. 7064 7065 ! COMMERCIAL EDITION OF ALGLIB: 7066 ! 7067 ! Commercial Edition of ALGLIB includes following important improvements 7068 ! of this function: 7069 ! * high-performance native backend with same C# interface (C# version) 7070 ! * multithreading support (C++ and C# versions) 7071 ! * hardware vendor (Intel) implementations of linear algebra primitives 7072 ! (C++ and C# versions, x86/x64 platform) 7073 ! 7074 ! We recommend you to read 'Working with commercial version' section of 7075 ! ALGLIB Reference Manual in order to find out how to use performance- 7076 ! related features provided by commercial edition of ALGLIB. 7077 7078 -- ALGLIB routine -- 7079 10.02.2010 7080 Bochkanov Sergey 7081 *************************************************************************/ 7082 void spdmatrixcholeskyinverse(real_2d_array &a, const ae_int_t n, const bool isupper, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7083 void spdmatrixcholeskyinverse(real_2d_array &a, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7084 7085 7086 /************************************************************************* 7087 Inversion of a symmetric positive definite matrix. 7088 7089 Given an upper or lower triangle of a symmetric positive definite matrix, 7090 the algorithm generates matrix A^-1 and saves the upper or lower triangle 7091 depending on the input. 7092 7093 Input parameters: 7094 A - matrix to be inverted (upper or lower triangle). 7095 Array with elements [0..N-1,0..N-1]. 7096 N - size of matrix A (optional) : 7097 * if given, only principal NxN submatrix is processed and 7098 overwritten. other elements are unchanged. 7099 * if not given, size is automatically determined from 7100 matrix size (A must be square matrix) 7101 IsUpper - storage type (optional): 7102 * if True, symmetric matrix A is given by its upper 7103 triangle, and the lower triangle isn't used/changed by 7104 function 7105 * if False, symmetric matrix A is given by its lower 7106 triangle, and the upper triangle isn't used/changed by 7107 function 7108 * if not given, both lower and upper triangles must be 7109 filled. 7110 7111 Output parameters: 7112 Info - return code, same as in RMatrixLUInverse 7113 Rep - solver report, same as in RMatrixLUInverse 7114 A - inverse of matrix A, same as in RMatrixLUInverse 7115 7116 ! FREE EDITION OF ALGLIB: 7117 ! 7118 ! Free Edition of ALGLIB supports following important features for this 7119 ! function: 7120 ! * C++ version: x64 SIMD support using C++ intrinsics 7121 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 7122 ! 7123 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 7124 ! Reference Manual in order to find out how to activate SIMD support 7125 ! in ALGLIB. 7126 7127 ! COMMERCIAL EDITION OF ALGLIB: 7128 ! 7129 ! Commercial Edition of ALGLIB includes following important improvements 7130 ! of this function: 7131 ! * high-performance native backend with same C# interface (C# version) 7132 ! * multithreading support (C++ and C# versions) 7133 ! * hardware vendor (Intel) implementations of linear algebra primitives 7134 ! (C++ and C# versions, x86/x64 platform) 7135 ! 7136 ! We recommend you to read 'Working with commercial version' section of 7137 ! ALGLIB Reference Manual in order to find out how to use performance- 7138 ! related features provided by commercial edition of ALGLIB. 7139 7140 -- ALGLIB routine -- 7141 10.02.2010 7142 Bochkanov Sergey 7143 *************************************************************************/ 7144 void spdmatrixinverse(real_2d_array &a, const ae_int_t n, const bool isupper, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7145 void spdmatrixinverse(real_2d_array &a, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7146 7147 7148 /************************************************************************* 7149 Inversion of a Hermitian positive definite matrix which is given 7150 by Cholesky decomposition. 7151 7152 Input parameters: 7153 A - Cholesky decomposition of the matrix to be inverted: 7154 A=U'*U or A = L*L'. 7155 Output of HPDMatrixCholesky subroutine. 7156 N - size of matrix A (optional) : 7157 * if given, only principal NxN submatrix is processed and 7158 overwritten. other elements are unchanged. 7159 * if not given, size is automatically determined from 7160 matrix size (A must be square matrix) 7161 IsUpper - storage type (optional): 7162 * if True, symmetric matrix A is given by its upper 7163 triangle, and the lower triangle isn't used/changed by 7164 function 7165 * if False, symmetric matrix A is given by its lower 7166 triangle, and the upper triangle isn't used/changed by 7167 function 7168 * if not given, lower half is used. 7169 7170 Output parameters: 7171 Info - return code, same as in RMatrixLUInverse 7172 Rep - solver report, same as in RMatrixLUInverse 7173 A - inverse of matrix A, same as in RMatrixLUInverse 7174 7175 ! FREE EDITION OF ALGLIB: 7176 ! 7177 ! Free Edition of ALGLIB supports following important features for this 7178 ! function: 7179 ! * C++ version: x64 SIMD support using C++ intrinsics 7180 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 7181 ! 7182 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 7183 ! Reference Manual in order to find out how to activate SIMD support 7184 ! in ALGLIB. 7185 7186 ! COMMERCIAL EDITION OF ALGLIB: 7187 ! 7188 ! Commercial Edition of ALGLIB includes following important improvements 7189 ! of this function: 7190 ! * high-performance native backend with same C# interface (C# version) 7191 ! * multithreading support (C++ and C# versions) 7192 ! * hardware vendor (Intel) implementations of linear algebra primitives 7193 ! (C++ and C# versions, x86/x64 platform) 7194 ! 7195 ! We recommend you to read 'Working with commercial version' section of 7196 ! ALGLIB Reference Manual in order to find out how to use performance- 7197 ! related features provided by commercial edition of ALGLIB. 7198 7199 -- ALGLIB routine -- 7200 10.02.2010 7201 Bochkanov Sergey 7202 *************************************************************************/ 7203 void hpdmatrixcholeskyinverse(complex_2d_array &a, const ae_int_t n, const bool isupper, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7204 void hpdmatrixcholeskyinverse(complex_2d_array &a, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7205 7206 7207 /************************************************************************* 7208 Inversion of a Hermitian positive definite matrix. 7209 7210 Given an upper or lower triangle of a Hermitian positive definite matrix, 7211 the algorithm generates matrix A^-1 and saves the upper or lower triangle 7212 depending on the input. 7213 7214 Input parameters: 7215 A - matrix to be inverted (upper or lower triangle). 7216 Array with elements [0..N-1,0..N-1]. 7217 N - size of matrix A (optional) : 7218 * if given, only principal NxN submatrix is processed and 7219 overwritten. other elements are unchanged. 7220 * if not given, size is automatically determined from 7221 matrix size (A must be square matrix) 7222 IsUpper - storage type (optional): 7223 * if True, symmetric matrix A is given by its upper 7224 triangle, and the lower triangle isn't used/changed by 7225 function 7226 * if False, symmetric matrix A is given by its lower 7227 triangle, and the upper triangle isn't used/changed by 7228 function 7229 * if not given, both lower and upper triangles must be 7230 filled. 7231 7232 Output parameters: 7233 Info - return code, same as in RMatrixLUInverse 7234 Rep - solver report, same as in RMatrixLUInverse 7235 A - inverse of matrix A, same as in RMatrixLUInverse 7236 7237 ! FREE EDITION OF ALGLIB: 7238 ! 7239 ! Free Edition of ALGLIB supports following important features for this 7240 ! function: 7241 ! * C++ version: x64 SIMD support using C++ intrinsics 7242 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 7243 ! 7244 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 7245 ! Reference Manual in order to find out how to activate SIMD support 7246 ! in ALGLIB. 7247 7248 ! COMMERCIAL EDITION OF ALGLIB: 7249 ! 7250 ! Commercial Edition of ALGLIB includes following important improvements 7251 ! of this function: 7252 ! * high-performance native backend with same C# interface (C# version) 7253 ! * multithreading support (C++ and C# versions) 7254 ! * hardware vendor (Intel) implementations of linear algebra primitives 7255 ! (C++ and C# versions, x86/x64 platform) 7256 ! 7257 ! We recommend you to read 'Working with commercial version' section of 7258 ! ALGLIB Reference Manual in order to find out how to use performance- 7259 ! related features provided by commercial edition of ALGLIB. 7260 7261 -- ALGLIB routine -- 7262 10.02.2010 7263 Bochkanov Sergey 7264 *************************************************************************/ 7265 void hpdmatrixinverse(complex_2d_array &a, const ae_int_t n, const bool isupper, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7266 void hpdmatrixinverse(complex_2d_array &a, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7267 7268 7269 /************************************************************************* 7270 Triangular matrix inverse (real) 7271 7272 The subroutine inverts the following types of matrices: 7273 * upper triangular 7274 * upper triangular with unit diagonal 7275 * lower triangular 7276 * lower triangular with unit diagonal 7277 7278 In case of an upper (lower) triangular matrix, the inverse matrix will 7279 also be upper (lower) triangular, and after the end of the algorithm, the 7280 inverse matrix replaces the source matrix. The elements below (above) the 7281 main diagonal are not changed by the algorithm. 7282 7283 If the matrix has a unit diagonal, the inverse matrix also has a unit 7284 diagonal, and the diagonal elements are not passed to the algorithm. 7285 7286 Input parameters: 7287 A - matrix, array[0..N-1, 0..N-1]. 7288 N - size of matrix A (optional) : 7289 * if given, only principal NxN submatrix is processed and 7290 overwritten. other elements are unchanged. 7291 * if not given, size is automatically determined from 7292 matrix size (A must be square matrix) 7293 IsUpper - True, if the matrix is upper triangular. 7294 IsUnit - diagonal type (optional): 7295 * if True, matrix has unit diagonal (a[i,i] are NOT used) 7296 * if False, matrix diagonal is arbitrary 7297 * if not given, False is assumed 7298 7299 Output parameters: 7300 Info - same as for RMatrixLUInverse 7301 Rep - same as for RMatrixLUInverse 7302 A - same as for RMatrixLUInverse. 7303 7304 ! FREE EDITION OF ALGLIB: 7305 ! 7306 ! Free Edition of ALGLIB supports following important features for this 7307 ! function: 7308 ! * C++ version: x64 SIMD support using C++ intrinsics 7309 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 7310 ! 7311 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 7312 ! Reference Manual in order to find out how to activate SIMD support 7313 ! in ALGLIB. 7314 7315 ! COMMERCIAL EDITION OF ALGLIB: 7316 ! 7317 ! Commercial Edition of ALGLIB includes following important improvements 7318 ! of this function: 7319 ! * high-performance native backend with same C# interface (C# version) 7320 ! * multithreading support (C++ and C# versions) 7321 ! * hardware vendor (Intel) implementations of linear algebra primitives 7322 ! (C++ and C# versions, x86/x64 platform) 7323 ! 7324 ! We recommend you to read 'Working with commercial version' section of 7325 ! ALGLIB Reference Manual in order to find out how to use performance- 7326 ! related features provided by commercial edition of ALGLIB. 7327 7328 -- ALGLIB -- 7329 Copyright 05.02.2010 by Bochkanov Sergey 7330 *************************************************************************/ 7331 void rmatrixtrinverse(real_2d_array &a, const ae_int_t n, const bool isupper, const bool isunit, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7332 void rmatrixtrinverse(real_2d_array &a, const bool isupper, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7333 7334 7335 /************************************************************************* 7336 Triangular matrix inverse (complex) 7337 7338 The subroutine inverts the following types of matrices: 7339 * upper triangular 7340 * upper triangular with unit diagonal 7341 * lower triangular 7342 * lower triangular with unit diagonal 7343 7344 In case of an upper (lower) triangular matrix, the inverse matrix will 7345 also be upper (lower) triangular, and after the end of the algorithm, the 7346 inverse matrix replaces the source matrix. The elements below (above) the 7347 main diagonal are not changed by the algorithm. 7348 7349 If the matrix has a unit diagonal, the inverse matrix also has a unit 7350 diagonal, and the diagonal elements are not passed to the algorithm. 7351 7352 Input parameters: 7353 A - matrix, array[0..N-1, 0..N-1]. 7354 N - size of matrix A (optional) : 7355 * if given, only principal NxN submatrix is processed and 7356 overwritten. other elements are unchanged. 7357 * if not given, size is automatically determined from 7358 matrix size (A must be square matrix) 7359 IsUpper - True, if the matrix is upper triangular. 7360 IsUnit - diagonal type (optional): 7361 * if True, matrix has unit diagonal (a[i,i] are NOT used) 7362 * if False, matrix diagonal is arbitrary 7363 * if not given, False is assumed 7364 7365 Output parameters: 7366 Info - same as for RMatrixLUInverse 7367 Rep - same as for RMatrixLUInverse 7368 A - same as for RMatrixLUInverse. 7369 7370 ! FREE EDITION OF ALGLIB: 7371 ! 7372 ! Free Edition of ALGLIB supports following important features for this 7373 ! function: 7374 ! * C++ version: x64 SIMD support using C++ intrinsics 7375 ! * C# version: x64 SIMD support using NET5/NetCore hardware intrinsics 7376 ! 7377 ! We recommend you to read 'Compiling ALGLIB' section of the ALGLIB 7378 ! Reference Manual in order to find out how to activate SIMD support 7379 ! in ALGLIB. 7380 7381 ! COMMERCIAL EDITION OF ALGLIB: 7382 ! 7383 ! Commercial Edition of ALGLIB includes following important improvements 7384 ! of this function: 7385 ! * high-performance native backend with same C# interface (C# version) 7386 ! * multithreading support (C++ and C# versions) 7387 ! * hardware vendor (Intel) implementations of linear algebra primitives 7388 ! (C++ and C# versions, x86/x64 platform) 7389 ! 7390 ! We recommend you to read 'Working with commercial version' section of 7391 ! ALGLIB Reference Manual in order to find out how to use performance- 7392 ! related features provided by commercial edition of ALGLIB. 7393 7394 -- ALGLIB -- 7395 Copyright 05.02.2010 by Bochkanov Sergey 7396 *************************************************************************/ 7397 void cmatrixtrinverse(complex_2d_array &a, const ae_int_t n, const bool isupper, const bool isunit, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7398 void cmatrixtrinverse(complex_2d_array &a, const bool isupper, ae_int_t &info, matinvreport &rep, const xparams _xparams = alglib::xdefault); 7399 #endif 7400 7401 #if defined(AE_COMPILE_INVERSEUPDATE) || !defined(AE_PARTIAL_BUILD) 7402 /************************************************************************* 7403 Inverse matrix update by the Sherman-Morrison formula 7404 7405 The algorithm updates matrix A^-1 when adding a number to an element 7406 of matrix A. 7407 7408 Input parameters: 7409 InvA - inverse of matrix A. 7410 Array whose indexes range within [0..N-1, 0..N-1]. 7411 N - size of matrix A. 7412 UpdRow - row where the element to be updated is stored. 7413 UpdColumn - column where the element to be updated is stored. 7414 UpdVal - a number to be added to the element. 7415 7416 7417 Output parameters: 7418 InvA - inverse of modified matrix A. 7419 7420 -- ALGLIB -- 7421 Copyright 2005 by Bochkanov Sergey 7422 *************************************************************************/ 7423 void rmatrixinvupdatesimple(real_2d_array &inva, const ae_int_t n, const ae_int_t updrow, const ae_int_t updcolumn, const double updval, const xparams _xparams = alglib::xdefault); 7424 7425 7426 /************************************************************************* 7427 Inverse matrix update by the Sherman-Morrison formula 7428 7429 The algorithm updates matrix A^-1 when adding a vector to a row 7430 of matrix A. 7431 7432 Input parameters: 7433 InvA - inverse of matrix A. 7434 Array whose indexes range within [0..N-1, 0..N-1]. 7435 N - size of matrix A. 7436 UpdRow - the row of A whose vector V was added. 7437 0 <= Row <= N-1 7438 V - the vector to be added to a row. 7439 Array whose index ranges within [0..N-1]. 7440 7441 Output parameters: 7442 InvA - inverse of modified matrix A. 7443 7444 -- ALGLIB -- 7445 Copyright 2005 by Bochkanov Sergey 7446 *************************************************************************/ 7447 void rmatrixinvupdaterow(real_2d_array &inva, const ae_int_t n, const ae_int_t updrow, const real_1d_array &v, const xparams _xparams = alglib::xdefault); 7448 7449 7450 /************************************************************************* 7451 Inverse matrix update by the Sherman-Morrison formula 7452 7453 The algorithm updates matrix A^-1 when adding a vector to a column 7454 of matrix A. 7455 7456 Input parameters: 7457 InvA - inverse of matrix A. 7458 Array whose indexes range within [0..N-1, 0..N-1]. 7459 N - size of matrix A. 7460 UpdColumn - the column of A whose vector U was added. 7461 0 <= UpdColumn <= N-1 7462 U - the vector to be added to a column. 7463 Array whose index ranges within [0..N-1]. 7464 7465 Output parameters: 7466 InvA - inverse of modified matrix A. 7467 7468 -- ALGLIB -- 7469 Copyright 2005 by Bochkanov Sergey 7470 *************************************************************************/ 7471 void rmatrixinvupdatecolumn(real_2d_array &inva, const ae_int_t n, const ae_int_t updcolumn, const real_1d_array &u, const xparams _xparams = alglib::xdefault); 7472 7473 7474 /************************************************************************* 7475 Inverse matrix update by the Sherman-Morrison formula 7476 7477 The algorithm computes the inverse of matrix A+u*v' by using the given matrix 7478 A^-1 and the vectors u and v. 7479 7480 Input parameters: 7481 InvA - inverse of matrix A. 7482 Array whose indexes range within [0..N-1, 0..N-1]. 7483 N - size of matrix A. 7484 U - the vector modifying the matrix. 7485 Array whose index ranges within [0..N-1]. 7486 V - the vector modifying the matrix. 7487 Array whose index ranges within [0..N-1]. 7488 7489 Output parameters: 7490 InvA - inverse of matrix A + u*v'. 7491 7492 -- ALGLIB -- 7493 Copyright 2005 by Bochkanov Sergey 7494 *************************************************************************/ 7495 void rmatrixinvupdateuv(real_2d_array &inva, const ae_int_t n, const real_1d_array &u, const real_1d_array &v, const xparams _xparams = alglib::xdefault); 7496 #endif 7497 7498 #if defined(AE_COMPILE_SCHUR) || !defined(AE_PARTIAL_BUILD) 7499 /************************************************************************* 7500 Subroutine performing the Schur decomposition of a general matrix by using 7501 the QR algorithm with multiple shifts. 7502 7503 COMMERCIAL EDITION OF ALGLIB: 7504 7505 ! Commercial version of ALGLIB includes one important improvement of 7506 ! this function, which can be used from C++ and C#: 7507 ! * Intel MKL support (lightweight Intel MKL is shipped with ALGLIB) 7508 ! 7509 ! Intel MKL gives approximately constant (with respect to number of 7510 ! worker threads) acceleration factor which depends on CPU being used, 7511 ! problem size and "baseline" ALGLIB edition which is used for 7512 ! comparison. 7513 ! 7514 ! Multithreaded acceleration is NOT supported for this function. 7515 ! 7516 ! We recommend you to read 'Working with commercial version' section of 7517 ! ALGLIB Reference Manual in order to find out how to use performance- 7518 ! related features provided by commercial edition of ALGLIB. 7519 7520 The source matrix A is represented as S'*A*S = T, where S is an orthogonal 7521 matrix (Schur vectors), T - upper quasi-triangular matrix (with blocks of 7522 sizes 1x1 and 2x2 on the main diagonal). 7523 7524 Input parameters: 7525 A - matrix to be decomposed. 7526 Array whose indexes range within [0..N-1, 0..N-1]. 7527 N - size of A, N>=0. 7528 7529 7530 Output parameters: 7531 A - contains matrix T. 7532 Array whose indexes range within [0..N-1, 0..N-1]. 7533 S - contains Schur vectors. 7534 Array whose indexes range within [0..N-1, 0..N-1]. 7535 7536 Note 1: 7537 The block structure of matrix T can be easily recognized: since all 7538 the elements below the blocks are zeros, the elements a[i+1,i] which 7539 are equal to 0 show the block border. 7540 7541 Note 2: 7542 The algorithm performance depends on the value of the internal parameter 7543 NS of the InternalSchurDecomposition subroutine which defines the number 7544 of shifts in the QR algorithm (similarly to the block width in block-matrix 7545 algorithms in linear algebra). If you require maximum performance on 7546 your machine, it is recommended to adjust this parameter manually. 7547 7548 Result: 7549 True, 7550 if the algorithm has converged and parameters A and S contain the result. 7551 False, 7552 if the algorithm has not converged. 7553 7554 Algorithm implemented on the basis of the DHSEQR subroutine (LAPACK 3.0 library). 7555 *************************************************************************/ 7556 bool rmatrixschur(real_2d_array &a, const ae_int_t n, real_2d_array &s, const xparams _xparams = alglib::xdefault); 7557 #endif 7558 7559 #if defined(AE_COMPILE_SPDGEVD) || !defined(AE_PARTIAL_BUILD) 7560 /************************************************************************* 7561 Algorithm for solving the following generalized symmetric positive-definite 7562 eigenproblem: 7563 A*x = lambda*B*x (1) or 7564 A*B*x = lambda*x (2) or 7565 B*A*x = lambda*x (3). 7566 where A is a symmetric matrix, B - symmetric positive-definite matrix. 7567 The problem is solved by reducing it to an ordinary symmetric eigenvalue 7568 problem. 7569 7570 Input parameters: 7571 A - symmetric matrix which is given by its upper or lower 7572 triangular part. 7573 Array whose indexes range within [0..N-1, 0..N-1]. 7574 N - size of matrices A and B. 7575 IsUpperA - storage format of matrix A. 7576 B - symmetric positive-definite matrix which is given by 7577 its upper or lower triangular part. 7578 Array whose indexes range within [0..N-1, 0..N-1]. 7579 IsUpperB - storage format of matrix B. 7580 ZNeeded - if ZNeeded is equal to: 7581 * 0, the eigenvectors are not returned; 7582 * 1, the eigenvectors are returned. 7583 ProblemType - if ProblemType is equal to: 7584 * 1, the following problem is solved: A*x = lambda*B*x; 7585 * 2, the following problem is solved: A*B*x = lambda*x; 7586 * 3, the following problem is solved: B*A*x = lambda*x. 7587 7588 Output parameters: 7589 D - eigenvalues in ascending order. 7590 Array whose index ranges within [0..N-1]. 7591 Z - if ZNeeded is equal to: 7592 * 0, Z hasn't changed; 7593 * 1, Z contains eigenvectors. 7594 Array whose indexes range within [0..N-1, 0..N-1]. 7595 The eigenvectors are stored in matrix columns. It should 7596 be noted that the eigenvectors in such problems do not 7597 form an orthogonal system. 7598 7599 Result: 7600 True, if the problem was solved successfully. 7601 False, if the error occurred during the Cholesky decomposition of matrix 7602 B (the matrix isn't positive-definite) or during the work of the iterative 7603 algorithm for solving the symmetric eigenproblem. 7604 7605 See also the GeneralizedSymmetricDefiniteEVDReduce subroutine. 7606 7607 -- ALGLIB -- 7608 Copyright 1.28.2006 by Bochkanov Sergey 7609 *************************************************************************/ 7610 bool smatrixgevd(const real_2d_array &a, const ae_int_t n, const bool isuppera, const real_2d_array &b, const bool isupperb, const ae_int_t zneeded, const ae_int_t problemtype, real_1d_array &d, real_2d_array &z, const xparams _xparams = alglib::xdefault); 7611 7612 7613 /************************************************************************* 7614 Algorithm for reduction of the following generalized symmetric positive- 7615 definite eigenvalue problem: 7616 A*x = lambda*B*x (1) or 7617 A*B*x = lambda*x (2) or 7618 B*A*x = lambda*x (3) 7619 to the symmetric eigenvalues problem C*y = lambda*y (eigenvalues of this and 7620 the given problems are the same, and the eigenvectors of the given problem 7621 could be obtained by multiplying the obtained eigenvectors by the 7622 transformation matrix x = R*y). 7623 7624 Here A is a symmetric matrix, B - symmetric positive-definite matrix. 7625 7626 Input parameters: 7627 A - symmetric matrix which is given by its upper or lower 7628 triangular part. 7629 Array whose indexes range within [0..N-1, 0..N-1]. 7630 N - size of matrices A and B. 7631 IsUpperA - storage format of matrix A. 7632 B - symmetric positive-definite matrix which is given by 7633 its upper or lower triangular part. 7634 Array whose indexes range within [0..N-1, 0..N-1]. 7635 IsUpperB - storage format of matrix B. 7636 ProblemType - if ProblemType is equal to: 7637 * 1, the following problem is solved: A*x = lambda*B*x; 7638 * 2, the following problem is solved: A*B*x = lambda*x; 7639 * 3, the following problem is solved: B*A*x = lambda*x. 7640 7641 Output parameters: 7642 A - symmetric matrix which is given by its upper or lower 7643 triangle depending on IsUpperA. Contains matrix C. 7644 Array whose indexes range within [0..N-1, 0..N-1]. 7645 R - upper triangular or low triangular transformation matrix 7646 which is used to obtain the eigenvectors of a given problem 7647 as the product of eigenvectors of C (from the right) and 7648 matrix R (from the left). If the matrix is upper 7649 triangular, the elements below the main diagonal 7650 are equal to 0 (and vice versa). Thus, we can perform 7651 the multiplication without taking into account the 7652 internal structure (which is an easier though less 7653 effective way). 7654 Array whose indexes range within [0..N-1, 0..N-1]. 7655 IsUpperR - type of matrix R (upper or lower triangular). 7656 7657 Result: 7658 True, if the problem was reduced successfully. 7659 False, if the error occurred during the Cholesky decomposition of 7660 matrix B (the matrix is not positive-definite). 7661 7662 -- ALGLIB -- 7663 Copyright 1.28.2006 by Bochkanov Sergey 7664 *************************************************************************/ 7665 bool smatrixgevdreduce(real_2d_array &a, const ae_int_t n, const bool isuppera, const real_2d_array &b, const bool isupperb, const ae_int_t problemtype, real_2d_array &r, bool &isupperr, const xparams _xparams = alglib::xdefault); 7666 #endif 7667 7668 #if defined(AE_COMPILE_MATDET) || !defined(AE_PARTIAL_BUILD) 7669 /************************************************************************* 7670 Determinant calculation of the matrix given by its LU decomposition. 7671 7672 Input parameters: 7673 A - LU decomposition of the matrix (output of 7674 RMatrixLU subroutine). 7675 Pivots - table of permutations which were made during 7676 the LU decomposition. 7677 Output of RMatrixLU subroutine. 7678 N - (optional) size of matrix A: 7679 * if given, only principal NxN submatrix is processed and 7680 overwritten. other elements are unchanged. 7681 * if not given, automatically determined from matrix size 7682 (A must be square matrix) 7683 7684 Result: matrix determinant. 7685 7686 -- ALGLIB -- 7687 Copyright 2005 by Bochkanov Sergey 7688 *************************************************************************/ 7689 double rmatrixludet(const real_2d_array &a, const integer_1d_array &pivots, const ae_int_t n, const xparams _xparams = alglib::xdefault); 7690 double rmatrixludet(const real_2d_array &a, const integer_1d_array &pivots, const xparams _xparams = alglib::xdefault); 7691 7692 7693 /************************************************************************* 7694 Calculation of the determinant of a general matrix 7695 7696 Input parameters: 7697 A - matrix, array[0..N-1, 0..N-1] 7698 N - (optional) size of matrix A: 7699 * if given, only principal NxN submatrix is processed and 7700 overwritten. other elements are unchanged. 7701 * if not given, automatically determined from matrix size 7702 (A must be square matrix) 7703 7704 Result: determinant of matrix A. 7705 7706 -- ALGLIB -- 7707 Copyright 2005 by Bochkanov Sergey 7708 *************************************************************************/ 7709 double rmatrixdet(const real_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 7710 double rmatrixdet(const real_2d_array &a, const xparams _xparams = alglib::xdefault); 7711 7712 7713 /************************************************************************* 7714 Determinant calculation of the matrix given by its LU decomposition. 7715 7716 Input parameters: 7717 A - LU decomposition of the matrix (output of 7718 RMatrixLU subroutine). 7719 Pivots - table of permutations which were made during 7720 the LU decomposition. 7721 Output of RMatrixLU subroutine. 7722 N - (optional) size of matrix A: 7723 * if given, only principal NxN submatrix is processed and 7724 overwritten. other elements are unchanged. 7725 * if not given, automatically determined from matrix size 7726 (A must be square matrix) 7727 7728 Result: matrix determinant. 7729 7730 -- ALGLIB -- 7731 Copyright 2005 by Bochkanov Sergey 7732 *************************************************************************/ 7733 alglib::complex cmatrixludet(const complex_2d_array &a, const integer_1d_array &pivots, const ae_int_t n, const xparams _xparams = alglib::xdefault); 7734 alglib::complex cmatrixludet(const complex_2d_array &a, const integer_1d_array &pivots, const xparams _xparams = alglib::xdefault); 7735 7736 7737 /************************************************************************* 7738 Calculation of the determinant of a general matrix 7739 7740 Input parameters: 7741 A - matrix, array[0..N-1, 0..N-1] 7742 N - (optional) size of matrix A: 7743 * if given, only principal NxN submatrix is processed and 7744 overwritten. other elements are unchanged. 7745 * if not given, automatically determined from matrix size 7746 (A must be square matrix) 7747 7748 Result: determinant of matrix A. 7749 7750 -- ALGLIB -- 7751 Copyright 2005 by Bochkanov Sergey 7752 *************************************************************************/ 7753 alglib::complex cmatrixdet(const complex_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 7754 alglib::complex cmatrixdet(const complex_2d_array &a, const xparams _xparams = alglib::xdefault); 7755 7756 7757 /************************************************************************* 7758 Determinant calculation of the matrix given by the Cholesky decomposition. 7759 7760 Input parameters: 7761 A - Cholesky decomposition, 7762 output of SMatrixCholesky subroutine. 7763 N - (optional) size of matrix A: 7764 * if given, only principal NxN submatrix is processed and 7765 overwritten. other elements are unchanged. 7766 * if not given, automatically determined from matrix size 7767 (A must be square matrix) 7768 7769 As the determinant is equal to the product of squares of diagonal elements, 7770 it's not necessary to specify which triangle - lower or upper - the matrix 7771 is stored in. 7772 7773 Result: 7774 matrix determinant. 7775 7776 -- ALGLIB -- 7777 Copyright 2005-2008 by Bochkanov Sergey 7778 *************************************************************************/ 7779 double spdmatrixcholeskydet(const real_2d_array &a, const ae_int_t n, const xparams _xparams = alglib::xdefault); 7780 double spdmatrixcholeskydet(const real_2d_array &a, const xparams _xparams = alglib::xdefault); 7781 7782 7783 /************************************************************************* 7784 Determinant calculation of the symmetric positive definite matrix. 7785 7786 Input parameters: 7787 A - matrix. Array with elements [0..N-1, 0..N-1]. 7788 N - (optional) size of matrix A: 7789 * if given, only principal NxN submatrix is processed and 7790 overwritten. other elements are unchanged. 7791 * if not given, automatically determined from matrix size 7792 (A must be square matrix) 7793 IsUpper - (optional) storage type: 7794 * if True, symmetric matrix A is given by its upper 7795 triangle, and the lower triangle isn't used/changed by 7796 function 7797 * if False, symmetric matrix A is given by its lower 7798 triangle, and the upper triangle isn't used/changed by 7799 function 7800 * if not given, both lower and upper triangles must be 7801 filled. 7802 7803 Result: 7804 determinant of matrix A. 7805 If matrix A is not positive definite, exception is thrown. 7806 7807 -- ALGLIB -- 7808 Copyright 2005-2008 by Bochkanov Sergey 7809 *************************************************************************/ 7810 double spdmatrixdet(const real_2d_array &a, const ae_int_t n, const bool isupper, const xparams _xparams = alglib::xdefault); 7811 double spdmatrixdet(const real_2d_array &a, const xparams _xparams = alglib::xdefault); 7812 #endif 7813 } 7814 7815 ///////////////////////////////////////////////////////////////////////// 7816 // 7817 // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS) 7818 // 7819 ///////////////////////////////////////////////////////////////////////// 7820 namespace alglib_impl 7821 { 7822 #if defined(AE_COMPILE_ABLAS) || !defined(AE_PARTIAL_BUILD) 7823 void ablassplitlength(/* Real */ ae_matrix* a, 7824 ae_int_t n, 7825 ae_int_t* n1, 7826 ae_int_t* n2, 7827 ae_state *_state); 7828 void ablascomplexsplitlength(/* Complex */ ae_matrix* a, 7829 ae_int_t n, 7830 ae_int_t* n1, 7831 ae_int_t* n2, 7832 ae_state *_state); 7833 ae_int_t gemmparallelsize(ae_state *_state); 7834 ae_int_t ablasblocksize(/* Real */ ae_matrix* a, ae_state *_state); 7835 ae_int_t ablascomplexblocksize(/* Complex */ ae_matrix* a, 7836 ae_state *_state); 7837 ae_int_t ablasmicroblocksize(ae_state *_state); 7838 void generatereflection(/* Real */ ae_vector* x, 7839 ae_int_t n, 7840 double* tau, 7841 ae_state *_state); 7842 void applyreflectionfromtheleft(/* Real */ ae_matrix* c, 7843 double tau, 7844 /* Real */ ae_vector* v, 7845 ae_int_t m1, 7846 ae_int_t m2, 7847 ae_int_t n1, 7848 ae_int_t n2, 7849 /* Real */ ae_vector* work, 7850 ae_state *_state); 7851 void applyreflectionfromtheright(/* Real */ ae_matrix* c, 7852 double tau, 7853 /* Real */ ae_vector* v, 7854 ae_int_t m1, 7855 ae_int_t m2, 7856 ae_int_t n1, 7857 ae_int_t n2, 7858 /* Real */ ae_vector* work, 7859 ae_state *_state); 7860 void cmatrixtranspose(ae_int_t m, 7861 ae_int_t n, 7862 /* Complex */ ae_matrix* a, 7863 ae_int_t ia, 7864 ae_int_t ja, 7865 /* Complex */ ae_matrix* b, 7866 ae_int_t ib, 7867 ae_int_t jb, 7868 ae_state *_state); 7869 void rmatrixtranspose(ae_int_t m, 7870 ae_int_t n, 7871 /* Real */ ae_matrix* a, 7872 ae_int_t ia, 7873 ae_int_t ja, 7874 /* Real */ ae_matrix* b, 7875 ae_int_t ib, 7876 ae_int_t jb, 7877 ae_state *_state); 7878 void rmatrixenforcesymmetricity(/* Real */ ae_matrix* a, 7879 ae_int_t n, 7880 ae_bool isupper, 7881 ae_state *_state); 7882 void cmatrixcopy(ae_int_t m, 7883 ae_int_t n, 7884 /* Complex */ ae_matrix* a, 7885 ae_int_t ia, 7886 ae_int_t ja, 7887 /* Complex */ ae_matrix* b, 7888 ae_int_t ib, 7889 ae_int_t jb, 7890 ae_state *_state); 7891 void rvectorcopy(ae_int_t n, 7892 /* Real */ ae_vector* a, 7893 ae_int_t ia, 7894 /* Real */ ae_vector* b, 7895 ae_int_t ib, 7896 ae_state *_state); 7897 void rmatrixcopy(ae_int_t m, 7898 ae_int_t n, 7899 /* Real */ ae_matrix* a, 7900 ae_int_t ia, 7901 ae_int_t ja, 7902 /* Real */ ae_matrix* b, 7903 ae_int_t ib, 7904 ae_int_t jb, 7905 ae_state *_state); 7906 void rmatrixgencopy(ae_int_t m, 7907 ae_int_t n, 7908 double alpha, 7909 /* Real */ ae_matrix* a, 7910 ae_int_t ia, 7911 ae_int_t ja, 7912 double beta, 7913 /* Real */ ae_matrix* b, 7914 ae_int_t ib, 7915 ae_int_t jb, 7916 ae_state *_state); 7917 void rmatrixger(ae_int_t m, 7918 ae_int_t n, 7919 /* Real */ ae_matrix* a, 7920 ae_int_t ia, 7921 ae_int_t ja, 7922 double alpha, 7923 /* Real */ ae_vector* u, 7924 ae_int_t iu, 7925 /* Real */ ae_vector* v, 7926 ae_int_t iv, 7927 ae_state *_state); 7928 void cmatrixrank1(ae_int_t m, 7929 ae_int_t n, 7930 /* Complex */ ae_matrix* a, 7931 ae_int_t ia, 7932 ae_int_t ja, 7933 /* Complex */ ae_vector* u, 7934 ae_int_t iu, 7935 /* Complex */ ae_vector* v, 7936 ae_int_t iv, 7937 ae_state *_state); 7938 void rmatrixrank1(ae_int_t m, 7939 ae_int_t n, 7940 /* Real */ ae_matrix* a, 7941 ae_int_t ia, 7942 ae_int_t ja, 7943 /* Real */ ae_vector* u, 7944 ae_int_t iu, 7945 /* Real */ ae_vector* v, 7946 ae_int_t iv, 7947 ae_state *_state); 7948 void rmatrixgemv(ae_int_t m, 7949 ae_int_t n, 7950 double alpha, 7951 /* Real */ ae_matrix* a, 7952 ae_int_t ia, 7953 ae_int_t ja, 7954 ae_int_t opa, 7955 /* Real */ ae_vector* x, 7956 ae_int_t ix, 7957 double beta, 7958 /* Real */ ae_vector* y, 7959 ae_int_t iy, 7960 ae_state *_state); 7961 void cmatrixmv(ae_int_t m, 7962 ae_int_t n, 7963 /* Complex */ ae_matrix* a, 7964 ae_int_t ia, 7965 ae_int_t ja, 7966 ae_int_t opa, 7967 /* Complex */ ae_vector* x, 7968 ae_int_t ix, 7969 /* Complex */ ae_vector* y, 7970 ae_int_t iy, 7971 ae_state *_state); 7972 void rmatrixmv(ae_int_t m, 7973 ae_int_t n, 7974 /* Real */ ae_matrix* a, 7975 ae_int_t ia, 7976 ae_int_t ja, 7977 ae_int_t opa, 7978 /* Real */ ae_vector* x, 7979 ae_int_t ix, 7980 /* Real */ ae_vector* y, 7981 ae_int_t iy, 7982 ae_state *_state); 7983 void rmatrixsymv(ae_int_t n, 7984 double alpha, 7985 /* Real */ ae_matrix* a, 7986 ae_int_t ia, 7987 ae_int_t ja, 7988 ae_bool isupper, 7989 /* Real */ ae_vector* x, 7990 ae_int_t ix, 7991 double beta, 7992 /* Real */ ae_vector* y, 7993 ae_int_t iy, 7994 ae_state *_state); 7995 double rmatrixsyvmv(ae_int_t n, 7996 /* Real */ ae_matrix* a, 7997 ae_int_t ia, 7998 ae_int_t ja, 7999 ae_bool isupper, 8000 /* Real */ ae_vector* x, 8001 ae_int_t ix, 8002 /* Real */ ae_vector* tmp, 8003 ae_state *_state); 8004 void rmatrixtrsv(ae_int_t n, 8005 /* Real */ ae_matrix* a, 8006 ae_int_t ia, 8007 ae_int_t ja, 8008 ae_bool isupper, 8009 ae_bool isunit, 8010 ae_int_t optype, 8011 /* Real */ ae_vector* x, 8012 ae_int_t ix, 8013 ae_state *_state); 8014 void cmatrixrighttrsm(ae_int_t m, 8015 ae_int_t n, 8016 /* Complex */ ae_matrix* a, 8017 ae_int_t i1, 8018 ae_int_t j1, 8019 ae_bool isupper, 8020 ae_bool isunit, 8021 ae_int_t optype, 8022 /* Complex */ ae_matrix* x, 8023 ae_int_t i2, 8024 ae_int_t j2, 8025 ae_state *_state); 8026 ae_bool _trypexec_cmatrixrighttrsm(ae_int_t m, 8027 ae_int_t n, 8028 /* Complex */ ae_matrix* a, 8029 ae_int_t i1, 8030 ae_int_t j1, 8031 ae_bool isupper, 8032 ae_bool isunit, 8033 ae_int_t optype, 8034 /* Complex */ ae_matrix* x, 8035 ae_int_t i2, 8036 ae_int_t j2, ae_state *_state); 8037 void cmatrixlefttrsm(ae_int_t m, 8038 ae_int_t n, 8039 /* Complex */ ae_matrix* a, 8040 ae_int_t i1, 8041 ae_int_t j1, 8042 ae_bool isupper, 8043 ae_bool isunit, 8044 ae_int_t optype, 8045 /* Complex */ ae_matrix* x, 8046 ae_int_t i2, 8047 ae_int_t j2, 8048 ae_state *_state); 8049 ae_bool _trypexec_cmatrixlefttrsm(ae_int_t m, 8050 ae_int_t n, 8051 /* Complex */ ae_matrix* a, 8052 ae_int_t i1, 8053 ae_int_t j1, 8054 ae_bool isupper, 8055 ae_bool isunit, 8056 ae_int_t optype, 8057 /* Complex */ ae_matrix* x, 8058 ae_int_t i2, 8059 ae_int_t j2, ae_state *_state); 8060 void rmatrixrighttrsm(ae_int_t m, 8061 ae_int_t n, 8062 /* Real */ ae_matrix* a, 8063 ae_int_t i1, 8064 ae_int_t j1, 8065 ae_bool isupper, 8066 ae_bool isunit, 8067 ae_int_t optype, 8068 /* Real */ ae_matrix* x, 8069 ae_int_t i2, 8070 ae_int_t j2, 8071 ae_state *_state); 8072 ae_bool _trypexec_rmatrixrighttrsm(ae_int_t m, 8073 ae_int_t n, 8074 /* Real */ ae_matrix* a, 8075 ae_int_t i1, 8076 ae_int_t j1, 8077 ae_bool isupper, 8078 ae_bool isunit, 8079 ae_int_t optype, 8080 /* Real */ ae_matrix* x, 8081 ae_int_t i2, 8082 ae_int_t j2, ae_state *_state); 8083 void rmatrixlefttrsm(ae_int_t m, 8084 ae_int_t n, 8085 /* Real */ ae_matrix* a, 8086 ae_int_t i1, 8087 ae_int_t j1, 8088 ae_bool isupper, 8089 ae_bool isunit, 8090 ae_int_t optype, 8091 /* Real */ ae_matrix* x, 8092 ae_int_t i2, 8093 ae_int_t j2, 8094 ae_state *_state); 8095 ae_bool _trypexec_rmatrixlefttrsm(ae_int_t m, 8096 ae_int_t n, 8097 /* Real */ ae_matrix* a, 8098 ae_int_t i1, 8099 ae_int_t j1, 8100 ae_bool isupper, 8101 ae_bool isunit, 8102 ae_int_t optype, 8103 /* Real */ ae_matrix* x, 8104 ae_int_t i2, 8105 ae_int_t j2, ae_state *_state); 8106 void cmatrixherk(ae_int_t n, 8107 ae_int_t k, 8108 double alpha, 8109 /* Complex */ ae_matrix* a, 8110 ae_int_t ia, 8111 ae_int_t ja, 8112 ae_int_t optypea, 8113 double beta, 8114 /* Complex */ ae_matrix* c, 8115 ae_int_t ic, 8116 ae_int_t jc, 8117 ae_bool isupper, 8118 ae_state *_state); 8119 ae_bool _trypexec_cmatrixherk(ae_int_t n, 8120 ae_int_t k, 8121 double alpha, 8122 /* Complex */ ae_matrix* a, 8123 ae_int_t ia, 8124 ae_int_t ja, 8125 ae_int_t optypea, 8126 double beta, 8127 /* Complex */ ae_matrix* c, 8128 ae_int_t ic, 8129 ae_int_t jc, 8130 ae_bool isupper, ae_state *_state); 8131 void rmatrixsyrk(ae_int_t n, 8132 ae_int_t k, 8133 double alpha, 8134 /* Real */ ae_matrix* a, 8135 ae_int_t ia, 8136 ae_int_t ja, 8137 ae_int_t optypea, 8138 double beta, 8139 /* Real */ ae_matrix* c, 8140 ae_int_t ic, 8141 ae_int_t jc, 8142 ae_bool isupper, 8143 ae_state *_state); 8144 ae_bool _trypexec_rmatrixsyrk(ae_int_t n, 8145 ae_int_t k, 8146 double alpha, 8147 /* Real */ ae_matrix* a, 8148 ae_int_t ia, 8149 ae_int_t ja, 8150 ae_int_t optypea, 8151 double beta, 8152 /* Real */ ae_matrix* c, 8153 ae_int_t ic, 8154 ae_int_t jc, 8155 ae_bool isupper, ae_state *_state); 8156 void cmatrixgemm(ae_int_t m, 8157 ae_int_t n, 8158 ae_int_t k, 8159 ae_complex alpha, 8160 /* Complex */ ae_matrix* a, 8161 ae_int_t ia, 8162 ae_int_t ja, 8163 ae_int_t optypea, 8164 /* Complex */ ae_matrix* b, 8165 ae_int_t ib, 8166 ae_int_t jb, 8167 ae_int_t optypeb, 8168 ae_complex beta, 8169 /* Complex */ ae_matrix* c, 8170 ae_int_t ic, 8171 ae_int_t jc, 8172 ae_state *_state); 8173 ae_bool _trypexec_cmatrixgemm(ae_int_t m, 8174 ae_int_t n, 8175 ae_int_t k, 8176 ae_complex alpha, 8177 /* Complex */ ae_matrix* a, 8178 ae_int_t ia, 8179 ae_int_t ja, 8180 ae_int_t optypea, 8181 /* Complex */ ae_matrix* b, 8182 ae_int_t ib, 8183 ae_int_t jb, 8184 ae_int_t optypeb, 8185 ae_complex beta, 8186 /* Complex */ ae_matrix* c, 8187 ae_int_t ic, 8188 ae_int_t jc, ae_state *_state); 8189 void rmatrixgemm(ae_int_t m, 8190 ae_int_t n, 8191 ae_int_t k, 8192 double alpha, 8193 /* Real */ ae_matrix* a, 8194 ae_int_t ia, 8195 ae_int_t ja, 8196 ae_int_t optypea, 8197 /* Real */ ae_matrix* b, 8198 ae_int_t ib, 8199 ae_int_t jb, 8200 ae_int_t optypeb, 8201 double beta, 8202 /* Real */ ae_matrix* c, 8203 ae_int_t ic, 8204 ae_int_t jc, 8205 ae_state *_state); 8206 ae_bool _trypexec_rmatrixgemm(ae_int_t m, 8207 ae_int_t n, 8208 ae_int_t k, 8209 double alpha, 8210 /* Real */ ae_matrix* a, 8211 ae_int_t ia, 8212 ae_int_t ja, 8213 ae_int_t optypea, 8214 /* Real */ ae_matrix* b, 8215 ae_int_t ib, 8216 ae_int_t jb, 8217 ae_int_t optypeb, 8218 double beta, 8219 /* Real */ ae_matrix* c, 8220 ae_int_t ic, 8221 ae_int_t jc, ae_state *_state); 8222 void cmatrixsyrk(ae_int_t n, 8223 ae_int_t k, 8224 double alpha, 8225 /* Complex */ ae_matrix* a, 8226 ae_int_t ia, 8227 ae_int_t ja, 8228 ae_int_t optypea, 8229 double beta, 8230 /* Complex */ ae_matrix* c, 8231 ae_int_t ic, 8232 ae_int_t jc, 8233 ae_bool isupper, 8234 ae_state *_state); 8235 void rowwisegramschmidt(/* Real */ ae_matrix* q, 8236 ae_int_t m, 8237 ae_int_t n, 8238 /* Real */ ae_vector* x, 8239 /* Real */ ae_vector* qx, 8240 ae_bool needqx, 8241 ae_state *_state); 8242 #endif 8243 #if defined(AE_COMPILE_ORTFAC) || !defined(AE_PARTIAL_BUILD) 8244 void rmatrixqr(/* Real */ ae_matrix* a, 8245 ae_int_t m, 8246 ae_int_t n, 8247 /* Real */ ae_vector* tau, 8248 ae_state *_state); 8249 void rmatrixlq(/* Real */ ae_matrix* a, 8250 ae_int_t m, 8251 ae_int_t n, 8252 /* Real */ ae_vector* tau, 8253 ae_state *_state); 8254 void cmatrixqr(/* Complex */ ae_matrix* a, 8255 ae_int_t m, 8256 ae_int_t n, 8257 /* Complex */ ae_vector* tau, 8258 ae_state *_state); 8259 void cmatrixlq(/* Complex */ ae_matrix* a, 8260 ae_int_t m, 8261 ae_int_t n, 8262 /* Complex */ ae_vector* tau, 8263 ae_state *_state); 8264 void rmatrixqrunpackq(/* Real */ ae_matrix* a, 8265 ae_int_t m, 8266 ae_int_t n, 8267 /* Real */ ae_vector* tau, 8268 ae_int_t qcolumns, 8269 /* Real */ ae_matrix* q, 8270 ae_state *_state); 8271 void rmatrixqrunpackr(/* Real */ ae_matrix* a, 8272 ae_int_t m, 8273 ae_int_t n, 8274 /* Real */ ae_matrix* r, 8275 ae_state *_state); 8276 void rmatrixlqunpackq(/* Real */ ae_matrix* a, 8277 ae_int_t m, 8278 ae_int_t n, 8279 /* Real */ ae_vector* tau, 8280 ae_int_t qrows, 8281 /* Real */ ae_matrix* q, 8282 ae_state *_state); 8283 void rmatrixlqunpackl(/* Real */ ae_matrix* a, 8284 ae_int_t m, 8285 ae_int_t n, 8286 /* Real */ ae_matrix* l, 8287 ae_state *_state); 8288 void cmatrixqrunpackq(/* Complex */ ae_matrix* a, 8289 ae_int_t m, 8290 ae_int_t n, 8291 /* Complex */ ae_vector* tau, 8292 ae_int_t qcolumns, 8293 /* Complex */ ae_matrix* q, 8294 ae_state *_state); 8295 void cmatrixqrunpackr(/* Complex */ ae_matrix* a, 8296 ae_int_t m, 8297 ae_int_t n, 8298 /* Complex */ ae_matrix* r, 8299 ae_state *_state); 8300 void cmatrixlqunpackq(/* Complex */ ae_matrix* a, 8301 ae_int_t m, 8302 ae_int_t n, 8303 /* Complex */ ae_vector* tau, 8304 ae_int_t qrows, 8305 /* Complex */ ae_matrix* q, 8306 ae_state *_state); 8307 void cmatrixlqunpackl(/* Complex */ ae_matrix* a, 8308 ae_int_t m, 8309 ae_int_t n, 8310 /* Complex */ ae_matrix* l, 8311 ae_state *_state); 8312 void rmatrixqrbasecase(/* Real */ ae_matrix* a, 8313 ae_int_t m, 8314 ae_int_t n, 8315 /* Real */ ae_vector* work, 8316 /* Real */ ae_vector* t, 8317 /* Real */ ae_vector* tau, 8318 ae_state *_state); 8319 void rmatrixlqbasecase(/* Real */ ae_matrix* a, 8320 ae_int_t m, 8321 ae_int_t n, 8322 /* Real */ ae_vector* work, 8323 /* Real */ ae_vector* t, 8324 /* Real */ ae_vector* tau, 8325 ae_state *_state); 8326 void rmatrixbd(/* Real */ ae_matrix* a, 8327 ae_int_t m, 8328 ae_int_t n, 8329 /* Real */ ae_vector* tauq, 8330 /* Real */ ae_vector* taup, 8331 ae_state *_state); 8332 void rmatrixbdunpackq(/* Real */ ae_matrix* qp, 8333 ae_int_t m, 8334 ae_int_t n, 8335 /* Real */ ae_vector* tauq, 8336 ae_int_t qcolumns, 8337 /* Real */ ae_matrix* q, 8338 ae_state *_state); 8339 void rmatrixbdmultiplybyq(/* Real */ ae_matrix* qp, 8340 ae_int_t m, 8341 ae_int_t n, 8342 /* Real */ ae_vector* tauq, 8343 /* Real */ ae_matrix* z, 8344 ae_int_t zrows, 8345 ae_int_t zcolumns, 8346 ae_bool fromtheright, 8347 ae_bool dotranspose, 8348 ae_state *_state); 8349 void rmatrixbdunpackpt(/* Real */ ae_matrix* qp, 8350 ae_int_t m, 8351 ae_int_t n, 8352 /* Real */ ae_vector* taup, 8353 ae_int_t ptrows, 8354 /* Real */ ae_matrix* pt, 8355 ae_state *_state); 8356 void rmatrixbdmultiplybyp(/* Real */ ae_matrix* qp, 8357 ae_int_t m, 8358 ae_int_t n, 8359 /* Real */ ae_vector* taup, 8360 /* Real */ ae_matrix* z, 8361 ae_int_t zrows, 8362 ae_int_t zcolumns, 8363 ae_bool fromtheright, 8364 ae_bool dotranspose, 8365 ae_state *_state); 8366 void rmatrixbdunpackdiagonals(/* Real */ ae_matrix* b, 8367 ae_int_t m, 8368 ae_int_t n, 8369 ae_bool* isupper, 8370 /* Real */ ae_vector* d, 8371 /* Real */ ae_vector* e, 8372 ae_state *_state); 8373 void rmatrixhessenberg(/* Real */ ae_matrix* a, 8374 ae_int_t n, 8375 /* Real */ ae_vector* tau, 8376 ae_state *_state); 8377 void rmatrixhessenbergunpackq(/* Real */ ae_matrix* a, 8378 ae_int_t n, 8379 /* Real */ ae_vector* tau, 8380 /* Real */ ae_matrix* q, 8381 ae_state *_state); 8382 void rmatrixhessenbergunpackh(/* Real */ ae_matrix* a, 8383 ae_int_t n, 8384 /* Real */ ae_matrix* h, 8385 ae_state *_state); 8386 void smatrixtd(/* Real */ ae_matrix* a, 8387 ae_int_t n, 8388 ae_bool isupper, 8389 /* Real */ ae_vector* tau, 8390 /* Real */ ae_vector* d, 8391 /* Real */ ae_vector* e, 8392 ae_state *_state); 8393 void smatrixtdunpackq(/* Real */ ae_matrix* a, 8394 ae_int_t n, 8395 ae_bool isupper, 8396 /* Real */ ae_vector* tau, 8397 /* Real */ ae_matrix* q, 8398 ae_state *_state); 8399 void hmatrixtd(/* Complex */ ae_matrix* a, 8400 ae_int_t n, 8401 ae_bool isupper, 8402 /* Complex */ ae_vector* tau, 8403 /* Real */ ae_vector* d, 8404 /* Real */ ae_vector* e, 8405 ae_state *_state); 8406 void hmatrixtdunpackq(/* Complex */ ae_matrix* a, 8407 ae_int_t n, 8408 ae_bool isupper, 8409 /* Complex */ ae_vector* tau, 8410 /* Complex */ ae_matrix* q, 8411 ae_state *_state); 8412 #endif 8413 #if defined(AE_COMPILE_MATGEN) || !defined(AE_PARTIAL_BUILD) 8414 void rmatrixrndorthogonal(ae_int_t n, 8415 /* Real */ ae_matrix* a, 8416 ae_state *_state); 8417 void rmatrixrndcond(ae_int_t n, 8418 double c, 8419 /* Real */ ae_matrix* a, 8420 ae_state *_state); 8421 void cmatrixrndorthogonal(ae_int_t n, 8422 /* Complex */ ae_matrix* a, 8423 ae_state *_state); 8424 void cmatrixrndcond(ae_int_t n, 8425 double c, 8426 /* Complex */ ae_matrix* a, 8427 ae_state *_state); 8428 void smatrixrndcond(ae_int_t n, 8429 double c, 8430 /* Real */ ae_matrix* a, 8431 ae_state *_state); 8432 void spdmatrixrndcond(ae_int_t n, 8433 double c, 8434 /* Real */ ae_matrix* a, 8435 ae_state *_state); 8436 void hmatrixrndcond(ae_int_t n, 8437 double c, 8438 /* Complex */ ae_matrix* a, 8439 ae_state *_state); 8440 void hpdmatrixrndcond(ae_int_t n, 8441 double c, 8442 /* Complex */ ae_matrix* a, 8443 ae_state *_state); 8444 void rmatrixrndorthogonalfromtheright(/* Real */ ae_matrix* a, 8445 ae_int_t m, 8446 ae_int_t n, 8447 ae_state *_state); 8448 void rmatrixrndorthogonalfromtheleft(/* Real */ ae_matrix* a, 8449 ae_int_t m, 8450 ae_int_t n, 8451 ae_state *_state); 8452 void cmatrixrndorthogonalfromtheright(/* Complex */ ae_matrix* a, 8453 ae_int_t m, 8454 ae_int_t n, 8455 ae_state *_state); 8456 void cmatrixrndorthogonalfromtheleft(/* Complex */ ae_matrix* a, 8457 ae_int_t m, 8458 ae_int_t n, 8459 ae_state *_state); 8460 void smatrixrndmultiply(/* Real */ ae_matrix* a, 8461 ae_int_t n, 8462 ae_state *_state); 8463 void hmatrixrndmultiply(/* Complex */ ae_matrix* a, 8464 ae_int_t n, 8465 ae_state *_state); 8466 #endif 8467 #if defined(AE_COMPILE_SPARSE) || !defined(AE_PARTIAL_BUILD) 8468 void sparsecreate(ae_int_t m, 8469 ae_int_t n, 8470 ae_int_t k, 8471 sparsematrix* s, 8472 ae_state *_state); 8473 void sparsecreatebuf(ae_int_t m, 8474 ae_int_t n, 8475 ae_int_t k, 8476 sparsematrix* s, 8477 ae_state *_state); 8478 void sparsecreatecrs(ae_int_t m, 8479 ae_int_t n, 8480 /* Integer */ ae_vector* ner, 8481 sparsematrix* s, 8482 ae_state *_state); 8483 void sparsecreatecrsbuf(ae_int_t m, 8484 ae_int_t n, 8485 /* Integer */ ae_vector* ner, 8486 sparsematrix* s, 8487 ae_state *_state); 8488 void sparsecreatesks(ae_int_t m, 8489 ae_int_t n, 8490 /* Integer */ ae_vector* d, 8491 /* Integer */ ae_vector* u, 8492 sparsematrix* s, 8493 ae_state *_state); 8494 void sparsecreatesksbuf(ae_int_t m, 8495 ae_int_t n, 8496 /* Integer */ ae_vector* d, 8497 /* Integer */ ae_vector* u, 8498 sparsematrix* s, 8499 ae_state *_state); 8500 void sparsecreatesksband(ae_int_t m, 8501 ae_int_t n, 8502 ae_int_t bw, 8503 sparsematrix* s, 8504 ae_state *_state); 8505 void sparsecreatesksbandbuf(ae_int_t m, 8506 ae_int_t n, 8507 ae_int_t bw, 8508 sparsematrix* s, 8509 ae_state *_state); 8510 void sparsecopy(sparsematrix* s0, sparsematrix* s1, ae_state *_state); 8511 void sparsecopybuf(sparsematrix* s0, sparsematrix* s1, ae_state *_state); 8512 void sparseswap(sparsematrix* s0, sparsematrix* s1, ae_state *_state); 8513 void sparseadd(sparsematrix* s, 8514 ae_int_t i, 8515 ae_int_t j, 8516 double v, 8517 ae_state *_state); 8518 void sparseset(sparsematrix* s, 8519 ae_int_t i, 8520 ae_int_t j, 8521 double v, 8522 ae_state *_state); 8523 double sparseget(sparsematrix* s, 8524 ae_int_t i, 8525 ae_int_t j, 8526 ae_state *_state); 8527 ae_bool sparseexists(sparsematrix* s, 8528 ae_int_t i, 8529 ae_int_t j, 8530 ae_state *_state); 8531 double sparsegetdiagonal(sparsematrix* s, ae_int_t i, ae_state *_state); 8532 void sparsemv(sparsematrix* s, 8533 /* Real */ ae_vector* x, 8534 /* Real */ ae_vector* y, 8535 ae_state *_state); 8536 void sparsemtv(sparsematrix* s, 8537 /* Real */ ae_vector* x, 8538 /* Real */ ae_vector* y, 8539 ae_state *_state); 8540 void sparsegemv(sparsematrix* s, 8541 double alpha, 8542 ae_int_t ops, 8543 /* Real */ ae_vector* x, 8544 ae_int_t ix, 8545 double beta, 8546 /* Real */ ae_vector* y, 8547 ae_int_t iy, 8548 ae_state *_state); 8549 void sparsemv2(sparsematrix* s, 8550 /* Real */ ae_vector* x, 8551 /* Real */ ae_vector* y0, 8552 /* Real */ ae_vector* y1, 8553 ae_state *_state); 8554 void sparsesmv(sparsematrix* s, 8555 ae_bool isupper, 8556 /* Real */ ae_vector* x, 8557 /* Real */ ae_vector* y, 8558 ae_state *_state); 8559 double sparsevsmv(sparsematrix* s, 8560 ae_bool isupper, 8561 /* Real */ ae_vector* x, 8562 ae_state *_state); 8563 void sparsemm(sparsematrix* s, 8564 /* Real */ ae_matrix* a, 8565 ae_int_t k, 8566 /* Real */ ae_matrix* b, 8567 ae_state *_state); 8568 void sparsemtm(sparsematrix* s, 8569 /* Real */ ae_matrix* a, 8570 ae_int_t k, 8571 /* Real */ ae_matrix* b, 8572 ae_state *_state); 8573 void sparsemm2(sparsematrix* s, 8574 /* Real */ ae_matrix* a, 8575 ae_int_t k, 8576 /* Real */ ae_matrix* b0, 8577 /* Real */ ae_matrix* b1, 8578 ae_state *_state); 8579 void sparsesmm(sparsematrix* s, 8580 ae_bool isupper, 8581 /* Real */ ae_matrix* a, 8582 ae_int_t k, 8583 /* Real */ ae_matrix* b, 8584 ae_state *_state); 8585 void sparsetrmv(sparsematrix* s, 8586 ae_bool isupper, 8587 ae_bool isunit, 8588 ae_int_t optype, 8589 /* Real */ ae_vector* x, 8590 /* Real */ ae_vector* y, 8591 ae_state *_state); 8592 void sparsetrsv(sparsematrix* s, 8593 ae_bool isupper, 8594 ae_bool isunit, 8595 ae_int_t optype, 8596 /* Real */ ae_vector* x, 8597 ae_state *_state); 8598 void sparsesymmpermtbl(sparsematrix* a, 8599 ae_bool isupper, 8600 /* Integer */ ae_vector* p, 8601 sparsematrix* b, 8602 ae_state *_state); 8603 void sparsesymmpermtblbuf(sparsematrix* a, 8604 ae_bool isupper, 8605 /* Integer */ ae_vector* p, 8606 sparsematrix* b, 8607 ae_state *_state); 8608 void sparseresizematrix(sparsematrix* s, ae_state *_state); 8609 void sparseinitduidx(sparsematrix* s, ae_state *_state); 8610 double sparsegetaveragelengthofchain(sparsematrix* s, ae_state *_state); 8611 ae_bool sparseenumerate(sparsematrix* s, 8612 ae_int_t* t0, 8613 ae_int_t* t1, 8614 ae_int_t* i, 8615 ae_int_t* j, 8616 double* v, 8617 ae_state *_state); 8618 ae_bool sparserewriteexisting(sparsematrix* s, 8619 ae_int_t i, 8620 ae_int_t j, 8621 double v, 8622 ae_state *_state); 8623 void sparsegetrow(sparsematrix* s, 8624 ae_int_t i, 8625 /* Real */ ae_vector* irow, 8626 ae_state *_state); 8627 void sparsegetcompressedrow(sparsematrix* s, 8628 ae_int_t i, 8629 /* Integer */ ae_vector* colidx, 8630 /* Real */ ae_vector* vals, 8631 ae_int_t* nzcnt, 8632 ae_state *_state); 8633 void sparsetransposesks(sparsematrix* s, ae_state *_state); 8634 void sparsetransposecrs(sparsematrix* s, ae_state *_state); 8635 void sparsecopytransposecrs(sparsematrix* s0, 8636 sparsematrix* s1, 8637 ae_state *_state); 8638 void sparsecopytransposecrsbuf(sparsematrix* s0, 8639 sparsematrix* s1, 8640 ae_state *_state); 8641 void sparseconvertto(sparsematrix* s0, ae_int_t fmt, ae_state *_state); 8642 void sparsecopytobuf(sparsematrix* s0, 8643 ae_int_t fmt, 8644 sparsematrix* s1, 8645 ae_state *_state); 8646 void sparseconverttohash(sparsematrix* s, ae_state *_state); 8647 void sparsecopytohash(sparsematrix* s0, 8648 sparsematrix* s1, 8649 ae_state *_state); 8650 void sparsecopytohashbuf(sparsematrix* s0, 8651 sparsematrix* s1, 8652 ae_state *_state); 8653 void sparseconverttocrs(sparsematrix* s, ae_state *_state); 8654 void sparsecopytocrs(sparsematrix* s0, sparsematrix* s1, ae_state *_state); 8655 void sparsecopytocrsbuf(sparsematrix* s0, 8656 sparsematrix* s1, 8657 ae_state *_state); 8658 void sparseconverttosks(sparsematrix* s, ae_state *_state); 8659 void sparsecopytosks(sparsematrix* s0, sparsematrix* s1, ae_state *_state); 8660 void sparsecopytosksbuf(sparsematrix* s0, 8661 sparsematrix* s1, 8662 ae_state *_state); 8663 void sparsecreatecrsinplace(sparsematrix* s, ae_state *_state); 8664 ae_int_t sparsegetmatrixtype(sparsematrix* s, ae_state *_state); 8665 ae_bool sparseishash(sparsematrix* s, ae_state *_state); 8666 ae_bool sparseiscrs(sparsematrix* s, ae_state *_state); 8667 ae_bool sparseissks(sparsematrix* s, ae_state *_state); 8668 void sparsefree(sparsematrix* s, ae_state *_state); 8669 ae_int_t sparsegetnrows(sparsematrix* s, ae_state *_state); 8670 ae_int_t sparsegetncols(sparsematrix* s, ae_state *_state); 8671 ae_int_t sparsegetuppercount(sparsematrix* s, ae_state *_state); 8672 ae_int_t sparsegetlowercount(sparsematrix* s, ae_state *_state); 8673 void sparsealloc(ae_serializer* s, sparsematrix* a, ae_state *_state); 8674 void sparseserialize(ae_serializer* s, sparsematrix* a, ae_state *_state); 8675 void sparseunserialize(ae_serializer* s, 8676 sparsematrix* a, 8677 ae_state *_state); 8678 void _sparsematrix_init(void* _p, ae_state *_state, ae_bool make_automatic); 8679 void _sparsematrix_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8680 void _sparsematrix_clear(void* _p); 8681 void _sparsematrix_destroy(void* _p); 8682 void _sparsebuffers_init(void* _p, ae_state *_state, ae_bool make_automatic); 8683 void _sparsebuffers_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8684 void _sparsebuffers_clear(void* _p); 8685 void _sparsebuffers_destroy(void* _p); 8686 #endif 8687 #if defined(AE_COMPILE_HSSCHUR) || !defined(AE_PARTIAL_BUILD) 8688 void rmatrixinternalschurdecomposition(/* Real */ ae_matrix* h, 8689 ae_int_t n, 8690 ae_int_t tneeded, 8691 ae_int_t zneeded, 8692 /* Real */ ae_vector* wr, 8693 /* Real */ ae_vector* wi, 8694 /* Real */ ae_matrix* z, 8695 ae_int_t* info, 8696 ae_state *_state); 8697 ae_bool upperhessenbergschurdecomposition(/* Real */ ae_matrix* h, 8698 ae_int_t n, 8699 /* Real */ ae_matrix* s, 8700 ae_state *_state); 8701 void internalschurdecomposition(/* Real */ ae_matrix* h, 8702 ae_int_t n, 8703 ae_int_t tneeded, 8704 ae_int_t zneeded, 8705 /* Real */ ae_vector* wr, 8706 /* Real */ ae_vector* wi, 8707 /* Real */ ae_matrix* z, 8708 ae_int_t* info, 8709 ae_state *_state); 8710 #endif 8711 #if defined(AE_COMPILE_EVD) || !defined(AE_PARTIAL_BUILD) 8712 void eigsubspacecreate(ae_int_t n, 8713 ae_int_t k, 8714 eigsubspacestate* state, 8715 ae_state *_state); 8716 void eigsubspacecreatebuf(ae_int_t n, 8717 ae_int_t k, 8718 eigsubspacestate* state, 8719 ae_state *_state); 8720 void eigsubspacesetcond(eigsubspacestate* state, 8721 double eps, 8722 ae_int_t maxits, 8723 ae_state *_state); 8724 void eigsubspacesetwarmstart(eigsubspacestate* state, 8725 ae_bool usewarmstart, 8726 ae_state *_state); 8727 void eigsubspaceoocstart(eigsubspacestate* state, 8728 ae_int_t mtype, 8729 ae_state *_state); 8730 ae_bool eigsubspaceooccontinue(eigsubspacestate* state, ae_state *_state); 8731 void eigsubspaceoocgetrequestinfo(eigsubspacestate* state, 8732 ae_int_t* requesttype, 8733 ae_int_t* requestsize, 8734 ae_state *_state); 8735 void eigsubspaceoocgetrequestdata(eigsubspacestate* state, 8736 /* Real */ ae_matrix* x, 8737 ae_state *_state); 8738 void eigsubspaceoocsendresult(eigsubspacestate* state, 8739 /* Real */ ae_matrix* ax, 8740 ae_state *_state); 8741 void eigsubspaceoocstop(eigsubspacestate* state, 8742 /* Real */ ae_vector* w, 8743 /* Real */ ae_matrix* z, 8744 eigsubspacereport* rep, 8745 ae_state *_state); 8746 void eigsubspacesolvedenses(eigsubspacestate* state, 8747 /* Real */ ae_matrix* a, 8748 ae_bool isupper, 8749 /* Real */ ae_vector* w, 8750 /* Real */ ae_matrix* z, 8751 eigsubspacereport* rep, 8752 ae_state *_state); 8753 void eigsubspacesolvesparses(eigsubspacestate* state, 8754 sparsematrix* a, 8755 ae_bool isupper, 8756 /* Real */ ae_vector* w, 8757 /* Real */ ae_matrix* z, 8758 eigsubspacereport* rep, 8759 ae_state *_state); 8760 ae_bool eigsubspaceiteration(eigsubspacestate* state, ae_state *_state); 8761 ae_bool smatrixevd(/* Real */ ae_matrix* a, 8762 ae_int_t n, 8763 ae_int_t zneeded, 8764 ae_bool isupper, 8765 /* Real */ ae_vector* d, 8766 /* Real */ ae_matrix* z, 8767 ae_state *_state); 8768 ae_bool smatrixevdr(/* Real */ ae_matrix* a, 8769 ae_int_t n, 8770 ae_int_t zneeded, 8771 ae_bool isupper, 8772 double b1, 8773 double b2, 8774 ae_int_t* m, 8775 /* Real */ ae_vector* w, 8776 /* Real */ ae_matrix* z, 8777 ae_state *_state); 8778 ae_bool smatrixevdi(/* Real */ ae_matrix* a, 8779 ae_int_t n, 8780 ae_int_t zneeded, 8781 ae_bool isupper, 8782 ae_int_t i1, 8783 ae_int_t i2, 8784 /* Real */ ae_vector* w, 8785 /* Real */ ae_matrix* z, 8786 ae_state *_state); 8787 ae_bool hmatrixevd(/* Complex */ ae_matrix* a, 8788 ae_int_t n, 8789 ae_int_t zneeded, 8790 ae_bool isupper, 8791 /* Real */ ae_vector* d, 8792 /* Complex */ ae_matrix* z, 8793 ae_state *_state); 8794 ae_bool hmatrixevdr(/* Complex */ ae_matrix* a, 8795 ae_int_t n, 8796 ae_int_t zneeded, 8797 ae_bool isupper, 8798 double b1, 8799 double b2, 8800 ae_int_t* m, 8801 /* Real */ ae_vector* w, 8802 /* Complex */ ae_matrix* z, 8803 ae_state *_state); 8804 ae_bool hmatrixevdi(/* Complex */ ae_matrix* a, 8805 ae_int_t n, 8806 ae_int_t zneeded, 8807 ae_bool isupper, 8808 ae_int_t i1, 8809 ae_int_t i2, 8810 /* Real */ ae_vector* w, 8811 /* Complex */ ae_matrix* z, 8812 ae_state *_state); 8813 ae_bool smatrixtdevd(/* Real */ ae_vector* d, 8814 /* Real */ ae_vector* e, 8815 ae_int_t n, 8816 ae_int_t zneeded, 8817 /* Real */ ae_matrix* z, 8818 ae_state *_state); 8819 ae_bool smatrixtdevdr(/* Real */ ae_vector* d, 8820 /* Real */ ae_vector* e, 8821 ae_int_t n, 8822 ae_int_t zneeded, 8823 double a, 8824 double b, 8825 ae_int_t* m, 8826 /* Real */ ae_matrix* z, 8827 ae_state *_state); 8828 ae_bool smatrixtdevdi(/* Real */ ae_vector* d, 8829 /* Real */ ae_vector* e, 8830 ae_int_t n, 8831 ae_int_t zneeded, 8832 ae_int_t i1, 8833 ae_int_t i2, 8834 /* Real */ ae_matrix* z, 8835 ae_state *_state); 8836 ae_bool rmatrixevd(/* Real */ ae_matrix* a, 8837 ae_int_t n, 8838 ae_int_t vneeded, 8839 /* Real */ ae_vector* wr, 8840 /* Real */ ae_vector* wi, 8841 /* Real */ ae_matrix* vl, 8842 /* Real */ ae_matrix* vr, 8843 ae_state *_state); 8844 void _eigsubspacestate_init(void* _p, ae_state *_state, ae_bool make_automatic); 8845 void _eigsubspacestate_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8846 void _eigsubspacestate_clear(void* _p); 8847 void _eigsubspacestate_destroy(void* _p); 8848 void _eigsubspacereport_init(void* _p, ae_state *_state, ae_bool make_automatic); 8849 void _eigsubspacereport_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8850 void _eigsubspacereport_clear(void* _p); 8851 void _eigsubspacereport_destroy(void* _p); 8852 #endif 8853 #if defined(AE_COMPILE_DLU) || !defined(AE_PARTIAL_BUILD) 8854 void cmatrixluprec(/* Complex */ ae_matrix* a, 8855 ae_int_t offs, 8856 ae_int_t m, 8857 ae_int_t n, 8858 /* Integer */ ae_vector* pivots, 8859 /* Complex */ ae_vector* tmp, 8860 ae_state *_state); 8861 void rmatrixluprec(/* Real */ ae_matrix* a, 8862 ae_int_t offs, 8863 ae_int_t m, 8864 ae_int_t n, 8865 /* Integer */ ae_vector* pivots, 8866 /* Real */ ae_vector* tmp, 8867 ae_state *_state); 8868 void cmatrixplurec(/* Complex */ ae_matrix* a, 8869 ae_int_t offs, 8870 ae_int_t m, 8871 ae_int_t n, 8872 /* Integer */ ae_vector* pivots, 8873 /* Complex */ ae_vector* tmp, 8874 ae_state *_state); 8875 void rmatrixplurec(/* Real */ ae_matrix* a, 8876 ae_int_t offs, 8877 ae_int_t m, 8878 ae_int_t n, 8879 /* Integer */ ae_vector* pivots, 8880 /* Real */ ae_vector* tmp, 8881 ae_state *_state); 8882 #endif 8883 #if defined(AE_COMPILE_SPTRF) || !defined(AE_PARTIAL_BUILD) 8884 ae_bool sptrflu(sparsematrix* a, 8885 ae_int_t pivottype, 8886 /* Integer */ ae_vector* pr, 8887 /* Integer */ ae_vector* pc, 8888 sluv2buffer* buf, 8889 ae_state *_state); 8890 void _sluv2list1matrix_init(void* _p, ae_state *_state, ae_bool make_automatic); 8891 void _sluv2list1matrix_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8892 void _sluv2list1matrix_clear(void* _p); 8893 void _sluv2list1matrix_destroy(void* _p); 8894 void _sluv2sparsetrail_init(void* _p, ae_state *_state, ae_bool make_automatic); 8895 void _sluv2sparsetrail_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8896 void _sluv2sparsetrail_clear(void* _p); 8897 void _sluv2sparsetrail_destroy(void* _p); 8898 void _sluv2densetrail_init(void* _p, ae_state *_state, ae_bool make_automatic); 8899 void _sluv2densetrail_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8900 void _sluv2densetrail_clear(void* _p); 8901 void _sluv2densetrail_destroy(void* _p); 8902 void _sluv2buffer_init(void* _p, ae_state *_state, ae_bool make_automatic); 8903 void _sluv2buffer_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8904 void _sluv2buffer_clear(void* _p); 8905 void _sluv2buffer_destroy(void* _p); 8906 #endif 8907 #if defined(AE_COMPILE_AMDORDERING) || !defined(AE_PARTIAL_BUILD) 8908 void generateamdpermutation(sparsematrix* a, 8909 ae_int_t n, 8910 /* Integer */ ae_vector* perm, 8911 /* Integer */ ae_vector* invperm, 8912 amdbuffer* buf, 8913 ae_state *_state); 8914 ae_int_t generateamdpermutationx(sparsematrix* a, 8915 ae_int_t n, 8916 /* Integer */ ae_vector* perm, 8917 /* Integer */ ae_vector* invperm, 8918 ae_int_t amdtype, 8919 amdbuffer* buf, 8920 ae_state *_state); 8921 void _amdnset_init(void* _p, ae_state *_state, ae_bool make_automatic); 8922 void _amdnset_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8923 void _amdnset_clear(void* _p); 8924 void _amdnset_destroy(void* _p); 8925 void _amdknset_init(void* _p, ae_state *_state, ae_bool make_automatic); 8926 void _amdknset_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8927 void _amdknset_clear(void* _p); 8928 void _amdknset_destroy(void* _p); 8929 void _amdvertexset_init(void* _p, ae_state *_state, ae_bool make_automatic); 8930 void _amdvertexset_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8931 void _amdvertexset_clear(void* _p); 8932 void _amdvertexset_destroy(void* _p); 8933 void _amdllmatrix_init(void* _p, ae_state *_state, ae_bool make_automatic); 8934 void _amdllmatrix_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8935 void _amdllmatrix_clear(void* _p); 8936 void _amdllmatrix_destroy(void* _p); 8937 void _amdbuffer_init(void* _p, ae_state *_state, ae_bool make_automatic); 8938 void _amdbuffer_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8939 void _amdbuffer_clear(void* _p); 8940 void _amdbuffer_destroy(void* _p); 8941 #endif 8942 #if defined(AE_COMPILE_SPCHOL) || !defined(AE_PARTIAL_BUILD) 8943 ae_int_t spsymmgetmaxfastkernel(ae_state *_state); 8944 ae_bool spsymmanalyze(sparsematrix* a, 8945 ae_int_t facttype, 8946 ae_int_t permtype, 8947 spcholanalysis* analysis, 8948 ae_state *_state); 8949 void spsymmsetmodificationstrategy(spcholanalysis* analysis, 8950 ae_int_t modstrategy, 8951 double p0, 8952 double p1, 8953 double p2, 8954 double p3, 8955 ae_state *_state); 8956 void spsymmreload(spcholanalysis* analysis, 8957 sparsematrix* a, 8958 ae_state *_state); 8959 void spsymmreloaddiagonal(spcholanalysis* analysis, 8960 /* Real */ ae_vector* d, 8961 ae_state *_state); 8962 ae_bool spsymmfactorize(spcholanalysis* analysis, ae_state *_state); 8963 void spsymmextract(spcholanalysis* analysis, 8964 sparsematrix* a, 8965 /* Real */ ae_vector* d, 8966 /* Integer */ ae_vector* p, 8967 ae_state *_state); 8968 void spsymmsolve(spcholanalysis* analysis, 8969 /* Real */ ae_vector* b, 8970 ae_state *_state); 8971 void spsymmdiagerr(spcholanalysis* analysis, 8972 double* sumsq, 8973 double* errsq, 8974 ae_state *_state); 8975 void _spcholanalysis_init(void* _p, ae_state *_state, ae_bool make_automatic); 8976 void _spcholanalysis_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 8977 void _spcholanalysis_clear(void* _p); 8978 void _spcholanalysis_destroy(void* _p); 8979 #endif 8980 #if defined(AE_COMPILE_TRFAC) || !defined(AE_PARTIAL_BUILD) 8981 void rmatrixlu(/* Real */ ae_matrix* a, 8982 ae_int_t m, 8983 ae_int_t n, 8984 /* Integer */ ae_vector* pivots, 8985 ae_state *_state); 8986 void cmatrixlu(/* Complex */ ae_matrix* a, 8987 ae_int_t m, 8988 ae_int_t n, 8989 /* Integer */ ae_vector* pivots, 8990 ae_state *_state); 8991 ae_bool hpdmatrixcholesky(/* Complex */ ae_matrix* a, 8992 ae_int_t n, 8993 ae_bool isupper, 8994 ae_state *_state); 8995 ae_bool spdmatrixcholesky(/* Real */ ae_matrix* a, 8996 ae_int_t n, 8997 ae_bool isupper, 8998 ae_state *_state); 8999 void spdmatrixcholeskyupdateadd1(/* Real */ ae_matrix* a, 9000 ae_int_t n, 9001 ae_bool isupper, 9002 /* Real */ ae_vector* u, 9003 ae_state *_state); 9004 void spdmatrixcholeskyupdatefix(/* Real */ ae_matrix* a, 9005 ae_int_t n, 9006 ae_bool isupper, 9007 /* Boolean */ ae_vector* fix, 9008 ae_state *_state); 9009 void spdmatrixcholeskyupdateadd1buf(/* Real */ ae_matrix* a, 9010 ae_int_t n, 9011 ae_bool isupper, 9012 /* Real */ ae_vector* u, 9013 /* Real */ ae_vector* bufr, 9014 ae_state *_state); 9015 void spdmatrixcholeskyupdatefixbuf(/* Real */ ae_matrix* a, 9016 ae_int_t n, 9017 ae_bool isupper, 9018 /* Boolean */ ae_vector* fix, 9019 /* Real */ ae_vector* bufr, 9020 ae_state *_state); 9021 ae_bool sparselu(sparsematrix* a, 9022 ae_int_t pivottype, 9023 /* Integer */ ae_vector* p, 9024 /* Integer */ ae_vector* q, 9025 ae_state *_state); 9026 ae_bool sparsecholeskyskyline(sparsematrix* a, 9027 ae_int_t n, 9028 ae_bool isupper, 9029 ae_state *_state); 9030 ae_bool sparsecholesky(sparsematrix* a, ae_bool isupper, ae_state *_state); 9031 ae_bool sparsecholeskyp(sparsematrix* a, 9032 ae_bool isupper, 9033 /* Integer */ ae_vector* p, 9034 ae_state *_state); 9035 ae_bool sparsecholeskyanalyze(sparsematrix* a, 9036 ae_bool isupper, 9037 ae_int_t facttype, 9038 ae_int_t permtype, 9039 sparsedecompositionanalysis* analysis, 9040 ae_state *_state); 9041 void sparsecholeskysetmodtype(sparsedecompositionanalysis* analysis, 9042 ae_int_t modstrategy, 9043 double p0, 9044 double p1, 9045 double p2, 9046 double p3, 9047 ae_state *_state); 9048 ae_bool sparsecholeskyfactorize(sparsedecompositionanalysis* analysis, 9049 ae_bool needupper, 9050 sparsematrix* a, 9051 /* Real */ ae_vector* d, 9052 /* Integer */ ae_vector* p, 9053 ae_state *_state); 9054 void sparsecholeskyreload(sparsedecompositionanalysis* analysis, 9055 sparsematrix* a, 9056 ae_bool isupper, 9057 ae_state *_state); 9058 void rmatrixlup(/* Real */ ae_matrix* a, 9059 ae_int_t m, 9060 ae_int_t n, 9061 /* Integer */ ae_vector* pivots, 9062 ae_state *_state); 9063 void cmatrixlup(/* Complex */ ae_matrix* a, 9064 ae_int_t m, 9065 ae_int_t n, 9066 /* Integer */ ae_vector* pivots, 9067 ae_state *_state); 9068 void rmatrixplu(/* Real */ ae_matrix* a, 9069 ae_int_t m, 9070 ae_int_t n, 9071 /* Integer */ ae_vector* pivots, 9072 ae_state *_state); 9073 void cmatrixplu(/* Complex */ ae_matrix* a, 9074 ae_int_t m, 9075 ae_int_t n, 9076 /* Integer */ ae_vector* pivots, 9077 ae_state *_state); 9078 ae_bool spdmatrixcholeskyrec(/* Real */ ae_matrix* a, 9079 ae_int_t offs, 9080 ae_int_t n, 9081 ae_bool isupper, 9082 /* Real */ ae_vector* tmp, 9083 ae_state *_state); 9084 void _sparsedecompositionanalysis_init(void* _p, ae_state *_state, ae_bool make_automatic); 9085 void _sparsedecompositionanalysis_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 9086 void _sparsedecompositionanalysis_clear(void* _p); 9087 void _sparsedecompositionanalysis_destroy(void* _p); 9088 #endif 9089 #if defined(AE_COMPILE_BDSVD) || !defined(AE_PARTIAL_BUILD) 9090 ae_bool rmatrixbdsvd(/* Real */ ae_vector* d, 9091 /* Real */ ae_vector* e, 9092 ae_int_t n, 9093 ae_bool isupper, 9094 ae_bool isfractionalaccuracyrequired, 9095 /* Real */ ae_matrix* u, 9096 ae_int_t nru, 9097 /* Real */ ae_matrix* c, 9098 ae_int_t ncc, 9099 /* Real */ ae_matrix* vt, 9100 ae_int_t ncvt, 9101 ae_state *_state); 9102 ae_bool bidiagonalsvddecomposition(/* Real */ ae_vector* d, 9103 /* Real */ ae_vector* e, 9104 ae_int_t n, 9105 ae_bool isupper, 9106 ae_bool isfractionalaccuracyrequired, 9107 /* Real */ ae_matrix* u, 9108 ae_int_t nru, 9109 /* Real */ ae_matrix* c, 9110 ae_int_t ncc, 9111 /* Real */ ae_matrix* vt, 9112 ae_int_t ncvt, 9113 ae_state *_state); 9114 #endif 9115 #if defined(AE_COMPILE_SVD) || !defined(AE_PARTIAL_BUILD) 9116 ae_bool rmatrixsvd(/* Real */ ae_matrix* a, 9117 ae_int_t m, 9118 ae_int_t n, 9119 ae_int_t uneeded, 9120 ae_int_t vtneeded, 9121 ae_int_t additionalmemory, 9122 /* Real */ ae_vector* w, 9123 /* Real */ ae_matrix* u, 9124 /* Real */ ae_matrix* vt, 9125 ae_state *_state); 9126 #endif 9127 #if defined(AE_COMPILE_RCOND) || !defined(AE_PARTIAL_BUILD) 9128 double rmatrixrcond1(/* Real */ ae_matrix* a, 9129 ae_int_t n, 9130 ae_state *_state); 9131 double rmatrixrcondinf(/* Real */ ae_matrix* a, 9132 ae_int_t n, 9133 ae_state *_state); 9134 double spdmatrixrcond(/* Real */ ae_matrix* a, 9135 ae_int_t n, 9136 ae_bool isupper, 9137 ae_state *_state); 9138 double rmatrixtrrcond1(/* Real */ ae_matrix* a, 9139 ae_int_t n, 9140 ae_bool isupper, 9141 ae_bool isunit, 9142 ae_state *_state); 9143 double rmatrixtrrcondinf(/* Real */ ae_matrix* a, 9144 ae_int_t n, 9145 ae_bool isupper, 9146 ae_bool isunit, 9147 ae_state *_state); 9148 double hpdmatrixrcond(/* Complex */ ae_matrix* a, 9149 ae_int_t n, 9150 ae_bool isupper, 9151 ae_state *_state); 9152 double cmatrixrcond1(/* Complex */ ae_matrix* a, 9153 ae_int_t n, 9154 ae_state *_state); 9155 double cmatrixrcondinf(/* Complex */ ae_matrix* a, 9156 ae_int_t n, 9157 ae_state *_state); 9158 double rmatrixlurcond1(/* Real */ ae_matrix* lua, 9159 ae_int_t n, 9160 ae_state *_state); 9161 double rmatrixlurcondinf(/* Real */ ae_matrix* lua, 9162 ae_int_t n, 9163 ae_state *_state); 9164 double spdmatrixcholeskyrcond(/* Real */ ae_matrix* a, 9165 ae_int_t n, 9166 ae_bool isupper, 9167 ae_state *_state); 9168 double hpdmatrixcholeskyrcond(/* Complex */ ae_matrix* a, 9169 ae_int_t n, 9170 ae_bool isupper, 9171 ae_state *_state); 9172 double cmatrixlurcond1(/* Complex */ ae_matrix* lua, 9173 ae_int_t n, 9174 ae_state *_state); 9175 double cmatrixlurcondinf(/* Complex */ ae_matrix* lua, 9176 ae_int_t n, 9177 ae_state *_state); 9178 double cmatrixtrrcond1(/* Complex */ ae_matrix* a, 9179 ae_int_t n, 9180 ae_bool isupper, 9181 ae_bool isunit, 9182 ae_state *_state); 9183 double cmatrixtrrcondinf(/* Complex */ ae_matrix* a, 9184 ae_int_t n, 9185 ae_bool isupper, 9186 ae_bool isunit, 9187 ae_state *_state); 9188 double rcondthreshold(ae_state *_state); 9189 #endif 9190 #if defined(AE_COMPILE_FBLS) || !defined(AE_PARTIAL_BUILD) 9191 void fblscholeskysolve(/* Real */ ae_matrix* cha, 9192 double sqrtscalea, 9193 ae_int_t n, 9194 ae_bool isupper, 9195 /* Real */ ae_vector* xb, 9196 /* Real */ ae_vector* tmp, 9197 ae_state *_state); 9198 void fblssolvecgx(/* Real */ ae_matrix* a, 9199 ae_int_t m, 9200 ae_int_t n, 9201 double alpha, 9202 /* Real */ ae_vector* b, 9203 /* Real */ ae_vector* x, 9204 /* Real */ ae_vector* buf, 9205 ae_state *_state); 9206 void fblscgcreate(/* Real */ ae_vector* x, 9207 /* Real */ ae_vector* b, 9208 ae_int_t n, 9209 fblslincgstate* state, 9210 ae_state *_state); 9211 ae_bool fblscgiteration(fblslincgstate* state, ae_state *_state); 9212 void fblsgmrescreate(/* Real */ ae_vector* b, 9213 ae_int_t n, 9214 ae_int_t k, 9215 fblsgmresstate* state, 9216 ae_state *_state); 9217 ae_bool fblsgmresiteration(fblsgmresstate* state, ae_state *_state); 9218 void fblssolvels(/* Real */ ae_matrix* a, 9219 /* Real */ ae_vector* b, 9220 ae_int_t m, 9221 ae_int_t n, 9222 /* Real */ ae_vector* tmp0, 9223 /* Real */ ae_vector* tmp1, 9224 /* Real */ ae_vector* tmp2, 9225 ae_state *_state); 9226 void _fblslincgstate_init(void* _p, ae_state *_state, ae_bool make_automatic); 9227 void _fblslincgstate_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 9228 void _fblslincgstate_clear(void* _p); 9229 void _fblslincgstate_destroy(void* _p); 9230 void _fblsgmresstate_init(void* _p, ae_state *_state, ae_bool make_automatic); 9231 void _fblsgmresstate_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 9232 void _fblsgmresstate_clear(void* _p); 9233 void _fblsgmresstate_destroy(void* _p); 9234 #endif 9235 #if defined(AE_COMPILE_NORMESTIMATOR) || !defined(AE_PARTIAL_BUILD) 9236 void normestimatorcreate(ae_int_t m, 9237 ae_int_t n, 9238 ae_int_t nstart, 9239 ae_int_t nits, 9240 normestimatorstate* state, 9241 ae_state *_state); 9242 void normestimatorsetseed(normestimatorstate* state, 9243 ae_int_t seedval, 9244 ae_state *_state); 9245 ae_bool normestimatoriteration(normestimatorstate* state, 9246 ae_state *_state); 9247 void normestimatorestimatesparse(normestimatorstate* state, 9248 sparsematrix* a, 9249 ae_state *_state); 9250 void normestimatorresults(normestimatorstate* state, 9251 double* nrm, 9252 ae_state *_state); 9253 void normestimatorrestart(normestimatorstate* state, ae_state *_state); 9254 void _normestimatorstate_init(void* _p, ae_state *_state, ae_bool make_automatic); 9255 void _normestimatorstate_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 9256 void _normestimatorstate_clear(void* _p); 9257 void _normestimatorstate_destroy(void* _p); 9258 #endif 9259 #if defined(AE_COMPILE_MATINV) || !defined(AE_PARTIAL_BUILD) 9260 void rmatrixluinverse(/* Real */ ae_matrix* a, 9261 /* Integer */ ae_vector* pivots, 9262 ae_int_t n, 9263 ae_int_t* info, 9264 matinvreport* rep, 9265 ae_state *_state); 9266 void rmatrixinverse(/* Real */ ae_matrix* a, 9267 ae_int_t n, 9268 ae_int_t* info, 9269 matinvreport* rep, 9270 ae_state *_state); 9271 void cmatrixluinverse(/* Complex */ ae_matrix* a, 9272 /* Integer */ ae_vector* pivots, 9273 ae_int_t n, 9274 ae_int_t* info, 9275 matinvreport* rep, 9276 ae_state *_state); 9277 void cmatrixinverse(/* Complex */ ae_matrix* a, 9278 ae_int_t n, 9279 ae_int_t* info, 9280 matinvreport* rep, 9281 ae_state *_state); 9282 void spdmatrixcholeskyinverse(/* Real */ ae_matrix* a, 9283 ae_int_t n, 9284 ae_bool isupper, 9285 ae_int_t* info, 9286 matinvreport* rep, 9287 ae_state *_state); 9288 void spdmatrixinverse(/* Real */ ae_matrix* a, 9289 ae_int_t n, 9290 ae_bool isupper, 9291 ae_int_t* info, 9292 matinvreport* rep, 9293 ae_state *_state); 9294 void hpdmatrixcholeskyinverse(/* Complex */ ae_matrix* a, 9295 ae_int_t n, 9296 ae_bool isupper, 9297 ae_int_t* info, 9298 matinvreport* rep, 9299 ae_state *_state); 9300 void hpdmatrixinverse(/* Complex */ ae_matrix* a, 9301 ae_int_t n, 9302 ae_bool isupper, 9303 ae_int_t* info, 9304 matinvreport* rep, 9305 ae_state *_state); 9306 void rmatrixtrinverse(/* Real */ ae_matrix* a, 9307 ae_int_t n, 9308 ae_bool isupper, 9309 ae_bool isunit, 9310 ae_int_t* info, 9311 matinvreport* rep, 9312 ae_state *_state); 9313 void cmatrixtrinverse(/* Complex */ ae_matrix* a, 9314 ae_int_t n, 9315 ae_bool isupper, 9316 ae_bool isunit, 9317 ae_int_t* info, 9318 matinvreport* rep, 9319 ae_state *_state); 9320 void spdmatrixcholeskyinverserec(/* Real */ ae_matrix* a, 9321 ae_int_t offs, 9322 ae_int_t n, 9323 ae_bool isupper, 9324 /* Real */ ae_vector* tmp, 9325 ae_state *_state); 9326 ae_bool _trypexec_spdmatrixcholeskyinverserec(/* Real */ ae_matrix* a, 9327 ae_int_t offs, 9328 ae_int_t n, 9329 ae_bool isupper, 9330 /* Real */ ae_vector* tmp, ae_state *_state); 9331 void _matinvreport_init(void* _p, ae_state *_state, ae_bool make_automatic); 9332 void _matinvreport_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool make_automatic); 9333 void _matinvreport_clear(void* _p); 9334 void _matinvreport_destroy(void* _p); 9335 #endif 9336 #if defined(AE_COMPILE_INVERSEUPDATE) || !defined(AE_PARTIAL_BUILD) 9337 void rmatrixinvupdatesimple(/* Real */ ae_matrix* inva, 9338 ae_int_t n, 9339 ae_int_t updrow, 9340 ae_int_t updcolumn, 9341 double updval, 9342 ae_state *_state); 9343 void rmatrixinvupdaterow(/* Real */ ae_matrix* inva, 9344 ae_int_t n, 9345 ae_int_t updrow, 9346 /* Real */ ae_vector* v, 9347 ae_state *_state); 9348 void rmatrixinvupdatecolumn(/* Real */ ae_matrix* inva, 9349 ae_int_t n, 9350 ae_int_t updcolumn, 9351 /* Real */ ae_vector* u, 9352 ae_state *_state); 9353 void rmatrixinvupdateuv(/* Real */ ae_matrix* inva, 9354 ae_int_t n, 9355 /* Real */ ae_vector* u, 9356 /* Real */ ae_vector* v, 9357 ae_state *_state); 9358 #endif 9359 #if defined(AE_COMPILE_SCHUR) || !defined(AE_PARTIAL_BUILD) 9360 ae_bool rmatrixschur(/* Real */ ae_matrix* a, 9361 ae_int_t n, 9362 /* Real */ ae_matrix* s, 9363 ae_state *_state); 9364 #endif 9365 #if defined(AE_COMPILE_SPDGEVD) || !defined(AE_PARTIAL_BUILD) 9366 ae_bool smatrixgevd(/* Real */ ae_matrix* a, 9367 ae_int_t n, 9368 ae_bool isuppera, 9369 /* Real */ ae_matrix* b, 9370 ae_bool isupperb, 9371 ae_int_t zneeded, 9372 ae_int_t problemtype, 9373 /* Real */ ae_vector* d, 9374 /* Real */ ae_matrix* z, 9375 ae_state *_state); 9376 ae_bool smatrixgevdreduce(/* Real */ ae_matrix* a, 9377 ae_int_t n, 9378 ae_bool isuppera, 9379 /* Real */ ae_matrix* b, 9380 ae_bool isupperb, 9381 ae_int_t problemtype, 9382 /* Real */ ae_matrix* r, 9383 ae_bool* isupperr, 9384 ae_state *_state); 9385 #endif 9386 #if defined(AE_COMPILE_MATDET) || !defined(AE_PARTIAL_BUILD) 9387 double rmatrixludet(/* Real */ ae_matrix* a, 9388 /* Integer */ ae_vector* pivots, 9389 ae_int_t n, 9390 ae_state *_state); 9391 double rmatrixdet(/* Real */ ae_matrix* a, 9392 ae_int_t n, 9393 ae_state *_state); 9394 ae_complex cmatrixludet(/* Complex */ ae_matrix* a, 9395 /* Integer */ ae_vector* pivots, 9396 ae_int_t n, 9397 ae_state *_state); 9398 ae_complex cmatrixdet(/* Complex */ ae_matrix* a, 9399 ae_int_t n, 9400 ae_state *_state); 9401 double spdmatrixcholeskydet(/* Real */ ae_matrix* a, 9402 ae_int_t n, 9403 ae_state *_state); 9404 double spdmatrixdet(/* Real */ ae_matrix* a, 9405 ae_int_t n, 9406 ae_bool isupper, 9407 ae_state *_state); 9408 #endif 9409 9410 } 9411 #endif 9412 9413