This file is indexed.

/usr/include/spooles/FrontMtx/FrontMtx.h is in libspooles-dev 2.2-9.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
/*  FrontMtx.h  */

#include "../Pencil.h"
#include "../ETree.h"
#include "../IVL.h"
#include "../PatchAndGoInfo.h"
#include "../Chv.h"
#include "../ChvManager.h"
#include "../ChvList.h"
#include "../SubMtx.h"
#include "../SubMtxList.h"
#include "../SubMtxManager.h"
#include "../DenseMtx.h"
#include "../Ideq.h"
#include "../SolveMap.h"
#include "../Lock.h"
#include "../I2Ohash.h"

#include "../SPOOLES.h"

/*--------------------------------------------------------------------*/
/*
   -------------------------------------------------------------------
   the FrontMtx object is used to compute and store a matrix
   factorization in serial, multithreaded and MPI modes.

   there are two data modes:
     1 --> data is stored by fronts, a 1-D data decomposition.
           we use five pointer vectors (p_mtxDJJ[], p_mtxUJJ[],
           p_mtxUJN[], p_mtxLJJ[] and p_mtxLNJ[]) to store pointers
           to the factor submatrices
     2 --> data is stored by submatrices, a 2-D data decomposition.
           we use two hash objects (lowerhash and upperhash), a
           pointer vector p_mtxDJJ[] and two IVL objects (lowerblockIVL
           and upperblockIVL) to store the structure of the matrix.

   nfront -- number of fronts in the matrix
   neqns  -- number of rows and columns in the matrix
   type   -- type of entries
      1 -- real
      2 -- complex
   symmetryflag -- flag to specify symmetry of the matrix
      0 --> symmetric structure, symmetric entries
      1 --> symmetric structure, nonsymmetric entries
      2 --> nonsymmetric structure, nonsymmetric entries
   sparsityflag -- flag to specify dense or sparse fronts
      0 --> dense fronts
      1 --> sparse fronts
   pivotingflag -- flag to specify pivoting enabled
      0 --> pivoting not used
      1 --> pivoting used
   dataMode -- flag to specify storage mode
      1 --> 1-dimensional data decomposition, used for factorization
      2 --> 2-dimensional data decomposition, used for solves
   nentD -- number of entries in the diagonal matrix
   nentL -- number of entries in the lower triangular matrix
   nentU -- number of entries in the upper triangular matrix

   tree       -- pointer to an Tree object that holds the tree of fronts
   frontETree -- pointer to an ETree object that holds the front tree
   symbfacIVL -- pointer to an IVL object that holds 
      the symbolic factorization

   frontsizesIV -- pointer to an IV object that holds the number of
      internal rows and columns in each front
   rowadjIVL  -- pointer to an IVL object that holds the row ids
      of the fronts, used only for nonsymmetric matrices with pivoting
   coladjIVL  -- pointer to an IVL object that holds the column ids
      of the fronts, used only with pivoting

   p_mtxDJJ -- vector of pointers to the diagonal D_{J,J} objects
   p_mtxUJJ -- vector of pointers to the upper U_{J,J} objects
   p_mtxUJN -- vector of pointers to the upper U_{J,N} objects
   p_mtxLJJ -- vector of pointers to the lower L_{J,J} objects
   p_mtxLNJ -- vector of pointers to the lower L_{N,J} objects

   lowerblockIVL -- pointer to an IVL object that holds the sparsity
      structure of the block L matrix, i.e., front-front edges,
      used only for nonsymmetric matrices with pivoting 
   upperblockIVL -- pointer to an IVL object that holds the sparsity
      structure of the block U matrix, i.e., front-front edges
   lowerhash -- pointer to a hash table object that holds the
      submatrices in L, used only for nonsymmetric factorizations
   upperhash -- pointer to a hash table object that holds the
      submatrices in U

   manager -- object to manage instances of Mtx objects
   lock -- mutex object that controls access to allocating
      storage in IVL and DVL objects, can be NULL
   nlocks -- number of times the lock was locked
   patchinfo -- information object needed for special factorizations

   created -- 98feb27, cca
   -------------------------------------------------------------------
*/
typedef struct _FrontMtx   FrontMtx ;
struct _FrontMtx {
   int             nfront         ;
   int             neqns          ;
   int             type           ;
   int             symmetryflag   ;
   int             sparsityflag   ;
   int             pivotingflag   ;
   int             dataMode       ;
   int             nentD          ;
   int             nentL          ;
   int             nentU          ;
   Tree            *tree          ;
   ETree           *frontETree    ;
   IV              *frontsizesIV  ;
   IVL             *symbfacIVL    ;
   IVL             *rowadjIVL     ;
   IVL             *coladjIVL     ;
   IVL             *lowerblockIVL ;
   IVL             *upperblockIVL ;
   SubMtx          **p_mtxDJJ     ;
   SubMtx          **p_mtxUJJ     ;
   SubMtx          **p_mtxUJN     ;
   SubMtx          **p_mtxLJJ     ;
   SubMtx          **p_mtxLNJ     ;
   I2Ohash         *lowerhash     ;
   I2Ohash         *upperhash     ;
   SubMtxManager   *manager       ;
   Lock            *lock          ;
   PatchAndGoInfo  *patchinfo     ;
   int             nlocks         ;
} ;

#define FRONTMTX_IS_REAL(mtx)     ((mtx)->type == SPOOLES_REAL)
#define FRONTMTX_IS_COMPLEX(mtx)  ((mtx)->type == SPOOLES_COMPLEX)

#define FRONTMTX_IS_SYMMETRIC(mtx)    \
   ((mtx)->symmetryflag == SPOOLES_SYMMETRIC)
#define FRONTMTX_IS_HERMITIAN(mtx)    \
   ((mtx)->symmetryflag == SPOOLES_HERMITIAN)
#define FRONTMTX_IS_NONSYMMETRIC(mtx) \
   ((mtx)->symmetryflag == SPOOLES_NONSYMMETRIC)

#define FRONTMTX_DENSE_FRONTS  0
#define FRONTMTX_SPARSE_FRONTS 1
#define FRONTMTX_IS_DENSE_FRONTS(mtx)  \
   ((mtx)->sparsityflag == FRONTMTX_DENSE_FRONTS)
#define FRONTMTX_IS_SPARSE_FRONTS(mtx) \
   ((mtx)->sparsityflag == FRONTMTX_SPARSE_FRONTS)

#define FRONTMTX_IS_PIVOTING(mtx)  \
   ((mtx)->pivotingflag == SPOOLES_PIVOTING)

#define FRONTMTX_1D_MODE      1
#define FRONTMTX_2D_MODE      2
#define FRONTMTX_IS_1D_MODE(mtx)  \
   ((mtx)->dataMode == FRONTMTX_1D_MODE)
#define FRONTMTX_IS_2D_MODE(mtx)  \
   ((mtx)->dataMode == FRONTMTX_2D_MODE)

#define NO_LOCK               0
#define LOCK_IN_PROCESS       1
#define LOCK_IN_ALL_PROCESSES 2
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in basics.c ----------------------------------------
------------------------------------------------------------------------
*/
/*
   -----------------------
   simplest constructor
 
   created -- 98may04, cca
   -----------------------
*/
FrontMtx *
FrontMtx_new ( 
   void 
) ;
/*
   -----------------------
   set the default fields
 
   created -- 98may04, cca
   -----------------------
*/
void
FrontMtx_setDefaultFields (
   FrontMtx   *frontmtx
) ;
/*
   --------------------------------------------------
   clear the data fields, releasing allocated storage
 
   created -- 98may04, cca
   --------------------------------------------------
*/
void
FrontMtx_clearData (
   FrontMtx   *frontmtx
) ;
/*
   ------------------------------------------
   destructor, free's the object and its data
 
   created -- 98may04, cca
   ------------------------------------------
*/
void
FrontMtx_free (
   FrontMtx   *frontmtx
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in instance.c --------------------------------------
------------------------------------------------------------------------
*/
/*
   --------------------------------------
   purpose -- return the number of fronts
 
   created -- 98may04, cca
   --------------------------------------
*/
int
FrontMtx_nfront (
   FrontMtx   *frontmtx
) ;
/*
   -----------------------------------------
   purpose -- return the number of equations
 
   created -- 98may04, cca
   -----------------------------------------
*/
int
FrontMtx_neqns (
   FrontMtx   *frontmtx
) ;
/*
   ----------------------------------------------------
   purpose -- return a pointer to the front Tree object
 
   created -- 98may04, cca
   ----------------------------------------------------
*/
Tree *
FrontMtx_frontTree (
   FrontMtx   *frontmtx
) ;
/*
   ----------------------------------------------------------------
  simple method to return the dimensions of front J and the number
   of bytes necessary for the Chv object to hold the front.
 
   created -- 98may04, cca
   ----------------------------------------------------------------
*/
void
FrontMtx_initialFrontDimensions (
   FrontMtx   *frontmtx,
   int         J,
   int         *pnD,
   int         *pnL,
   int         *pnU,
   int         *pnbytes
) ;
/*
   ---------------------------------------------------------
   return the number of internal rows and columns in front J
 
   created -- 98may04, cca
   ---------------------------------------------------------
*/
int
FrontMtx_frontSize (
   FrontMtx   *frontmtx,
   int         J
) ;
/*
   ------------------------------------------------------
   set the number of internal rows and columns in front J
 
   created -- 98may04, cca
   ------------------------------------------------------
*/
void
FrontMtx_setFrontSize (
   FrontMtx   *frontmtx,
   int         J,
   int         size
) ;
/*
   ---------------------------------------------
   fill *pncol with the number of columns and
   *pcolind with a pointer to the column indices
 
   created -- 98may04, cca
   ---------------------------------------------
*/
void
FrontMtx_columnIndices (
   FrontMtx   *frontmtx,
   int         J,
   int         *pncol,
   int         **pcolind
) ;
/*
   -------------------------------------------
   fill *pnrow with the number of rows and
   *prowind with a pointer to the rows indices
 
   created -- 98may04, cca
   -------------------------------------------
*/
void
FrontMtx_rowIndices (
   FrontMtx   *frontmtx,
   int         J,
   int         *pnrow,
   int         **prowind
) ;
/*
   -----------------------------------------------------------
   purpose -- return a pointer to the (J,J) diagonal submatrix
 
   created -- 98may04, cca
   -----------------------------------------------------------
*/
SubMtx *
FrontMtx_diagMtx (
   FrontMtx   *frontmtx,
   int         J
) ;
/*
   --------------------------------------------------------
   purpose -- return a pointer to the (J,K) upper submatrix
 
   created -- 98may04, cca
   --------------------------------------------------------
*/
SubMtx *
FrontMtx_upperMtx (
   FrontMtx   *frontmtx,
   int         J,
   int         K
) ;
/*
   --------------------------------------------------------
   purpose -- return a pointer to the (K,J) lower submatrix
 
   created -- 98may04, cca
   --------------------------------------------------------
*/
SubMtx *
FrontMtx_lowerMtx (
   FrontMtx   *frontmtx,
   int         K,
   int         J
) ;
/*
   --------------------------------------------------
   purpose -- fill *pnadj with the number of fronts K
              such that L_{K,J} != 0 and *padj with a
              pointer to a list of those fronts
 
   created -- 98may04, cca
   --------------------------------------------------
*/
void
FrontMtx_lowerAdjFronts (
   FrontMtx   *frontmtx,
   int         J,
   int         *pnadj,
   int         **padj
) ;
/*
   --------------------------------------------------
   purpose -- fill *pnadj with the number of fronts K
              such that U_{J,K} != 0 and *padj with a
              pointer to a list of those fronts
 
   created -- 98may04, cca
   --------------------------------------------------
*/
void
FrontMtx_upperAdjFronts (
   FrontMtx   *frontmtx,
   int         J,
   int         *pnadj,
   int         **padj
) ;
/*
   ------------------------------------------------------
   purpose -- return the number of nonzero L_{K,J} blocks
 
   created -- 98may04, cca
   ------------------------------------------------------
*/
int
FrontMtx_nLowerBlocks (
   FrontMtx   *frontmtx
) ;
/*
   ------------------------------------------------------
   purpose -- return the number of nonzero U_{K,J} blocks
 
   created -- 98may04, cca
   ------------------------------------------------------
*/
int
FrontMtx_nUpperBlocks (
   FrontMtx   *frontmtx
) ;
/*
   ---------------------------------------------------------
   purpose -- return a pointer to the upper block IVL object
 
   created -- 98jun13, cca
   ---------------------------------------------------------
*/
IVL *
FrontMtx_upperBlockIVL (
   FrontMtx   *frontmtx
) ;
/*
   ---------------------------------------------------------
   purpose -- return a pointer to the lower block IVL object
 
   created -- 98jun13, cca
   ---------------------------------------------------------
*/
IVL *
FrontMtx_lowerBlockIVL (
   FrontMtx   *frontmtx
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in init.c ------------------------------------------
------------------------------------------------------------------------
*/
/*
   ------------------------------------------------------------------
   purpose -- basic initializer
 
   frontETree -- ETree object that stores the front tree
   symbfacIVL -- IVL object that stores the symbolic factorization
   manager    -- SubMtxManager object to manage SubMtx objects
   type       -- type of entries
      SPOOLES_REAL --> real
      SPOOLES_COMPLEX --> complex
   symmetryflag -- symmetry flag,
      SPOOLES_SYMMETRIC --> symmetric structure and entries
      SPOOLES_HERMITIAN --> hermitian (complex only)
      SPOOLES_NONSYMMETRIC --> nonsymmetric entries
   sparsityflag -- flag to specify dense or sparse fronts
      FRONTMTX_DENSE_FRONTS --> dense fronts
      FRONTMTX_SPARSE_FRONTS --> sparse fronts
   pivotingflag -- flag to specify pivoting enabled
      SPOOLES_NO_PIVOTING --> pivoting not used
      SPOOLES_PIVOTING    --> pivoting used
 
   in a multithreaded environment, we need to protect the critical
   section where data is allocated. we use a lockflag to do this.
   in a serial or distributed environment, use lockflag = 0.
 
   lockflag -- flag to specify lock status
      NO_LOCK --> mutex lock is not allocated or initialized
      LOCK_IN_PROCESS --> mutex lock is allocated and
         it can synchronize only threads in this process.
      LOCK_OVER_ALL_PROCESSES --> mutex lock is allocated and
          it can synchronize only threads in this and other processes.
 
   in a distributed environment we need to specify which process
   owns each front. when we can preallocate data structures
   (when there is no pivoting and dense fronts are stored) we
   need each process to determine what parts of the data it
   can allocate and set up. in a serial or multithreaded 
   environment, use ownersIV = NULL.
 
      ownersIV -- map from fronts to owning processes
      myid     -- id of this process.
 
   submatrices (be they lower, diagonal, block diagonal, upper)
   are stored in SubMtx objects. the management of these objects,
   (allocation and deallocation) is managed by the SubMtxManager
   manager object.
 
      manager -- SubMtxManager object to handle the submatrices
 
   created  -- 98may04, cca
   ------------------------------------------------------------------
*/
void
FrontMtx_init (
   FrontMtx        *frontmtx,
   ETree           *frontETree,
   IVL             *symbfacIVL,
   int             type,
   int             symmetryflag,
   int             sparsityflag,
   int             pivotingflag,
   int             lockflag,
   int             myid,
   IV              *ownersIV,
   SubMtxManager   *manager,
   int             msglvl,
   FILE            *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in factor.c ----------------------------------------
------------------------------------------------------------------------
*/
/*
   -------------------------------------------------------------------
   compute an (U^T + I)D(I + U) or (L + I)D(I + L) factorization of A.
   this is a wrapper method around FrontMtx_factorPencil().
 
   input --
 
      frontmtx -- pointer to the FrontMtx object that will hold
                  the factorization
      pencil   -- pointer to the Pencil object that holds A + sigma*B
      tau      -- upper bound on entries in L and U,
                  used only when pivoting enabled
      droptol  -- lower bound on entries in L and U,
                  used only when sparsity enabled
      perror   -- error flag, on return
         *perror >= 0 --> factorization failed at front *perror
         *perror <  0 --> factorization succeeded
      cpus[]   -- timing array
         cpus[0] -- initialize fronts
         cpus[1] -- load original entries
         cpus[2] -- get updates from descendents
         cpus[3] -- assembled postponed data
         cpus[4] -- factor the front
         cpus[5] -- extract postponed data
         cpus[6] -- store factor entries
         cpus[7] -- miscellaneous time
         cpus[8] -- total time
      stats[] -- statistics array
         stats[0] -- # of pivots
         stats[1] -- # of pivot tests
         stats[2] -- # of delayed rows and columns
         stats[3] -- # of entries in D
         stats[4] -- # of entries in L
         stats[5] -- # of entries in U
      msglvl   -- message level
      msgFile  -- message file
 
   created  -- 98mar27, cca
   modified -- 98mar27, cca
      perror added to argument list
   -------------------------------------------------------------------
*/
Chv *
FrontMtx_factorInpMtx (
   FrontMtx     *frontmtx,
   InpMtx       *inpmtx,
   double       tau,
   double       droptol,
   ChvManager   *chvmanager,
   int          *perror,
   double       cpus[],
   int          stats[],
   int          msglvl,
   FILE         *msgFile
) ;
/*
   -------------------------------------------------------------------
   compute an (U^T + I)D(I + U) or (L + I)D(I + L)
   factorization of A + sigma*B.
 
   input --
 
      frontmtx -- pointer to the FrontMtx object that will hold
                  the factorization
      pencil   -- pointer to the Pencil object that holds A + sigma*B
      tau      -- upper bound on entries in L and U,
                  used only when pivoting enabled
      droptol  -- lower bound on entries in L and U,
                  used only when sparsity enabled
      perror   -- error flag, on return
         *perror >= 0 --> factorization failed at front *perror
         *perror <  0 --> factorization succeeded
      cpus[]   -- timing array
         cpus[0] -- initialize fronts
         cpus[1] -- load original entries
         cpus[2] -- get updates from descendents
         cpus[3] -- assembled postponed data
         cpus[4] -- factor the front
         cpus[5] -- extract postponed data
         cpus[6] -- store factor entries
         cpus[7] -- miscellaneous time
         cpus[8] -- total time
      stats[] -- statistics array
         stats[0] -- # of pivots
         stats[1] -- # of pivot tests
         stats[2] -- # of delayed rows and columns
         stats[3] -- # of entries in D
         stats[4] -- # of entries in L
         stats[5] -- # of entries in U
      msglvl   -- message level
      msgFile  -- message file
 
   created  -- 98mar27, cca
   modified -- 98mar27, cca
      perror added to argument list
   -------------------------------------------------------------------
*/
Chv *
FrontMtx_factorPencil (
   FrontMtx     *frontmtx,
   Pencil       *pencil,
   double       tau,
   double       droptol,
   ChvManager   *chvmanager,
   int          *perror,
   double       cpus[],
   int          stats[],
   int          msglvl,
   FILE         *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in factorUtil.c ------------------------------------
------------------------------------------------------------------------
*/
/*
   -----------------------------
   purpose -- initialize a front
 
   created -- 98may04, cca
   -----------------------------
*/
void
FrontMtx_initializeFront (
   FrontMtx   *frontmtx,
   Chv        *frontJ,
   int        J
) ;
/*
   ------------------------------------------------------------------
   purpose -- to visit a front during a factorization.
              note: this method is called by the serial,
              multithreaded and MPI factorization codes.
 
   frontmtx     -- front matrix object
   pencil       -- matrix pencil for A + sigma*B
   J            -- id of front we are working on
   myid         -- id of thread or process 
   owners[]     -- map from fronts to owning threads,
                   in a serial environment, owners = NULL
   fronts[]     -- vector of pointers to fronts
   lookahead    -- parameter controls the partial upward visiting
                   of ancestors before returning
   tau          -- used when pivoting enabled,
                   |L_{j,i}| and |U_{i,j}| <= tau
   droptol      -- used for an approximate factorization
                   stored |L_{j,i}| and |U_{i,j}| > droptol
   status[]     -- status vector for the fronts,
                   'W' -- needs to be woke up
                   'A' -- active front
                   'F' -- front is finished
   heads[]      -- vector of pointers to IP objects that store the
                   front-to-front update lists
   pivotsizesIV -- IV object used during the factorization of a front
                   when pivoting is enabled
   workDV       -- DV object used for working storage
   parent       -- front parent vector
   aggList      -- list object used in parallel environment, used
                   to store aggregate fronts
   postList     -- list object used in pivoting and/or parallel
                   environments, used to stored delayed data and/or
                   to synchronize the factorization
   chvmanager   -- used to manage working storage for Chv objects
   stats[]      -- statistics vector
   cpus[]       -- vector to hold breakdown of cpu times
   msglvl       -- message level
   msgFil       -- message file
 
   created -- 98may04, cca
   ------------------------------------------------------------------
*/
char
FrontMtx_factorVisit (
   FrontMtx     *frontmtx,
   Pencil       *pencil,
   int          J,
   int          myid,
   int          owners[],
   Chv          *fronts[],
   int          lookahead,
   double       tau,
   double       droptol,
   char         status[],
   IP           *heads[],
   IV           *pivotsizesIV,
   DV           *workDV,
   int          parent[],
   ChvList      *aggList,
   ChvList      *postList,
   ChvManager   *chvmanager,
   int          stats[],
   double       cpus[],
   int          msglvl,
   FILE         *msgFile
) ;
/*
   --------------------------------------------
   purpose -- set up the front's data structure
 
   created -- 98mar27, cca
   --------------------------------------------
*/
Chv *
FrontMtx_setupFront (
   FrontMtx     *frontmtx,
   Pencil       *pencil,
   int          J,
   int          myid,
   int          owners[],
   ChvManager   *chvmanager,
   double       cpus[],
   int          msglvl,
   FILE         *msgFile
) ;
/*
   --------------------------------------------------------------------
   purpose -- to set up the link data structures
      for a parallel factorization for process myid
 
   return value -- pointer to IP *heads[nfront+2], which contains
      the beginning of a list of IP objects that store the remaining
      updates to the fronts.
      note, heads[nfront] is the first IP object in the free list.
      heads[nfront+1] is the base address of the allocated IP objects.
 
   created -- 98mar07, cca
   --------------------------------------------------------------------
*/
IP **
FrontMtx_factorSetup (
   FrontMtx   *frontmtx,
   IV         *frontOwnersIV,
   int        myid,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   -----------------------------------------------
   create and return the nactiveChild vector.
   nactiveChild[J] contains the number of children
   of J that belong to an active path
 
   created -- 97jul03, cca
   -----------------------------------------------
*/
int *
FrontMtx_nactiveChild (
   FrontMtx   *frontmtx,
   char       *status,
   int        myid
) ;
/*
   ---------------------------------------------------------
   create, initialize and return a Ideq object
   that will be used for a parallel factorization,
   forward solve, or backward solve.
 
   the status[] vector will be set as follows:
      status[J] = activeflag   if J is on an active path
      status[J] = inactiveflag if J is not on an active path
 
   created -- 98mar27, cca
   ---------------------------------------------------------
*/
Ideq *
FrontMtx_setUpDequeue (
   FrontMtx   *frontmtx,
   int        owners[],
   int        myid,
   char       status[],
   IP         *heads[],
   char       activeFlag,
   char       inactiveFlag,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   -----------------------------------------------------------------
   purpose -- load the dequeue with the leaves of the active subtree
              used for a factorization and forward solve
 
   created -- 98mar27, cca
   -----------------------------------------------------------------
*/
void
FrontMtx_loadActiveLeaves (
   FrontMtx   *frontmtx,
   char       status[],
   char       activeFlag,
   Ideq       *dequeue
) ;
/*
   -----------------------------------------------
   create, initialize and return a ChvList object
   to deal with postponed chevrons
 
   created -- 97jul03, cca
   -----------------------------------------------
*/
ChvList *
FrontMtx_postList (
   FrontMtx   *frontmtx,
   IV          *frontOwnersIV,
   int         lockflag
) ;
/*
   -----------------------------------------------
   create, initialize and return a ChvList object
   to deal with aggregate chevrons
 
   created -- 97jul03, cca
   -----------------------------------------------
*/
ChvList *
FrontMtx_aggregateList (
   FrontMtx   *frontmtx,
   IV         *frontOwnersIV,
   int        lockflag
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in loadEntries.c -----------------------------------
------------------------------------------------------------------------
*/
/*
   ------------------------------------------------------------
   load entries from sigma*A
 
   chv     -- pointer to the Chv object that holds the front
   pencil  -- pointer to a Pencil that holds the matrix entries 
   msglvl  -- message level
   msgFile -- message file
 
   created  -- 97jul18, cca
   ------------------------------------------------------------
*/
void
FrontMtx_loadEntries (
   Chv      *chv,
   Pencil   *pencil,
   int      msglvl,
   FILE     *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in update.c ----------------------------------------
------------------------------------------------------------------------
*/
/*
   ------------------------------------------------------------
   accumulate updates to front J, store them in the Chv object
 
   created -- 98may04, cca
   ------------------------------------------------------------
*/
void
FrontMtx_update (
   FrontMtx   *frontmtx,
   Chv        *frontJ,
   IP         *heads[],
   char       status[],
   DV         *tempDV,
   int        msglvl,
   FILE       *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in postponed.c -------------------------------------
------------------------------------------------------------------------
*/
/*
   ------------------------------------------------------------------
   purpose -- to assemble any postponed data into frontJ
 
   frontJ  -- pointer to Chv objec that contains current front
   chvlist -- pointer to a ChvList object that handles the
              lists of postponed Chv objects
   chvmanager -- pointer to a ChvManager object for the list
                 of free Chv objects
   pndelay -- pointer to address to contain the # of delayed rows
              and columns that were assembled into the front
 
   return value -- pointer to Chv object that contains the new front
 
   created -- 98may04, cca
   ------------------------------------------------------------------
*/
Chv *
FrontMtx_assemblePostponedData (
   FrontMtx     *frontmtx,
   Chv          *frontJ,
   ChvList      *chvlist,
   ChvManager   *chvmanager,
   int          *pndelay
) ;
/*
   ---------------------------------------------------------
   purpose -- extract and store the postponed data
 
   frontJ  -- pointer to present front object
   npost   -- # of postponed rows and columns in frontJ
   K       -- parent of J
   chvlist -- pointer to a ChvList object that handles the
              lists of postponed Chv objects
              a singly linked list to assemble
   chvmanager -- pointer to a ChvManager object for the list
                 of free Chv objects
 
   created -- 98may04, cca
   ---------------------------------------------------------
*/
void
FrontMtx_storePostponedData (
   FrontMtx     *frontmtx,
   Chv          *frontJ,
   int          npost,
   int          K,
   ChvList      *chvlist,
   ChvManager   *chvmanager
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in storeFront.c ------------------------------------
------------------------------------------------------------------------
*/
/*
   ----------------------------------------------------------------
   purpose -- to store the factor indicies and entries from front J
 
   pivotsizesIV -- used for symmetric or hermitian and pivoting
   droptol      -- used for drop tolerance factorization,
                   an entry is stored if its magnitude > droptol
 
   created -- 98may04, cca
   ----------------------------------------------------------------
*/
void
FrontMtx_storeFront (
   FrontMtx   *frontmtx,
   Chv        *frontJ,
   IV         *pivotsizesIV,
   double     droptol,
   int        msglvl,
   FILE       *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in postProcess.c -----------------------------------
------------------------------------------------------------------------
*/
/*
   --------------------------------------------------------------
   purpose -- post-process the factorization
      (1) permute row and column adjacency objects if necessary
      (2) permute lower and upper matrices if necessary
      (3) update the block adjacency objects if necessary
      (4) split the chevron submatrices into submatrices
          and make the submatrix indices local w.r.t their fronts
 
   created -- 98mar05, cca
   --------------------------------------------------------------
*/
void
FrontMtx_postProcess (
   FrontMtx   *frontmtx,
   int        msglvl,
   FILE       *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in permute.c ---------------------------------------
------------------------------------------------------------------------
*/
/*
   ------------------------------------------------------------------
   purpose -- permute the upper adjacency structure so that the
      indices in bnd{J} are in ascending order w.r.t. their ancestors
 
   created -- 98mar05, cca
   ------------------------------------------------------------------
*/
void
FrontMtx_permuteUpperAdj (
   FrontMtx   *frontmtx,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   ------------------------------------------------------------------
   purpose -- permute the lower adjacency structure so that the
      indices in bnd{J} are in ascending order w.r.t. their ancestors
 
   created -- 98mar05, cca
   ------------------------------------------------------------------
*/
void
FrontMtx_permuteLowerAdj (
   FrontMtx   *frontmtx,
   int         msglvl,
   FILE        *msgFile
) ;
/*
   ------------------------------------------------------------
   purpose -- if the columns indices of the front matrix are in
      different order than the column indices of U_{J,bnd{J}},
      sort the columns of U_{J,bnd{J}} into ascending order
      w.r.t the column indices of the front matrix.
 
   created -- 98mar05, cca
   ------------------------------------------------------------
*/
void
FrontMtx_permuteUpperMatrices (
   FrontMtx   *frontmtx,
   int         msglvl,
   FILE        *msgFile
) ;
/*
   --------------------------------------------------------
   purpose -- if the row indices of the front matrix are in
      different order than the row indices of L_{bnd{J},J},
      sort the rows of L_{bnd{J},J} into ascending order
      w.r.t the row indices of the front matrix.
 
   created -- 98mar05, cca
   --------------------------------------------------------
*/
void
FrontMtx_permuteLowerMatrices (
   FrontMtx   *frontmtx,
   int         msglvl,
   FILE        *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in split.c -----------------------------------------
------------------------------------------------------------------------
*/
/*
   ----------------------------------------------------------------
   purpose -- for each U_{J,bnd{J}} matrix, remove from hash table,
              split into their U_{J,K} submatrices and insert
              into the hash table.
 
   created -- 98may04, cca
   ----------------------------------------------------------------
*/
void
FrontMtx_splitUpperMatrices (
   FrontMtx   *frontmtx,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   ----------------------------------------------------------------
   purpose -- for each L_{bnd{J},J} matrix, remove from hash table,
              split into their L_{K,J} submatrices and insert
              into the hash table.
 
   created -- 98may04, cca
   ----------------------------------------------------------------
*/
void
FrontMtx_splitLowerMatrices (
   FrontMtx   *frontmtx,
   int         msglvl,
   FILE        *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in solve.c -----------------------------------------
------------------------------------------------------------------------
*/
/*
   --------------------------------------------------------------
   purpose -- to solve a linear system 
 
   frontmtx -- FrontMtx object that holds the factor matrices
   solmtx   -- DenseMtx that holds the solution
   rhsmtx   -- DenseMtx that holds the right hand side matrix
      note: right hand side entries are copied from rhsmtx,
            and solution entries are copied into solmtx.
            when the row indices of rhsmtx and solmtx are
            identical, rhsmtx and solmtx can be the same object.
   cpus -- vector to hold cpu breakdown time
      cpus[0] -- set up solves
      cpus[1] -- fetch rhs and store solution
      cpus[2] -- forward solve
      cpus[3] -- diagonal solve
      cpus[4] -- backward solve
      cpus[5] -- total time
   mtxmanager -- object that manages working storage
   msglvl  -- message level
   msgFile -- message file
 
   created -- 98may04, cca
   ------------------------------------------------------------
*/
void
FrontMtx_solve (
   FrontMtx        *frontmtx,
   DenseMtx        *solmtx,
   DenseMtx        *rhsmtx,
   SubMtxManager   *mtxmanager,
   double          cpus[],
   int             msglvl,
   FILE            *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in solveUtil.c -------------------------------------
------------------------------------------------------------------------
*/
/*
   ---------------------------------------------
   load the right hand side for the owned fronts
 
   created -- 98mar19, cca
   ---------------------------------------------
*/
SubMtx **
FrontMtx_loadRightHandSide ( 
   FrontMtx        *frontmtx,
   DenseMtx        *rhsmtx,
   int             owners[],
   int             myid,
   SubMtxManager   *mtxmanager,
   int             msglvl,
   FILE            *msgFile
) ;
/*
   --------------------------------------
   visit front J during the forward solve
 
   created -- 98mar27, cca
   --------------------------------------
*/
void
FrontMtx_forwardVisit (
   FrontMtx        *frontmtx,
   int             J,
   int             nrhs,
   int             *owners,
   int             myid,
   SubMtxManager   *mtxmanager,
   SubMtxList      *aggList,
   SubMtx          *p_mtx[],
   char            frontIsDone[],
   IP              *heads[],
   SubMtx          *p_agg[],
   char            status[],
   int             msglvl,
   FILE            *msgFile
) ;
/*
   --------------------------------------------------
   purpose -- visit front J during the diagonal solve
 
   created -- 98feb20, cca
   --------------------------------------------------
*/
void
FrontMtx_diagonalVisit (
   FrontMtx   *frontmtx,
   int        J,
   int        owners[],
   int        myid,
   SubMtx     *p_mtx[],
   char       frontIsDone[],
   SubMtx     *p_agg[],
   int        msglvl,
   FILE       *msgFile
) ;
/*
   ---------------------------------------
   visit front J during the backward solve
 
   created -- 98mar27, cca
   ---------------------------------------
*/
void
FrontMtx_backwardVisit (
   FrontMtx        *frontmtx,
   int             J,
   int             nrhs,
   int             *owners,
   int             myid,
   SubMtxManager   *mtxmanager,
   SubMtxList      *aggList,
   SubMtx          *p_mtx[],
   char            frontIsDone[],
   IP              *heads[],
   SubMtx          *p_agg[],
   char            status[],
   int             msglvl,
   FILE            *msgFile
) ;
/*
   ---------------------------------------------------
   purpose -- move the solution from the individual
     SubMtx objects into the global solution SubMtx object
 
   created -- 98feb20
   ---------------------------------------------------
*/
void
FrontMtx_storeSolution (
   FrontMtx        *frontmtx,
   int             owners[],
   int             myid,
   SubMtxManager   *manager,
   SubMtx          *p_mtx[],
   DenseMtx        *solmtx,
   int             msglvl,
   FILE            *msgFile
) ;
/*
   ---------------------------------------------------
   purpose -- load the dequeue with the roots of the
              active subtree used for a backward solve
 
   created -- 98mar27, cca
   ---------------------------------------------------
*/
void
FrontMtx_loadActiveRoots (
   FrontMtx   *frontmtx,
   char        status[],
   char        activeFlag,
   Ideq        *dequeue
) ;
/*
   --------------------------------------------------------------------
   purpose -- to set up the link data structures for a forward solve
 
   return value -- pointer to IP *heads[nfront+2], which contains
      the beginning of a list of IP objects that store the remaining
      updates to the fronts.
      note, heads[nfront] is the first IP object in the free list.
      heads[nfront+1] is the base address of the allocated IP objects.
 
   created -- 98feb20, cca
   --------------------------------------------------------------------
*/
IP **
FrontMtx_forwardSetup (
   FrontMtx   *frontmtx,
   int         msglvl,
   FILE        *msgFile
) ;
/*
   ---------------------------------------------------------
   purpose -- set up the linked lists for the backward solve
 
   created -- 98feb20, cca
   ---------------------------------------------------------
*/
IP **
FrontMtx_backwardSetup (
   FrontMtx   *frontmtx,
   int         msglvl,
   FILE        *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in QRfactor.c --------------------------------------
------------------------------------------------------------------------
*/
/*
   ------------------------------------------------------------
   purpose -- to compute the (U+I)D(I+U) factorization of A^TA,
              where A = QR, R = (D^{1/2} + D^{1/2}U)

   cpus[0] -- setup time
   cpus[1] -- initialize and load staircase matrix
   cpus[2] -- permute the rows into staircase form
   cpus[3] -- factor the matrix
   cpus[4] -- scale and store factor entries
   cpus[5] -- store update entries
   cpus[6] -- miscellaneous time
 
   created -- 98may28, cca
   ------------------------------------------------------------
*/
void
FrontMtx_QR_factor (
   FrontMtx     *frontmtx,
   InpMtx       *mtxA,
   ChvManager   *chvmanager,
   double       cpus[],
   double       *pfacops,
   int          msglvl,
   FILE         *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in QRsolve.c ---------------------------------------
------------------------------------------------------------------------
*/
/*
   -------------------------------------------------
   minimize ||b - Ax||_2 by
   solving (U^T + I) * D * (I + U) X = A^T * B
      where A = QR = QD(I + U)
   by calling FrontMtx_solve()
 
   mtxmanager -- object that manages working storage
   cpus -- vector of cpu time breakdowns
      cpus[0] -- set up solves
      cpus[1] -- fetch rhs and store solution
      cpus[2] -- forward solve
      cpus[3] -- diagonal solve
      cpus[4] -- backward solve
      cpus[5] -- total solve time
      cpus[6] -- time to compute A^T * B
      cpus[7] -- total time
 
   created  -- 97may27, dkw
   modified -- 98may28, cca
   -------------------------------------------------
*/
void
FrontMtx_QR_solve (
   FrontMtx        *frontmtx,
   InpMtx          *mtxA,
   DenseMtx        *mtxX,
   DenseMtx        *mtxB,
   SubMtxManager   *manager,
   double          cpus[],
   int             msglvl,
   FILE            *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in QRutil.c ----------------------------------------
------------------------------------------------------------------------
*/
/*
   --------------------------------------------------------------------
   purpose -- to setup two data structures for a QR serial
              or multithreaded factorization
 
   rowsIVL[J]    -- list of rows of A to be assembled into front J
   firstnz[irow] -- column with location of leading nonzero of row in A
 
   created -- 98may29, cca
   --------------------------------------------------------------------
*/
void
FrontMtx_QR_setup (
   FrontMtx   *frontmtx,
   InpMtx     *mtxA,
   IVL        **prowsIVL,
   int        **pfirstnz,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   -----------------------------------------------
   purpose --  visit front J during a serial 
               or multithreaded QR factorization
 
   cpus[1] -- initialize and load staircase matrix
   cpus[2] -- factor the matrix
   cpus[3] -- scale and store factor entries
   cpus[4] -- store update entries
 
   created -- 98may28, cca
   -----------------------------------------------
*/
void
FrontMtx_QR_factorVisit (
   FrontMtx     *frontmtx,
   int          J,
   InpMtx       *mtxA,
   IVL          *rowsIVL,
   int          firstnz[],
   ChvList      *updlist,
   ChvManager   *chvmanager,
   char         status[],
   int          colmap[],
   DV           *workDV,
   double       cpus[],
   double       *pfacops,
   int          msglvl,
   FILE         *msgFile
) ;
/*
   --------------------------------------------------------------
   purpose -- create and return an A2 object that contains rows
              of A and rows from update matrices of the children.
              the matrix may not be in staircase form
 
   created -- 98may25, cca
   --------------------------------------------------------------
*/
A2 *
FrontMtx_QR_assembleFront (
   FrontMtx   *frontmtx,
   int        J,
   InpMtx     *mtxA,
   IVL        *rowsIVL,
   int        firstnz[],
   int        colmap[],
   Chv        *firstchild,
   DV         *workDV,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   ----------------------------------------------------
   store the factor entries of the reduced front matrix
 
   created -- 98may25, cca
   ----------------------------------------------------
*/
void
FrontMtx_QR_storeFront (
   FrontMtx   *frontmtx,
   int        J,
   A2         *frontJ,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   -------------------------------------------------
   purpose -- to create and return a Chv object that
              holds the update matrix for front J
 
   created -- 98may25, cca
   -------------------------------------------------
*/
Chv *
FrontMtx_QR_storeUpdate (
   FrontMtx     *frontmtx,
   int          J,
   A2           *frontJ,
   ChvManager   *chvmanager,
   int          msglvl,
   FILE         *msgFile
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in util.c ------------------------------------------
------------------------------------------------------------------------
*/
/*
   -----------------------------------------
   purpose -- produce a map from each column
              to the front that contains it
 
   created -- 98may04, cca
   -----------------------------------------
*/
IV *
FrontMtx_colmapIV (
   FrontMtx   *frontmtx
) ;
/*
   --------------------------------------------------------------------
   purpose -- produce a map from each row to the front that contains it
 
   created -- 98may04, cca
   --------------------------------------------------------------------
*/
IV *
FrontMtx_rowmapIV (
   FrontMtx   *frontmtx
) ;
/*
   -------------------------------------------------------------
   compute the inertia of a symmetric matrix
 
   fill *pnnegative with the number of negative eigenvalues of A
   fill *pnzero     with the number of zero eigenvalues of A
   fill *pnpositive with the number of positive eigenvalues of A
 
   created -- 98may04, cca
   -------------------------------------------------------------
*/
void
FrontMtx_inertia (
   FrontMtx   *frontmtx,
   int         *pnnegative,
   int         *pnzero,
   int         *pnpositive
) ;
/*
   -------------------------------------------------------
   purpose -- create and return an IV object that contains 
              all the row ids owned by process myid.
 
   created -- 98jun13, cca
   -------------------------------------------------------
*/
IV *
FrontMtx_ownedRowsIV (
   FrontMtx   *frontmtx,
   int        myid,
   IV         *ownersIV,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   -------------------------------------------------------
   purpose -- create and return an IV object that contains 
              all the column ids owned by process myid.
 
   created -- 98jun13, cca
   -------------------------------------------------------
*/
IV *
FrontMtx_ownedColumnsIV (
   FrontMtx   *frontmtx,
   int        myid,
   IV         *ownersIV,
   int        msglvl,
   FILE       *msgFile
) ;
/*
   ----------------------------------------------------------------
  purpose -- to create and return an IVL object that holds the
      submatrix nonzero pattern for the upper triangular factor.
 
   NOTE: this method supercedes calling IVL_mapEntries() on
         the column adjacency structure. that gave problems when
         pivoting forced some fronts to have no eliminated columns.
        in some cases, solve aggregates were expected when none
         were forthcoming.
 
   created -- 98aug20, cca
   ----------------------------------------------------------------
*/
IVL *
FrontMtx_makeUpperBlockIVL (
   FrontMtx   *frontmtx,
   IV         *colmapIV
) ;
/*
   ----------------------------------------------------------------
  purpose -- to create and return an IVL object that holds the
      submatrix nonzero pattern for the lower triangular factor.
 
   NOTE: this method supercedes calling IVL_mapEntries() on
         the row adjacency structure. that gave problems when
         pivoting forced some fronts to have no eliminated columns.
        in some cases, solve aggregates were expected when none
         were forthcoming.
 
   created -- 98aug20, cca
   ----------------------------------------------------------------
*/
IVL *
FrontMtx_makeLowerBlockIVL (
   FrontMtx   *frontmtx,
   IV         *rowmapIV
) ;
/*
   ---------------------------------------------------------------
   purpose -- to compute and return the number of floating point
      operations to perform a solve with a single right hand side.
 
   created -- 98sep26, cca
   ---------------------------------------------------------------
*/
int
FrontMtx_nSolveOps (
   FrontMtx   *frontmtx
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- methods found in IO.c --------------------------------------------
------------------------------------------------------------------------
*/
/*
   -----------------------------------------------------
   purpose -- to read in an FrontMtx object from a file
 
   input --
 
      fn -- filename, must be *.frontmtxb or *.frontmtxf
 
   return value -- 1 if success, 0 if failure
 
   created -- 98may04, cca
   -----------------------------------------------------
*/
int
FrontMtx_readFromFile (
   FrontMtx   *frontmtx,
   char       *fn
) ;
/*
   ------------------------------------------------------------
   purpose -- to read an FrontMtx object from a formatted file
 
   return value -- 1 if success, 0 if failure
 
   created -- 98may04, cca
   ------------------------------------------------------------
*/
int
FrontMtx_readFromFormattedFile (
   FrontMtx   *frontmtx,
   FILE        *fp
) ;
/*
   --------------------------------------------------------
   purpose -- to read an FrontMtx object from a binary file
 
   return value -- 1 if success, 0 if failure
 
   created -- 98may04, cca
   --------------------------------------------------------
*/
int
FrontMtx_readFromBinaryFile (
   FrontMtx   *frontmtx,
   FILE        *fp
) ;
/*
   -------------------------------------------------
   purpose -- to write an FrontMtx object to a file
 
   input --
 
      fn -- filename
        *.frontmtxb -- binary
        *.frontmtxf -- formatted
        anything else -- for human eye
 
   return value -- 1 if success, 0 otherwise
 
   created -- 98may04, cca
   -------------------------------------------------
*/
int
FrontMtx_writeToFile (
   FrontMtx   *frontmtx,
   char        *fn
) ;
/*
   -----------------------------------------------------------
   purpose -- to write an FrontMtx object to a formatted file
 
   return value -- 1 if success, 0 otherwise
 
   created -- 98may04, cca
   -----------------------------------------------------------
*/
int
FrontMtx_writeToFormattedFile (
   FrontMtx   *frontmtx,
   FILE       *fp
) ;
/*
   -------------------------------------------------------
   purpose -- to write an FrontMtx object to a binary file
 
   return value -- 1 if success, 0 otherwise
 
   created -- 98may04, cca
   -------------------------------------------------------
*/
int
FrontMtx_writeToBinaryFile (
   FrontMtx   *frontmtx,
   FILE        *fp
) ;
/*
   ---------------------------------------------------------------
   purpose -- to write out the statistics for the FrontMtx object
 
   return value -- 1 if success, 0 otherwise
 
   created -- 98may04, cca
   ---------------------------------------------------------------
*/
int
FrontMtx_writeStats (
   FrontMtx   *frontmtx,
   FILE        *fp
) ;
/*
   ----------------------------------------
   purpose -- to write the object to a file
              in human readable form
 
   created -- 98may04, cca
   ----------------------------------------
*/
int
FrontMtx_writeForHumanEye (
   FrontMtx   *frontmtx,
   FILE       *fp
) ;
/*
   -------------------------------------------------------------
   purpose -- to write the factor matrices out for a matlab file
 
      Lname -- name for lower triangular matrix
      Dname -- name for diagonal matrix
      Uname -- name for upper triangular matrix
 
   presently works only with 1-d data decomposition
 
   created -- 98sep23, cca
   -------------------------------------------------------------
*/
int
FrontMtx_writeForMatlab (
   FrontMtx   *frontmtx,
   char       *Lname,
   char       *Dname,
   char       *Uname,
   FILE       *fp
) ;
/*--------------------------------------------------------------------*/