1 /* FrontMtx.h */ 2 3 #include "../Pencil.h" 4 #include "../ETree.h" 5 #include "../IVL.h" 6 #include "../PatchAndGoInfo.h" 7 #include "../Chv.h" 8 #include "../ChvManager.h" 9 #include "../ChvList.h" 10 #include "../SubMtx.h" 11 #include "../SubMtxList.h" 12 #include "../SubMtxManager.h" 13 #include "../DenseMtx.h" 14 #include "../Ideq.h" 15 #include "../SolveMap.h" 16 #include "../Lock.h" 17 #include "../I2Ohash.h" 18 19 #include "../SPOOLES.h" 20 21 /*--------------------------------------------------------------------*/ 22 /* 23 ------------------------------------------------------------------- 24 the FrontMtx object is used to compute and store a matrix 25 factorization in serial, multithreaded and MPI modes. 26 27 there are two data modes: 28 1 --> data is stored by fronts, a 1-D data decomposition. 29 we use five pointer vectors (p_mtxDJJ[], p_mtxUJJ[], 30 p_mtxUJN[], p_mtxLJJ[] and p_mtxLNJ[]) to store pointers 31 to the factor submatrices 32 2 --> data is stored by submatrices, a 2-D data decomposition. 33 we use two hash objects (lowerhash and upperhash), a 34 pointer vector p_mtxDJJ[] and two IVL objects (lowerblockIVL 35 and upperblockIVL) to store the structure of the matrix. 36 37 nfront -- number of fronts in the matrix 38 neqns -- number of rows and columns in the matrix 39 type -- type of entries 40 1 -- real 41 2 -- complex 42 symmetryflag -- flag to specify symmetry of the matrix 43 0 --> symmetric structure, symmetric entries 44 1 --> symmetric structure, nonsymmetric entries 45 2 --> nonsymmetric structure, nonsymmetric entries 46 sparsityflag -- flag to specify dense or sparse fronts 47 0 --> dense fronts 48 1 --> sparse fronts 49 pivotingflag -- flag to specify pivoting enabled 50 0 --> pivoting not used 51 1 --> pivoting used 52 dataMode -- flag to specify storage mode 53 1 --> 1-dimensional data decomposition, used for factorization 54 2 --> 2-dimensional data decomposition, used for solves 55 nentD -- number of entries in the diagonal matrix 56 nentL -- number of entries in the lower triangular matrix 57 nentU -- number of entries in the upper triangular matrix 58 59 tree -- pointer to an Tree object that holds the tree of fronts 60 frontETree -- pointer to an ETree object that holds the front tree 61 symbfacIVL -- pointer to an IVL object that holds 62 the symbolic factorization 63 64 frontsizesIV -- pointer to an IV object that holds the number of 65 internal rows and columns in each front 66 rowadjIVL -- pointer to an IVL object that holds the row ids 67 of the fronts, used only for nonsymmetric matrices with pivoting 68 coladjIVL -- pointer to an IVL object that holds the column ids 69 of the fronts, used only with pivoting 70 71 p_mtxDJJ -- vector of pointers to the diagonal D_{J,J} objects 72 p_mtxUJJ -- vector of pointers to the upper U_{J,J} objects 73 p_mtxUJN -- vector of pointers to the upper U_{J,N} objects 74 p_mtxLJJ -- vector of pointers to the lower L_{J,J} objects 75 p_mtxLNJ -- vector of pointers to the lower L_{N,J} objects 76 77 lowerblockIVL -- pointer to an IVL object that holds the sparsity 78 structure of the block L matrix, i.e., front-front edges, 79 used only for nonsymmetric matrices with pivoting 80 upperblockIVL -- pointer to an IVL object that holds the sparsity 81 structure of the block U matrix, i.e., front-front edges 82 lowerhash -- pointer to a hash table object that holds the 83 submatrices in L, used only for nonsymmetric factorizations 84 upperhash -- pointer to a hash table object that holds the 85 submatrices in U 86 87 manager -- object to manage instances of Mtx objects 88 lock -- mutex object that controls access to allocating 89 storage in IVL and DVL objects, can be NULL 90 nlocks -- number of times the lock was locked 91 patchinfo -- information object needed for special factorizations 92 93 created -- 98feb27, cca 94 ------------------------------------------------------------------- 95 */ 96 typedef struct _FrontMtx FrontMtx ; 97 struct _FrontMtx { 98 int nfront ; 99 int neqns ; 100 int type ; 101 int symmetryflag ; 102 int sparsityflag ; 103 int pivotingflag ; 104 int dataMode ; 105 int nentD ; 106 int nentL ; 107 int nentU ; 108 Tree *tree ; 109 ETree *frontETree ; 110 IV *frontsizesIV ; 111 IVL *symbfacIVL ; 112 IVL *rowadjIVL ; 113 IVL *coladjIVL ; 114 IVL *lowerblockIVL ; 115 IVL *upperblockIVL ; 116 SubMtx **p_mtxDJJ ; 117 SubMtx **p_mtxUJJ ; 118 SubMtx **p_mtxUJN ; 119 SubMtx **p_mtxLJJ ; 120 SubMtx **p_mtxLNJ ; 121 I2Ohash *lowerhash ; 122 I2Ohash *upperhash ; 123 SubMtxManager *manager ; 124 Lock *lock ; 125 PatchAndGoInfo *patchinfo ; 126 int nlocks ; 127 } ; 128 129 #define FRONTMTX_IS_REAL(mtx) ((mtx)->type == SPOOLES_REAL) 130 #define FRONTMTX_IS_COMPLEX(mtx) ((mtx)->type == SPOOLES_COMPLEX) 131 132 #define FRONTMTX_IS_SYMMETRIC(mtx) \ 133 ((mtx)->symmetryflag == SPOOLES_SYMMETRIC) 134 #define FRONTMTX_IS_HERMITIAN(mtx) \ 135 ((mtx)->symmetryflag == SPOOLES_HERMITIAN) 136 #define FRONTMTX_IS_NONSYMMETRIC(mtx) \ 137 ((mtx)->symmetryflag == SPOOLES_NONSYMMETRIC) 138 139 #define FRONTMTX_DENSE_FRONTS 0 140 #define FRONTMTX_SPARSE_FRONTS 1 141 #define FRONTMTX_IS_DENSE_FRONTS(mtx) \ 142 ((mtx)->sparsityflag == FRONTMTX_DENSE_FRONTS) 143 #define FRONTMTX_IS_SPARSE_FRONTS(mtx) \ 144 ((mtx)->sparsityflag == FRONTMTX_SPARSE_FRONTS) 145 146 #define FRONTMTX_IS_PIVOTING(mtx) \ 147 ((mtx)->pivotingflag == SPOOLES_PIVOTING) 148 149 #define FRONTMTX_1D_MODE 1 150 #define FRONTMTX_2D_MODE 2 151 #define FRONTMTX_IS_1D_MODE(mtx) \ 152 ((mtx)->dataMode == FRONTMTX_1D_MODE) 153 #define FRONTMTX_IS_2D_MODE(mtx) \ 154 ((mtx)->dataMode == FRONTMTX_2D_MODE) 155 156 #define NO_LOCK 0 157 #define LOCK_IN_PROCESS 1 158 #define LOCK_IN_ALL_PROCESSES 2 159 /*--------------------------------------------------------------------*/ 160 /* 161 ------------------------------------------------------------------------ 162 ----- methods found in basics.c ---------------------------------------- 163 ------------------------------------------------------------------------ 164 */ 165 /* 166 ----------------------- 167 simplest constructor 168 169 created -- 98may04, cca 170 ----------------------- 171 */ 172 FrontMtx * 173 FrontMtx_new ( 174 void 175 ) ; 176 /* 177 ----------------------- 178 set the default fields 179 180 created -- 98may04, cca 181 ----------------------- 182 */ 183 void 184 FrontMtx_setDefaultFields ( 185 FrontMtx *frontmtx 186 ) ; 187 /* 188 -------------------------------------------------- 189 clear the data fields, releasing allocated storage 190 191 created -- 98may04, cca 192 -------------------------------------------------- 193 */ 194 void 195 FrontMtx_clearData ( 196 FrontMtx *frontmtx 197 ) ; 198 /* 199 ------------------------------------------ 200 destructor, free's the object and its data 201 202 created -- 98may04, cca 203 ------------------------------------------ 204 */ 205 void 206 FrontMtx_free ( 207 FrontMtx *frontmtx 208 ) ; 209 /*--------------------------------------------------------------------*/ 210 /* 211 ------------------------------------------------------------------------ 212 ----- methods found in instance.c -------------------------------------- 213 ------------------------------------------------------------------------ 214 */ 215 /* 216 -------------------------------------- 217 purpose -- return the number of fronts 218 219 created -- 98may04, cca 220 -------------------------------------- 221 */ 222 int 223 FrontMtx_nfront ( 224 FrontMtx *frontmtx 225 ) ; 226 /* 227 ----------------------------------------- 228 purpose -- return the number of equations 229 230 created -- 98may04, cca 231 ----------------------------------------- 232 */ 233 int 234 FrontMtx_neqns ( 235 FrontMtx *frontmtx 236 ) ; 237 /* 238 ---------------------------------------------------- 239 purpose -- return a pointer to the front Tree object 240 241 created -- 98may04, cca 242 ---------------------------------------------------- 243 */ 244 Tree * 245 FrontMtx_frontTree ( 246 FrontMtx *frontmtx 247 ) ; 248 /* 249 ---------------------------------------------------------------- 250 simple method to return the dimensions of front J and the number 251 of bytes necessary for the Chv object to hold the front. 252 253 created -- 98may04, cca 254 ---------------------------------------------------------------- 255 */ 256 void 257 FrontMtx_initialFrontDimensions ( 258 FrontMtx *frontmtx, 259 int J, 260 int *pnD, 261 int *pnL, 262 int *pnU, 263 int *pnbytes 264 ) ; 265 /* 266 --------------------------------------------------------- 267 return the number of internal rows and columns in front J 268 269 created -- 98may04, cca 270 --------------------------------------------------------- 271 */ 272 int 273 FrontMtx_frontSize ( 274 FrontMtx *frontmtx, 275 int J 276 ) ; 277 /* 278 ------------------------------------------------------ 279 set the number of internal rows and columns in front J 280 281 created -- 98may04, cca 282 ------------------------------------------------------ 283 */ 284 void 285 FrontMtx_setFrontSize ( 286 FrontMtx *frontmtx, 287 int J, 288 int size 289 ) ; 290 /* 291 --------------------------------------------- 292 fill *pncol with the number of columns and 293 *pcolind with a pointer to the column indices 294 295 created -- 98may04, cca 296 --------------------------------------------- 297 */ 298 void 299 FrontMtx_columnIndices ( 300 FrontMtx *frontmtx, 301 int J, 302 int *pncol, 303 int **pcolind 304 ) ; 305 /* 306 ------------------------------------------- 307 fill *pnrow with the number of rows and 308 *prowind with a pointer to the rows indices 309 310 created -- 98may04, cca 311 ------------------------------------------- 312 */ 313 void 314 FrontMtx_rowIndices ( 315 FrontMtx *frontmtx, 316 int J, 317 int *pnrow, 318 int **prowind 319 ) ; 320 /* 321 ----------------------------------------------------------- 322 purpose -- return a pointer to the (J,J) diagonal submatrix 323 324 created -- 98may04, cca 325 ----------------------------------------------------------- 326 */ 327 SubMtx * 328 FrontMtx_diagMtx ( 329 FrontMtx *frontmtx, 330 int J 331 ) ; 332 /* 333 -------------------------------------------------------- 334 purpose -- return a pointer to the (J,K) upper submatrix 335 336 created -- 98may04, cca 337 -------------------------------------------------------- 338 */ 339 SubMtx * 340 FrontMtx_upperMtx ( 341 FrontMtx *frontmtx, 342 int J, 343 int K 344 ) ; 345 /* 346 -------------------------------------------------------- 347 purpose -- return a pointer to the (K,J) lower submatrix 348 349 created -- 98may04, cca 350 -------------------------------------------------------- 351 */ 352 SubMtx * 353 FrontMtx_lowerMtx ( 354 FrontMtx *frontmtx, 355 int K, 356 int J 357 ) ; 358 /* 359 -------------------------------------------------- 360 purpose -- fill *pnadj with the number of fronts K 361 such that L_{K,J} != 0 and *padj with a 362 pointer to a list of those fronts 363 364 created -- 98may04, cca 365 -------------------------------------------------- 366 */ 367 void 368 FrontMtx_lowerAdjFronts ( 369 FrontMtx *frontmtx, 370 int J, 371 int *pnadj, 372 int **padj 373 ) ; 374 /* 375 -------------------------------------------------- 376 purpose -- fill *pnadj with the number of fronts K 377 such that U_{J,K} != 0 and *padj with a 378 pointer to a list of those fronts 379 380 created -- 98may04, cca 381 -------------------------------------------------- 382 */ 383 void 384 FrontMtx_upperAdjFronts ( 385 FrontMtx *frontmtx, 386 int J, 387 int *pnadj, 388 int **padj 389 ) ; 390 /* 391 ------------------------------------------------------ 392 purpose -- return the number of nonzero L_{K,J} blocks 393 394 created -- 98may04, cca 395 ------------------------------------------------------ 396 */ 397 int 398 FrontMtx_nLowerBlocks ( 399 FrontMtx *frontmtx 400 ) ; 401 /* 402 ------------------------------------------------------ 403 purpose -- return the number of nonzero U_{K,J} blocks 404 405 created -- 98may04, cca 406 ------------------------------------------------------ 407 */ 408 int 409 FrontMtx_nUpperBlocks ( 410 FrontMtx *frontmtx 411 ) ; 412 /* 413 --------------------------------------------------------- 414 purpose -- return a pointer to the upper block IVL object 415 416 created -- 98jun13, cca 417 --------------------------------------------------------- 418 */ 419 IVL * 420 FrontMtx_upperBlockIVL ( 421 FrontMtx *frontmtx 422 ) ; 423 /* 424 --------------------------------------------------------- 425 purpose -- return a pointer to the lower block IVL object 426 427 created -- 98jun13, cca 428 --------------------------------------------------------- 429 */ 430 IVL * 431 FrontMtx_lowerBlockIVL ( 432 FrontMtx *frontmtx 433 ) ; 434 /*--------------------------------------------------------------------*/ 435 /* 436 ------------------------------------------------------------------------ 437 ----- methods found in init.c ------------------------------------------ 438 ------------------------------------------------------------------------ 439 */ 440 /* 441 ------------------------------------------------------------------ 442 purpose -- basic initializer 443 444 frontETree -- ETree object that stores the front tree 445 symbfacIVL -- IVL object that stores the symbolic factorization 446 manager -- SubMtxManager object to manage SubMtx objects 447 type -- type of entries 448 SPOOLES_REAL --> real 449 SPOOLES_COMPLEX --> complex 450 symmetryflag -- symmetry flag, 451 SPOOLES_SYMMETRIC --> symmetric structure and entries 452 SPOOLES_HERMITIAN --> hermitian (complex only) 453 SPOOLES_NONSYMMETRIC --> nonsymmetric entries 454 sparsityflag -- flag to specify dense or sparse fronts 455 FRONTMTX_DENSE_FRONTS --> dense fronts 456 FRONTMTX_SPARSE_FRONTS --> sparse fronts 457 pivotingflag -- flag to specify pivoting enabled 458 SPOOLES_NO_PIVOTING --> pivoting not used 459 SPOOLES_PIVOTING --> pivoting used 460 461 in a multithreaded environment, we need to protect the critical 462 section where data is allocated. we use a lockflag to do this. 463 in a serial or distributed environment, use lockflag = 0. 464 465 lockflag -- flag to specify lock status 466 NO_LOCK --> mutex lock is not allocated or initialized 467 LOCK_IN_PROCESS --> mutex lock is allocated and 468 it can synchronize only threads in this process. 469 LOCK_OVER_ALL_PROCESSES --> mutex lock is allocated and 470 it can synchronize only threads in this and other processes. 471 472 in a distributed environment we need to specify which process 473 owns each front. when we can preallocate data structures 474 (when there is no pivoting and dense fronts are stored) we 475 need each process to determine what parts of the data it 476 can allocate and set up. in a serial or multithreaded 477 environment, use ownersIV = NULL. 478 479 ownersIV -- map from fronts to owning processes 480 myid -- id of this process. 481 482 submatrices (be they lower, diagonal, block diagonal, upper) 483 are stored in SubMtx objects. the management of these objects, 484 (allocation and deallocation) is managed by the SubMtxManager 485 manager object. 486 487 manager -- SubMtxManager object to handle the submatrices 488 489 created -- 98may04, cca 490 ------------------------------------------------------------------ 491 */ 492 void 493 FrontMtx_init ( 494 FrontMtx *frontmtx, 495 ETree *frontETree, 496 IVL *symbfacIVL, 497 int type, 498 int symmetryflag, 499 int sparsityflag, 500 int pivotingflag, 501 int lockflag, 502 int myid, 503 IV *ownersIV, 504 SubMtxManager *manager, 505 int msglvl, 506 FILE *msgFile 507 ) ; 508 /*--------------------------------------------------------------------*/ 509 /* 510 ------------------------------------------------------------------------ 511 ----- methods found in factor.c ---------------------------------------- 512 ------------------------------------------------------------------------ 513 */ 514 /* 515 ------------------------------------------------------------------- 516 compute an (U^T + I)D(I + U) or (L + I)D(I + L) factorization of A. 517 this is a wrapper method around FrontMtx_factorPencil(). 518 519 input -- 520 521 frontmtx -- pointer to the FrontMtx object that will hold 522 the factorization 523 pencil -- pointer to the Pencil object that holds A + sigma*B 524 tau -- upper bound on entries in L and U, 525 used only when pivoting enabled 526 droptol -- lower bound on entries in L and U, 527 used only when sparsity enabled 528 perror -- error flag, on return 529 *perror >= 0 --> factorization failed at front *perror 530 *perror < 0 --> factorization succeeded 531 cpus[] -- timing array 532 cpus[0] -- initialize fronts 533 cpus[1] -- load original entries 534 cpus[2] -- get updates from descendents 535 cpus[3] -- assembled postponed data 536 cpus[4] -- factor the front 537 cpus[5] -- extract postponed data 538 cpus[6] -- store factor entries 539 cpus[7] -- miscellaneous time 540 cpus[8] -- total time 541 stats[] -- statistics array 542 stats[0] -- # of pivots 543 stats[1] -- # of pivot tests 544 stats[2] -- # of delayed rows and columns 545 stats[3] -- # of entries in D 546 stats[4] -- # of entries in L 547 stats[5] -- # of entries in U 548 msglvl -- message level 549 msgFile -- message file 550 551 created -- 98mar27, cca 552 modified -- 98mar27, cca 553 perror added to argument list 554 ------------------------------------------------------------------- 555 */ 556 Chv * 557 FrontMtx_factorInpMtx ( 558 FrontMtx *frontmtx, 559 InpMtx *inpmtx, 560 double tau, 561 double droptol, 562 ChvManager *chvmanager, 563 int *perror, 564 double cpus[], 565 int stats[], 566 int msglvl, 567 FILE *msgFile 568 ) ; 569 /* 570 ------------------------------------------------------------------- 571 compute an (U^T + I)D(I + U) or (L + I)D(I + L) 572 factorization of A + sigma*B. 573 574 input -- 575 576 frontmtx -- pointer to the FrontMtx object that will hold 577 the factorization 578 pencil -- pointer to the Pencil object that holds A + sigma*B 579 tau -- upper bound on entries in L and U, 580 used only when pivoting enabled 581 droptol -- lower bound on entries in L and U, 582 used only when sparsity enabled 583 perror -- error flag, on return 584 *perror >= 0 --> factorization failed at front *perror 585 *perror < 0 --> factorization succeeded 586 cpus[] -- timing array 587 cpus[0] -- initialize fronts 588 cpus[1] -- load original entries 589 cpus[2] -- get updates from descendents 590 cpus[3] -- assembled postponed data 591 cpus[4] -- factor the front 592 cpus[5] -- extract postponed data 593 cpus[6] -- store factor entries 594 cpus[7] -- miscellaneous time 595 cpus[8] -- total time 596 stats[] -- statistics array 597 stats[0] -- # of pivots 598 stats[1] -- # of pivot tests 599 stats[2] -- # of delayed rows and columns 600 stats[3] -- # of entries in D 601 stats[4] -- # of entries in L 602 stats[5] -- # of entries in U 603 msglvl -- message level 604 msgFile -- message file 605 606 created -- 98mar27, cca 607 modified -- 98mar27, cca 608 perror added to argument list 609 ------------------------------------------------------------------- 610 */ 611 Chv * 612 FrontMtx_factorPencil ( 613 FrontMtx *frontmtx, 614 Pencil *pencil, 615 double tau, 616 double droptol, 617 ChvManager *chvmanager, 618 int *perror, 619 double cpus[], 620 int stats[], 621 int msglvl, 622 FILE *msgFile 623 ) ; 624 /*--------------------------------------------------------------------*/ 625 /* 626 ------------------------------------------------------------------------ 627 ----- methods found in factorUtil.c ------------------------------------ 628 ------------------------------------------------------------------------ 629 */ 630 /* 631 ----------------------------- 632 purpose -- initialize a front 633 634 created -- 98may04, cca 635 ----------------------------- 636 */ 637 void 638 FrontMtx_initializeFront ( 639 FrontMtx *frontmtx, 640 Chv *frontJ, 641 int J 642 ) ; 643 /* 644 ------------------------------------------------------------------ 645 purpose -- to visit a front during a factorization. 646 note: this method is called by the serial, 647 multithreaded and MPI factorization codes. 648 649 frontmtx -- front matrix object 650 pencil -- matrix pencil for A + sigma*B 651 J -- id of front we are working on 652 myid -- id of thread or process 653 owners[] -- map from fronts to owning threads, 654 in a serial environment, owners = NULL 655 fronts[] -- vector of pointers to fronts 656 lookahead -- parameter controls the partial upward visiting 657 of ancestors before returning 658 tau -- used when pivoting enabled, 659 |L_{j,i}| and |U_{i,j}| <= tau 660 droptol -- used for an approximate factorization 661 stored |L_{j,i}| and |U_{i,j}| > droptol 662 status[] -- status vector for the fronts, 663 'W' -- needs to be woke up 664 'A' -- active front 665 'F' -- front is finished 666 heads[] -- vector of pointers to IP objects that store the 667 front-to-front update lists 668 pivotsizesIV -- IV object used during the factorization of a front 669 when pivoting is enabled 670 workDV -- DV object used for working storage 671 parent -- front parent vector 672 aggList -- list object used in parallel environment, used 673 to store aggregate fronts 674 postList -- list object used in pivoting and/or parallel 675 environments, used to stored delayed data and/or 676 to synchronize the factorization 677 chvmanager -- used to manage working storage for Chv objects 678 stats[] -- statistics vector 679 cpus[] -- vector to hold breakdown of cpu times 680 msglvl -- message level 681 msgFil -- message file 682 683 created -- 98may04, cca 684 ------------------------------------------------------------------ 685 */ 686 char 687 FrontMtx_factorVisit ( 688 FrontMtx *frontmtx, 689 Pencil *pencil, 690 int J, 691 int myid, 692 int owners[], 693 Chv *fronts[], 694 int lookahead, 695 double tau, 696 double droptol, 697 char status[], 698 IP *heads[], 699 IV *pivotsizesIV, 700 DV *workDV, 701 int parent[], 702 ChvList *aggList, 703 ChvList *postList, 704 ChvManager *chvmanager, 705 int stats[], 706 double cpus[], 707 int msglvl, 708 FILE *msgFile 709 ) ; 710 /* 711 -------------------------------------------- 712 purpose -- set up the front's data structure 713 714 created -- 98mar27, cca 715 -------------------------------------------- 716 */ 717 Chv * 718 FrontMtx_setupFront ( 719 FrontMtx *frontmtx, 720 Pencil *pencil, 721 int J, 722 int myid, 723 int owners[], 724 ChvManager *chvmanager, 725 double cpus[], 726 int msglvl, 727 FILE *msgFile 728 ) ; 729 /* 730 -------------------------------------------------------------------- 731 purpose -- to set up the link data structures 732 for a parallel factorization for process myid 733 734 return value -- pointer to IP *heads[nfront+2], which contains 735 the beginning of a list of IP objects that store the remaining 736 updates to the fronts. 737 note, heads[nfront] is the first IP object in the free list. 738 heads[nfront+1] is the base address of the allocated IP objects. 739 740 created -- 98mar07, cca 741 -------------------------------------------------------------------- 742 */ 743 IP ** 744 FrontMtx_factorSetup ( 745 FrontMtx *frontmtx, 746 IV *frontOwnersIV, 747 int myid, 748 int msglvl, 749 FILE *msgFile 750 ) ; 751 /* 752 ----------------------------------------------- 753 create and return the nactiveChild vector. 754 nactiveChild[J] contains the number of children 755 of J that belong to an active path 756 757 created -- 97jul03, cca 758 ----------------------------------------------- 759 */ 760 int * 761 FrontMtx_nactiveChild ( 762 FrontMtx *frontmtx, 763 char *status, 764 int myid 765 ) ; 766 /* 767 --------------------------------------------------------- 768 create, initialize and return a Ideq object 769 that will be used for a parallel factorization, 770 forward solve, or backward solve. 771 772 the status[] vector will be set as follows: 773 status[J] = activeflag if J is on an active path 774 status[J] = inactiveflag if J is not on an active path 775 776 created -- 98mar27, cca 777 --------------------------------------------------------- 778 */ 779 Ideq * 780 FrontMtx_setUpDequeue ( 781 FrontMtx *frontmtx, 782 int owners[], 783 int myid, 784 char status[], 785 IP *heads[], 786 char activeFlag, 787 char inactiveFlag, 788 int msglvl, 789 FILE *msgFile 790 ) ; 791 /* 792 ----------------------------------------------------------------- 793 purpose -- load the dequeue with the leaves of the active subtree 794 used for a factorization and forward solve 795 796 created -- 98mar27, cca 797 ----------------------------------------------------------------- 798 */ 799 void 800 FrontMtx_loadActiveLeaves ( 801 FrontMtx *frontmtx, 802 char status[], 803 char activeFlag, 804 Ideq *dequeue 805 ) ; 806 /* 807 ----------------------------------------------- 808 create, initialize and return a ChvList object 809 to deal with postponed chevrons 810 811 created -- 97jul03, cca 812 ----------------------------------------------- 813 */ 814 ChvList * 815 FrontMtx_postList ( 816 FrontMtx *frontmtx, 817 IV *frontOwnersIV, 818 int lockflag 819 ) ; 820 /* 821 ----------------------------------------------- 822 create, initialize and return a ChvList object 823 to deal with aggregate chevrons 824 825 created -- 97jul03, cca 826 ----------------------------------------------- 827 */ 828 ChvList * 829 FrontMtx_aggregateList ( 830 FrontMtx *frontmtx, 831 IV *frontOwnersIV, 832 int lockflag 833 ) ; 834 /*--------------------------------------------------------------------*/ 835 /* 836 ------------------------------------------------------------------------ 837 ----- methods found in loadEntries.c ----------------------------------- 838 ------------------------------------------------------------------------ 839 */ 840 /* 841 ------------------------------------------------------------ 842 load entries from sigma*A 843 844 chv -- pointer to the Chv object that holds the front 845 pencil -- pointer to a Pencil that holds the matrix entries 846 msglvl -- message level 847 msgFile -- message file 848 849 created -- 97jul18, cca 850 ------------------------------------------------------------ 851 */ 852 void 853 FrontMtx_loadEntries ( 854 Chv *chv, 855 Pencil *pencil, 856 int msglvl, 857 FILE *msgFile 858 ) ; 859 /*--------------------------------------------------------------------*/ 860 /* 861 ------------------------------------------------------------------------ 862 ----- methods found in update.c ---------------------------------------- 863 ------------------------------------------------------------------------ 864 */ 865 /* 866 ------------------------------------------------------------ 867 accumulate updates to front J, store them in the Chv object 868 869 created -- 98may04, cca 870 ------------------------------------------------------------ 871 */ 872 void 873 FrontMtx_update ( 874 FrontMtx *frontmtx, 875 Chv *frontJ, 876 IP *heads[], 877 char status[], 878 DV *tempDV, 879 int msglvl, 880 FILE *msgFile 881 ) ; 882 /*--------------------------------------------------------------------*/ 883 /* 884 ------------------------------------------------------------------------ 885 ----- methods found in postponed.c ------------------------------------- 886 ------------------------------------------------------------------------ 887 */ 888 /* 889 ------------------------------------------------------------------ 890 purpose -- to assemble any postponed data into frontJ 891 892 frontJ -- pointer to Chv objec that contains current front 893 chvlist -- pointer to a ChvList object that handles the 894 lists of postponed Chv objects 895 chvmanager -- pointer to a ChvManager object for the list 896 of free Chv objects 897 pndelay -- pointer to address to contain the # of delayed rows 898 and columns that were assembled into the front 899 900 return value -- pointer to Chv object that contains the new front 901 902 created -- 98may04, cca 903 ------------------------------------------------------------------ 904 */ 905 Chv * 906 FrontMtx_assemblePostponedData ( 907 FrontMtx *frontmtx, 908 Chv *frontJ, 909 ChvList *chvlist, 910 ChvManager *chvmanager, 911 int *pndelay 912 ) ; 913 /* 914 --------------------------------------------------------- 915 purpose -- extract and store the postponed data 916 917 frontJ -- pointer to present front object 918 npost -- # of postponed rows and columns in frontJ 919 K -- parent of J 920 chvlist -- pointer to a ChvList object that handles the 921 lists of postponed Chv objects 922 a singly linked list to assemble 923 chvmanager -- pointer to a ChvManager object for the list 924 of free Chv objects 925 926 created -- 98may04, cca 927 --------------------------------------------------------- 928 */ 929 void 930 FrontMtx_storePostponedData ( 931 FrontMtx *frontmtx, 932 Chv *frontJ, 933 int npost, 934 int K, 935 ChvList *chvlist, 936 ChvManager *chvmanager 937 ) ; 938 /*--------------------------------------------------------------------*/ 939 /* 940 ------------------------------------------------------------------------ 941 ----- methods found in storeFront.c ------------------------------------ 942 ------------------------------------------------------------------------ 943 */ 944 /* 945 ---------------------------------------------------------------- 946 purpose -- to store the factor indicies and entries from front J 947 948 pivotsizesIV -- used for symmetric or hermitian and pivoting 949 droptol -- used for drop tolerance factorization, 950 an entry is stored if its magnitude > droptol 951 952 created -- 98may04, cca 953 ---------------------------------------------------------------- 954 */ 955 void 956 FrontMtx_storeFront ( 957 FrontMtx *frontmtx, 958 Chv *frontJ, 959 IV *pivotsizesIV, 960 double droptol, 961 int msglvl, 962 FILE *msgFile 963 ) ; 964 /*--------------------------------------------------------------------*/ 965 /* 966 ------------------------------------------------------------------------ 967 ----- methods found in postProcess.c ----------------------------------- 968 ------------------------------------------------------------------------ 969 */ 970 /* 971 -------------------------------------------------------------- 972 purpose -- post-process the factorization 973 (1) permute row and column adjacency objects if necessary 974 (2) permute lower and upper matrices if necessary 975 (3) update the block adjacency objects if necessary 976 (4) split the chevron submatrices into submatrices 977 and make the submatrix indices local w.r.t their fronts 978 979 created -- 98mar05, cca 980 -------------------------------------------------------------- 981 */ 982 void 983 FrontMtx_postProcess ( 984 FrontMtx *frontmtx, 985 int msglvl, 986 FILE *msgFile 987 ) ; 988 /*--------------------------------------------------------------------*/ 989 /* 990 ------------------------------------------------------------------------ 991 ----- methods found in permute.c --------------------------------------- 992 ------------------------------------------------------------------------ 993 */ 994 /* 995 ------------------------------------------------------------------ 996 purpose -- permute the upper adjacency structure so that the 997 indices in bnd{J} are in ascending order w.r.t. their ancestors 998 999 created -- 98mar05, cca 1000 ------------------------------------------------------------------ 1001 */ 1002 void 1003 FrontMtx_permuteUpperAdj ( 1004 FrontMtx *frontmtx, 1005 int msglvl, 1006 FILE *msgFile 1007 ) ; 1008 /* 1009 ------------------------------------------------------------------ 1010 purpose -- permute the lower adjacency structure so that the 1011 indices in bnd{J} are in ascending order w.r.t. their ancestors 1012 1013 created -- 98mar05, cca 1014 ------------------------------------------------------------------ 1015 */ 1016 void 1017 FrontMtx_permuteLowerAdj ( 1018 FrontMtx *frontmtx, 1019 int msglvl, 1020 FILE *msgFile 1021 ) ; 1022 /* 1023 ------------------------------------------------------------ 1024 purpose -- if the columns indices of the front matrix are in 1025 different order than the column indices of U_{J,bnd{J}}, 1026 sort the columns of U_{J,bnd{J}} into ascending order 1027 w.r.t the column indices of the front matrix. 1028 1029 created -- 98mar05, cca 1030 ------------------------------------------------------------ 1031 */ 1032 void 1033 FrontMtx_permuteUpperMatrices ( 1034 FrontMtx *frontmtx, 1035 int msglvl, 1036 FILE *msgFile 1037 ) ; 1038 /* 1039 -------------------------------------------------------- 1040 purpose -- if the row indices of the front matrix are in 1041 different order than the row indices of L_{bnd{J},J}, 1042 sort the rows of L_{bnd{J},J} into ascending order 1043 w.r.t the row indices of the front matrix. 1044 1045 created -- 98mar05, cca 1046 -------------------------------------------------------- 1047 */ 1048 void 1049 FrontMtx_permuteLowerMatrices ( 1050 FrontMtx *frontmtx, 1051 int msglvl, 1052 FILE *msgFile 1053 ) ; 1054 /*--------------------------------------------------------------------*/ 1055 /* 1056 ------------------------------------------------------------------------ 1057 ----- methods found in split.c ----------------------------------------- 1058 ------------------------------------------------------------------------ 1059 */ 1060 /* 1061 ---------------------------------------------------------------- 1062 purpose -- for each U_{J,bnd{J}} matrix, remove from hash table, 1063 split into their U_{J,K} submatrices and insert 1064 into the hash table. 1065 1066 created -- 98may04, cca 1067 ---------------------------------------------------------------- 1068 */ 1069 void 1070 FrontMtx_splitUpperMatrices ( 1071 FrontMtx *frontmtx, 1072 int msglvl, 1073 FILE *msgFile 1074 ) ; 1075 /* 1076 ---------------------------------------------------------------- 1077 purpose -- for each L_{bnd{J},J} matrix, remove from hash table, 1078 split into their L_{K,J} submatrices and insert 1079 into the hash table. 1080 1081 created -- 98may04, cca 1082 ---------------------------------------------------------------- 1083 */ 1084 void 1085 FrontMtx_splitLowerMatrices ( 1086 FrontMtx *frontmtx, 1087 int msglvl, 1088 FILE *msgFile 1089 ) ; 1090 /*--------------------------------------------------------------------*/ 1091 /* 1092 ------------------------------------------------------------------------ 1093 ----- methods found in solve.c ----------------------------------------- 1094 ------------------------------------------------------------------------ 1095 */ 1096 /* 1097 -------------------------------------------------------------- 1098 purpose -- to solve a linear system 1099 1100 frontmtx -- FrontMtx object that holds the factor matrices 1101 solmtx -- DenseMtx that holds the solution 1102 rhsmtx -- DenseMtx that holds the right hand side matrix 1103 note: right hand side entries are copied from rhsmtx, 1104 and solution entries are copied into solmtx. 1105 when the row indices of rhsmtx and solmtx are 1106 identical, rhsmtx and solmtx can be the same object. 1107 cpus -- vector to hold cpu breakdown time 1108 cpus[0] -- set up solves 1109 cpus[1] -- fetch rhs and store solution 1110 cpus[2] -- forward solve 1111 cpus[3] -- diagonal solve 1112 cpus[4] -- backward solve 1113 cpus[5] -- total time 1114 mtxmanager -- object that manages working storage 1115 msglvl -- message level 1116 msgFile -- message file 1117 1118 created -- 98may04, cca 1119 ------------------------------------------------------------ 1120 */ 1121 void 1122 FrontMtx_solve ( 1123 FrontMtx *frontmtx, 1124 DenseMtx *solmtx, 1125 DenseMtx *rhsmtx, 1126 SubMtxManager *mtxmanager, 1127 double cpus[], 1128 int msglvl, 1129 FILE *msgFile 1130 ) ; 1131 /*--------------------------------------------------------------------*/ 1132 /* 1133 ------------------------------------------------------------------------ 1134 ----- methods found in solveUtil.c ------------------------------------- 1135 ------------------------------------------------------------------------ 1136 */ 1137 /* 1138 --------------------------------------------- 1139 load the right hand side for the owned fronts 1140 1141 created -- 98mar19, cca 1142 --------------------------------------------- 1143 */ 1144 SubMtx ** 1145 FrontMtx_loadRightHandSide ( 1146 FrontMtx *frontmtx, 1147 DenseMtx *rhsmtx, 1148 int owners[], 1149 int myid, 1150 SubMtxManager *mtxmanager, 1151 int msglvl, 1152 FILE *msgFile 1153 ) ; 1154 /* 1155 -------------------------------------- 1156 visit front J during the forward solve 1157 1158 created -- 98mar27, cca 1159 -------------------------------------- 1160 */ 1161 void 1162 FrontMtx_forwardVisit ( 1163 FrontMtx *frontmtx, 1164 int J, 1165 int nrhs, 1166 int *owners, 1167 int myid, 1168 SubMtxManager *mtxmanager, 1169 SubMtxList *aggList, 1170 SubMtx *p_mtx[], 1171 char frontIsDone[], 1172 IP *heads[], 1173 SubMtx *p_agg[], 1174 char status[], 1175 int msglvl, 1176 FILE *msgFile 1177 ) ; 1178 /* 1179 -------------------------------------------------- 1180 purpose -- visit front J during the diagonal solve 1181 1182 created -- 98feb20, cca 1183 -------------------------------------------------- 1184 */ 1185 void 1186 FrontMtx_diagonalVisit ( 1187 FrontMtx *frontmtx, 1188 int J, 1189 int owners[], 1190 int myid, 1191 SubMtx *p_mtx[], 1192 char frontIsDone[], 1193 SubMtx *p_agg[], 1194 int msglvl, 1195 FILE *msgFile 1196 ) ; 1197 /* 1198 --------------------------------------- 1199 visit front J during the backward solve 1200 1201 created -- 98mar27, cca 1202 --------------------------------------- 1203 */ 1204 void 1205 FrontMtx_backwardVisit ( 1206 FrontMtx *frontmtx, 1207 int J, 1208 int nrhs, 1209 int *owners, 1210 int myid, 1211 SubMtxManager *mtxmanager, 1212 SubMtxList *aggList, 1213 SubMtx *p_mtx[], 1214 char frontIsDone[], 1215 IP *heads[], 1216 SubMtx *p_agg[], 1217 char status[], 1218 int msglvl, 1219 FILE *msgFile 1220 ) ; 1221 /* 1222 --------------------------------------------------- 1223 purpose -- move the solution from the individual 1224 SubMtx objects into the global solution SubMtx object 1225 1226 created -- 98feb20 1227 --------------------------------------------------- 1228 */ 1229 void 1230 FrontMtx_storeSolution ( 1231 FrontMtx *frontmtx, 1232 int owners[], 1233 int myid, 1234 SubMtxManager *manager, 1235 SubMtx *p_mtx[], 1236 DenseMtx *solmtx, 1237 int msglvl, 1238 FILE *msgFile 1239 ) ; 1240 /* 1241 --------------------------------------------------- 1242 purpose -- load the dequeue with the roots of the 1243 active subtree used for a backward solve 1244 1245 created -- 98mar27, cca 1246 --------------------------------------------------- 1247 */ 1248 void 1249 FrontMtx_loadActiveRoots ( 1250 FrontMtx *frontmtx, 1251 char status[], 1252 char activeFlag, 1253 Ideq *dequeue 1254 ) ; 1255 /* 1256 -------------------------------------------------------------------- 1257 purpose -- to set up the link data structures for a forward solve 1258 1259 return value -- pointer to IP *heads[nfront+2], which contains 1260 the beginning of a list of IP objects that store the remaining 1261 updates to the fronts. 1262 note, heads[nfront] is the first IP object in the free list. 1263 heads[nfront+1] is the base address of the allocated IP objects. 1264 1265 created -- 98feb20, cca 1266 -------------------------------------------------------------------- 1267 */ 1268 IP ** 1269 FrontMtx_forwardSetup ( 1270 FrontMtx *frontmtx, 1271 int msglvl, 1272 FILE *msgFile 1273 ) ; 1274 /* 1275 --------------------------------------------------------- 1276 purpose -- set up the linked lists for the backward solve 1277 1278 created -- 98feb20, cca 1279 --------------------------------------------------------- 1280 */ 1281 IP ** 1282 FrontMtx_backwardSetup ( 1283 FrontMtx *frontmtx, 1284 int msglvl, 1285 FILE *msgFile 1286 ) ; 1287 /*--------------------------------------------------------------------*/ 1288 /* 1289 ------------------------------------------------------------------------ 1290 ----- methods found in QRfactor.c -------------------------------------- 1291 ------------------------------------------------------------------------ 1292 */ 1293 /* 1294 ------------------------------------------------------------ 1295 purpose -- to compute the (U+I)D(I+U) factorization of A^TA, 1296 where A = QR, R = (D^{1/2} + D^{1/2}U) 1297 1298 cpus[0] -- setup time 1299 cpus[1] -- initialize and load staircase matrix 1300 cpus[2] -- permute the rows into staircase form 1301 cpus[3] -- factor the matrix 1302 cpus[4] -- scale and store factor entries 1303 cpus[5] -- store update entries 1304 cpus[6] -- miscellaneous time 1305 1306 created -- 98may28, cca 1307 ------------------------------------------------------------ 1308 */ 1309 void 1310 FrontMtx_QR_factor ( 1311 FrontMtx *frontmtx, 1312 InpMtx *mtxA, 1313 ChvManager *chvmanager, 1314 double cpus[], 1315 double *pfacops, 1316 int msglvl, 1317 FILE *msgFile 1318 ) ; 1319 /*--------------------------------------------------------------------*/ 1320 /* 1321 ------------------------------------------------------------------------ 1322 ----- methods found in QRsolve.c --------------------------------------- 1323 ------------------------------------------------------------------------ 1324 */ 1325 /* 1326 ------------------------------------------------- 1327 minimize ||b - Ax||_2 by 1328 solving (U^T + I) * D * (I + U) X = A^T * B 1329 where A = QR = QD(I + U) 1330 by calling FrontMtx_solve() 1331 1332 mtxmanager -- object that manages working storage 1333 cpus -- vector of cpu time breakdowns 1334 cpus[0] -- set up solves 1335 cpus[1] -- fetch rhs and store solution 1336 cpus[2] -- forward solve 1337 cpus[3] -- diagonal solve 1338 cpus[4] -- backward solve 1339 cpus[5] -- total solve time 1340 cpus[6] -- time to compute A^T * B 1341 cpus[7] -- total time 1342 1343 created -- 97may27, dkw 1344 modified -- 98may28, cca 1345 ------------------------------------------------- 1346 */ 1347 void 1348 FrontMtx_QR_solve ( 1349 FrontMtx *frontmtx, 1350 InpMtx *mtxA, 1351 DenseMtx *mtxX, 1352 DenseMtx *mtxB, 1353 SubMtxManager *manager, 1354 double cpus[], 1355 int msglvl, 1356 FILE *msgFile 1357 ) ; 1358 /*--------------------------------------------------------------------*/ 1359 /* 1360 ------------------------------------------------------------------------ 1361 ----- methods found in QRutil.c ---------------------------------------- 1362 ------------------------------------------------------------------------ 1363 */ 1364 /* 1365 -------------------------------------------------------------------- 1366 purpose -- to setup two data structures for a QR serial 1367 or multithreaded factorization 1368 1369 rowsIVL[J] -- list of rows of A to be assembled into front J 1370 firstnz[irow] -- column with location of leading nonzero of row in A 1371 1372 created -- 98may29, cca 1373 -------------------------------------------------------------------- 1374 */ 1375 void 1376 FrontMtx_QR_setup ( 1377 FrontMtx *frontmtx, 1378 InpMtx *mtxA, 1379 IVL **prowsIVL, 1380 int **pfirstnz, 1381 int msglvl, 1382 FILE *msgFile 1383 ) ; 1384 /* 1385 ----------------------------------------------- 1386 purpose -- visit front J during a serial 1387 or multithreaded QR factorization 1388 1389 cpus[1] -- initialize and load staircase matrix 1390 cpus[2] -- factor the matrix 1391 cpus[3] -- scale and store factor entries 1392 cpus[4] -- store update entries 1393 1394 created -- 98may28, cca 1395 ----------------------------------------------- 1396 */ 1397 void 1398 FrontMtx_QR_factorVisit ( 1399 FrontMtx *frontmtx, 1400 int J, 1401 InpMtx *mtxA, 1402 IVL *rowsIVL, 1403 int firstnz[], 1404 ChvList *updlist, 1405 ChvManager *chvmanager, 1406 char status[], 1407 int colmap[], 1408 DV *workDV, 1409 double cpus[], 1410 double *pfacops, 1411 int msglvl, 1412 FILE *msgFile 1413 ) ; 1414 /* 1415 -------------------------------------------------------------- 1416 purpose -- create and return an A2 object that contains rows 1417 of A and rows from update matrices of the children. 1418 the matrix may not be in staircase form 1419 1420 created -- 98may25, cca 1421 -------------------------------------------------------------- 1422 */ 1423 A2 * 1424 FrontMtx_QR_assembleFront ( 1425 FrontMtx *frontmtx, 1426 int J, 1427 InpMtx *mtxA, 1428 IVL *rowsIVL, 1429 int firstnz[], 1430 int colmap[], 1431 Chv *firstchild, 1432 DV *workDV, 1433 int msglvl, 1434 FILE *msgFile 1435 ) ; 1436 /* 1437 ---------------------------------------------------- 1438 store the factor entries of the reduced front matrix 1439 1440 created -- 98may25, cca 1441 ---------------------------------------------------- 1442 */ 1443 void 1444 FrontMtx_QR_storeFront ( 1445 FrontMtx *frontmtx, 1446 int J, 1447 A2 *frontJ, 1448 int msglvl, 1449 FILE *msgFile 1450 ) ; 1451 /* 1452 ------------------------------------------------- 1453 purpose -- to create and return a Chv object that 1454 holds the update matrix for front J 1455 1456 created -- 98may25, cca 1457 ------------------------------------------------- 1458 */ 1459 Chv * 1460 FrontMtx_QR_storeUpdate ( 1461 FrontMtx *frontmtx, 1462 int J, 1463 A2 *frontJ, 1464 ChvManager *chvmanager, 1465 int msglvl, 1466 FILE *msgFile 1467 ) ; 1468 /*--------------------------------------------------------------------*/ 1469 /* 1470 ------------------------------------------------------------------------ 1471 ----- methods found in util.c ------------------------------------------ 1472 ------------------------------------------------------------------------ 1473 */ 1474 /* 1475 ----------------------------------------- 1476 purpose -- produce a map from each column 1477 to the front that contains it 1478 1479 created -- 98may04, cca 1480 ----------------------------------------- 1481 */ 1482 IV * 1483 FrontMtx_colmapIV ( 1484 FrontMtx *frontmtx 1485 ) ; 1486 /* 1487 -------------------------------------------------------------------- 1488 purpose -- produce a map from each row to the front that contains it 1489 1490 created -- 98may04, cca 1491 -------------------------------------------------------------------- 1492 */ 1493 IV * 1494 FrontMtx_rowmapIV ( 1495 FrontMtx *frontmtx 1496 ) ; 1497 /* 1498 ------------------------------------------------------------- 1499 compute the inertia of a symmetric matrix 1500 1501 fill *pnnegative with the number of negative eigenvalues of A 1502 fill *pnzero with the number of zero eigenvalues of A 1503 fill *pnpositive with the number of positive eigenvalues of A 1504 1505 created -- 98may04, cca 1506 ------------------------------------------------------------- 1507 */ 1508 void 1509 FrontMtx_inertia ( 1510 FrontMtx *frontmtx, 1511 int *pnnegative, 1512 int *pnzero, 1513 int *pnpositive 1514 ) ; 1515 /* 1516 ------------------------------------------------------- 1517 purpose -- create and return an IV object that contains 1518 all the row ids owned by process myid. 1519 1520 created -- 98jun13, cca 1521 ------------------------------------------------------- 1522 */ 1523 IV * 1524 FrontMtx_ownedRowsIV ( 1525 FrontMtx *frontmtx, 1526 int myid, 1527 IV *ownersIV, 1528 int msglvl, 1529 FILE *msgFile 1530 ) ; 1531 /* 1532 ------------------------------------------------------- 1533 purpose -- create and return an IV object that contains 1534 all the column ids owned by process myid. 1535 1536 created -- 98jun13, cca 1537 ------------------------------------------------------- 1538 */ 1539 IV * 1540 FrontMtx_ownedColumnsIV ( 1541 FrontMtx *frontmtx, 1542 int myid, 1543 IV *ownersIV, 1544 int msglvl, 1545 FILE *msgFile 1546 ) ; 1547 /* 1548 ---------------------------------------------------------------- 1549 purpose -- to create and return an IVL object that holds the 1550 submatrix nonzero pattern for the upper triangular factor. 1551 1552 NOTE: this method supercedes calling IVL_mapEntries() on 1553 the column adjacency structure. that gave problems when 1554 pivoting forced some fronts to have no eliminated columns. 1555 in some cases, solve aggregates were expected when none 1556 were forthcoming. 1557 1558 created -- 98aug20, cca 1559 ---------------------------------------------------------------- 1560 */ 1561 IVL * 1562 FrontMtx_makeUpperBlockIVL ( 1563 FrontMtx *frontmtx, 1564 IV *colmapIV 1565 ) ; 1566 /* 1567 ---------------------------------------------------------------- 1568 purpose -- to create and return an IVL object that holds the 1569 submatrix nonzero pattern for the lower triangular factor. 1570 1571 NOTE: this method supercedes calling IVL_mapEntries() on 1572 the row adjacency structure. that gave problems when 1573 pivoting forced some fronts to have no eliminated columns. 1574 in some cases, solve aggregates were expected when none 1575 were forthcoming. 1576 1577 created -- 98aug20, cca 1578 ---------------------------------------------------------------- 1579 */ 1580 IVL * 1581 FrontMtx_makeLowerBlockIVL ( 1582 FrontMtx *frontmtx, 1583 IV *rowmapIV 1584 ) ; 1585 /* 1586 --------------------------------------------------------------- 1587 purpose -- to compute and return the number of floating point 1588 operations to perform a solve with a single right hand side. 1589 1590 created -- 98sep26, cca 1591 --------------------------------------------------------------- 1592 */ 1593 int 1594 FrontMtx_nSolveOps ( 1595 FrontMtx *frontmtx 1596 ) ; 1597 /*--------------------------------------------------------------------*/ 1598 /* 1599 ------------------------------------------------------------------------ 1600 ----- methods found in IO.c -------------------------------------------- 1601 ------------------------------------------------------------------------ 1602 */ 1603 /* 1604 ----------------------------------------------------- 1605 purpose -- to read in an FrontMtx object from a file 1606 1607 input -- 1608 1609 fn -- filename, must be *.frontmtxb or *.frontmtxf 1610 1611 return value -- 1 if success, 0 if failure 1612 1613 created -- 98may04, cca 1614 ----------------------------------------------------- 1615 */ 1616 int 1617 FrontMtx_readFromFile ( 1618 FrontMtx *frontmtx, 1619 char *fn 1620 ) ; 1621 /* 1622 ------------------------------------------------------------ 1623 purpose -- to read an FrontMtx object from a formatted file 1624 1625 return value -- 1 if success, 0 if failure 1626 1627 created -- 98may04, cca 1628 ------------------------------------------------------------ 1629 */ 1630 int 1631 FrontMtx_readFromFormattedFile ( 1632 FrontMtx *frontmtx, 1633 FILE *fp 1634 ) ; 1635 /* 1636 -------------------------------------------------------- 1637 purpose -- to read an FrontMtx object from a binary file 1638 1639 return value -- 1 if success, 0 if failure 1640 1641 created -- 98may04, cca 1642 -------------------------------------------------------- 1643 */ 1644 int 1645 FrontMtx_readFromBinaryFile ( 1646 FrontMtx *frontmtx, 1647 FILE *fp 1648 ) ; 1649 /* 1650 ------------------------------------------------- 1651 purpose -- to write an FrontMtx object to a file 1652 1653 input -- 1654 1655 fn -- filename 1656 *.frontmtxb -- binary 1657 *.frontmtxf -- formatted 1658 anything else -- for human eye 1659 1660 return value -- 1 if success, 0 otherwise 1661 1662 created -- 98may04, cca 1663 ------------------------------------------------- 1664 */ 1665 int 1666 FrontMtx_writeToFile ( 1667 FrontMtx *frontmtx, 1668 char *fn 1669 ) ; 1670 /* 1671 ----------------------------------------------------------- 1672 purpose -- to write an FrontMtx object to a formatted file 1673 1674 return value -- 1 if success, 0 otherwise 1675 1676 created -- 98may04, cca 1677 ----------------------------------------------------------- 1678 */ 1679 int 1680 FrontMtx_writeToFormattedFile ( 1681 FrontMtx *frontmtx, 1682 FILE *fp 1683 ) ; 1684 /* 1685 ------------------------------------------------------- 1686 purpose -- to write an FrontMtx object to a binary file 1687 1688 return value -- 1 if success, 0 otherwise 1689 1690 created -- 98may04, cca 1691 ------------------------------------------------------- 1692 */ 1693 int 1694 FrontMtx_writeToBinaryFile ( 1695 FrontMtx *frontmtx, 1696 FILE *fp 1697 ) ; 1698 /* 1699 --------------------------------------------------------------- 1700 purpose -- to write out the statistics for the FrontMtx object 1701 1702 return value -- 1 if success, 0 otherwise 1703 1704 created -- 98may04, cca 1705 --------------------------------------------------------------- 1706 */ 1707 int 1708 FrontMtx_writeStats ( 1709 FrontMtx *frontmtx, 1710 FILE *fp 1711 ) ; 1712 /* 1713 ---------------------------------------- 1714 purpose -- to write the object to a file 1715 in human readable form 1716 1717 created -- 98may04, cca 1718 ---------------------------------------- 1719 */ 1720 int 1721 FrontMtx_writeForHumanEye ( 1722 FrontMtx *frontmtx, 1723 FILE *fp 1724 ) ; 1725 /* 1726 ------------------------------------------------------------- 1727 purpose -- to write the factor matrices out for a matlab file 1728 1729 Lname -- name for lower triangular matrix 1730 Dname -- name for diagonal matrix 1731 Uname -- name for upper triangular matrix 1732 1733 presently works only with 1-d data decomposition 1734 1735 created -- 98sep23, cca 1736 ------------------------------------------------------------- 1737 */ 1738 int 1739 FrontMtx_writeForMatlab ( 1740 FrontMtx *frontmtx, 1741 char *Lname, 1742 char *Dname, 1743 char *Uname, 1744 FILE *fp 1745 ) ; 1746 /*--------------------------------------------------------------------*/ 1747