1\par 2\section{Prototypes and descriptions of {\tt FrontMtx} methods} 3\label{section:FrontMtx:proto} 4\par 5This section contains brief descriptions including prototypes 6of all methods that belong to the {\tt FrontMtx} object. 7\par 8\subsection{Basic methods} 9\label{subsection:FrontMtx:proto:basics} 10\par 11As usual, there are four basic methods to support object creation, 12setting default fields, clearing any allocated data, and free'ing 13the object. 14\par 15%======================================================================= 16\begin{enumerate} 17%----------------------------------------------------------------------- 18\item 19\begin{verbatim} 20FrontMtx * FrontMtx_new ( void ) ; 21\end{verbatim} 22\index{FrontMtx_new@{\tt FrontMtx\_new()}} 23This method simply allocates storage for the {\tt FrontMtx} structure 24and then sets the default fields by a call to 25{\tt FrontMtx\_setDefaultFields()}. 26%----------------------------------------------------------------------- 27\item 28\begin{verbatim} 29void FrontMtx_setDefaultFields ( FrontMtx *frontmtx ) ; 30\end{verbatim} 31\index{FrontMtx_setDefaultFields@{\tt FrontMtx\_setDefaultFields()}} 32The structure's fields are set to default values: 33{\tt nfront}, {\tt neqns}, {\tt nentD}, {\tt nentL}, {\tt nentU} and 34{\tt nlocks} are set to zero. 35Five scalars are set to their default values, 36\begin{center} 37\begin{tabular}{lcl} 38{\tt type} & = & {\tt SPOOLES\_REAL} \\ 39{\tt symmetryflag} & = & {\tt SPOOLES\_SYMMETRIC} \\ 40{\tt sparsityflag} & = & {\tt FRONTMTX\_DENSE\_FRONTS} \\ 41{\tt pivotingflag} & = & {\tt SPOOLES\_NO\_PIVOTING} \\ 42{\tt dataMode} & = & {\tt FRONTMTX\_1D\_MODE} 43\end{tabular} 44\end{center} 45and the structure's pointers are set to {\tt NULL}. 46% {\tt tree}, 47% {\tt frontETree}, 48% {\tt symbfacIVL}, 49% {\tt frontsizesIV}, 50% {\tt rowadjIVL}, 51% {\tt coladjIVL}, 52% {\tt lowerblockIVL}, 53% {\tt upperblockIVL}, 54% {\tt p\_mtxDJJ}, 55% {\tt p\_mtxUJJ}, 56% {\tt p\_mtxUJN}, 57% {\tt p\_mtxLJJ}, 58% {\tt p\_mtxLNJ}, 59% {\tt lowerhash}, 60% {\tt upperhash} and 61% {\tt lock} 62% are set to {\tt NULL} . 63\par \noindent {\it Error checking:} 64If {\tt frontmtx} is {\tt NULL}, 65an error message is printed and the program exits. 66%----------------------------------------------------------------------- 67\item 68\begin{verbatim} 69void FrontMtx_clearData ( FrontMtx *frontmtx ) ; 70\end{verbatim} 71\index{FrontMtx_clearData@{\tt FrontMtx\_clearData()}} 72This method clears the object and free's any owned data 73by invoking the {\tt \_clearData()} methods for its internal 74{\tt IV} and {\tt IVL} objects, ({\it not} including 75the {\tt frontETree} and {\tt symbfacIVL} objects that are not 76owned by this {\tt FrontMtx} object). 77If the {\tt lock} pointer is not {\tt NULL}, the lock is destroyed 78via a call to {\tt Lock\_free()} and its storage is then 79free'd. 80There is a concluding call to {\tt FrontMtx\_setDefaultFields()}. 81\par \noindent {\it Error checking:} 82If {\tt frontmtx} is {\tt NULL}, 83an error message is printed and the program exits. 84%----------------------------------------------------------------------- 85\item 86\begin{verbatim} 87void FrontMtx_free ( FrontMtx *frontmtx ) ; 88\end{verbatim} 89\index{FrontMtx_free@{\tt FrontMtx\_free()}} 90This method releases any storage by a call to 91{\tt FrontMtx\_clearData()} and then free the space for {\tt frontmtx}. 92\par \noindent {\it Error checking:} 93If {\tt frontmtx} is {\tt NULL}, 94an error message is printed and the program exits. 95%----------------------------------------------------------------------- 96\end{enumerate} 97\par 98\subsection{Instance methods} 99\label{subsection:FrontMtx:proto:instance} 100\par 101%======================================================================= 102\begin{enumerate} 103%----------------------------------------------------------------------- 104\item 105\begin{verbatim} 106int FrontMtx_nfront ( FrontMtx *frontmtx ) ; 107\end{verbatim} 108\index{FrontMtx_nfront@{\tt FrontMtx\_nfront()}} 109This method returns the number of fronts in the matrix. 110\par \noindent {\it Error checking:} 111If {\tt frontmtx} is {\tt NULL}, 112an error message is printed and the program exits. 113%----------------------------------------------------------------------- 114\item 115\begin{verbatim} 116int FrontMtx_neqns ( FrontMtx *frontmtx ) ; 117\end{verbatim} 118\index{FrontMtx_neqns@{\tt FrontMtx\_neqns()}} 119This method returns the number of equations in the matrix. 120\par \noindent {\it Error checking:} 121If {\tt frontmtx} is {\tt NULL}, 122an error message is printed and the program exits. 123%----------------------------------------------------------------------- 124\item 125\begin{verbatim} 126Tree * FrontMtx_frontTree ( FrontMtx *frontmtx ) ; 127\end{verbatim} 128\index{FrontMtx_frontTree@{\tt FrontMtx\_frontTree()}} 129This method returns the {\tt Tree} object for the fronts. 130\par \noindent {\it Error checking:} 131If {\tt frontmtx} is {\tt NULL}, 132an error message is printed and the program exits. 133%----------------------------------------------------------------------- 134\item 135\begin{verbatim} 136void FrontMtx_initialFrontDimensions ( FrontMtx *frontmtx, int J, 137 int *pnD, int *pnL, int *pnU, int *pnbytes ) ; 138\end{verbatim} 139\index{FrontMtx_initialFrontDimensions@{\tt FrontMtx\_initialFrontDimensions()}} 140This method fills the four pointer arguments with the number of 141internal rows and columns, number of rows in the lower block, 142number of columns in the upper block, and number of bytes for a 143{\tt Chv} object to hold the front. 144in front {\tt J}. 145\par \noindent {\it Error checking:} 146If {\tt frontmtx} is {\tt NULL}, 147or if {\tt J} is not in {\tt [0,nfront)}, 148or if any of the four pointer arguments are NULL, 149an error message is printed and the program exits. 150%----------------------------------------------------------------------- 151\item 152\begin{verbatim} 153int FrontMtx_frontSize ( FrontMtx *frontmtx, int J ) ; 154\end{verbatim} 155\index{FrontMtx_frontSize@{\tt FrontMtx\_frontSize()}} 156This method returns the number of internal rows and columns 157in front {\tt J}. 158\par \noindent {\it Error checking:} 159If {\tt frontmtx} or {\tt frontsizesIV} is {\tt NULL}, 160or if {\tt J} is not in {\tt [0,nfront)}, 161an error message is printed and the program exits. 162%----------------------------------------------------------------------- 163\item 164\begin{verbatim} 165void FrontMtx_setFrontSize ( FrontMtx *frontmtx, int J, int size ) ; 166\end{verbatim} 167\index{FrontMtx_setFrontsize@{\tt FrontMtx\_setFrontSize()}} 168This method sets the number of internal rows and columns 169in front {\tt J} to be {\tt size}. 170This method is used during factorizations with pivoting enabled 171since we cannot tell ahead of time how many rows and columns in a 172front will be eliminated. 173\par \noindent {\it Error checking:} 174If {\tt frontmtx} or {\tt frontsizesIV} is {\tt NULL}, 175or if {\tt J} is not in {\tt [0,nfront)}, 176or if ${\tt size} < 0$, 177an error message is printed and the program exits. 178%----------------------------------------------------------------------- 179\item 180\begin{verbatim} 181void FrontMtx_columnIndices ( FrontMtx *frontmtx, int J, 182 int *pncol, int **pindices ) ; 183\end{verbatim} 184\index{FrontMtx_columnIndices@{\tt FrontMtx\_columnIndices()}} 185This method fills {\tt *pncol} with the number of columns 186and {\tt *pindices} with a pointer to the column indices for front 187{\tt J}. 188\par \noindent {\it Error checking:} 189If {\tt frontmtx}, {\tt pncol} or {\tt pindices} is {\tt NULL}, 190or if {\tt J} is not in {\tt [0,nfront)}, 191an error message is printed and the program exits. 192%----------------------------------------------------------------------- 193\item 194\begin{verbatim} 195void FrontMtx_rowIndices ( FrontMtx *frontmtx, int J, 196 int *pnrow, int **pindices ) ; 197\end{verbatim} 198\index{FrontMtx_rowIndices@{\tt FrontMtx\_rowIndices()}} 199This method fills {\tt *pnrow} with the number of rows 200and {\tt *pindices} with a pointer to the row indices for front 201{\tt J}. 202\par \noindent {\it Error checking:} 203If {\tt frontmtx}, {\tt pnrow} or {\tt pindices} is {\tt NULL}, 204or if {\tt J} is not in {\tt [0,nfront)}, 205an error message is printed and the program exits. 206%----------------------------------------------------------------------- 207\item 208\begin{verbatim} 209SubMtx * FrontMtx_diagMtx ( FrontMtx *frontmtx, int J ) ; 210\end{verbatim} 211\index{FrontMtx_diagMtx@{\tt FrontMtx\_diagMtx()}} 212This method returns a pointer to the object that contains 213submatrix $D_{J,J}$. 214\par \noindent {\it Error checking:} 215If {\tt frontmtx} is {\tt NULL}, 216or if {\tt J} is not in {\tt [0,nfront)}, 217an error message is printed and the program exits. 218%----------------------------------------------------------------------- 219\item 220\begin{verbatim} 221SubMtx * FrontMtx_upperMtx ( FrontMtx *frontmtx, int J, int K ) ; 222\end{verbatim} 223\index{FrontMtx_upperMtx@{\tt FrontMtx\_upperMtx()}} 224This method returns a pointer to the object that contains 225submatrix $U_{J,K}$. 226If $K = nfront$, then the object containing $U_{J,\bnd{J}}$ is 227returned. 228\par \noindent {\it Error checking:} 229If {\tt frontmtx} is {\tt NULL}, 230or if {\tt J} is not in {\tt [0,nfront)}, 231or if {\tt K} is not in {\tt [0,nfront]}, 232an error message is printed and the program exits. 233%----------------------------------------------------------------------- 234\item 235\begin{verbatim} 236SubMtx * FrontMtx_lowerMtx ( FrontMtx *frontmtx, int K, int J ) ; 237\end{verbatim} 238\index{FrontMtx_lowerMtx@{\tt FrontMtx\_lowerMtx()}} 239This method returns a pointer to the object that contains 240submatrix $L_{K,J}$. 241If $K = nfront$, then the object containing $L_{\bnd{J},J}$ is 242returned. 243\par \noindent {\it Error checking:} 244If {\tt frontmtx} is {\tt NULL}, 245or if {\tt J} is not in {\tt [0,nfront)}, 246or if {\tt K} is not in {\tt [0,nfront]}, 247an error message is printed and the program exits. 248%----------------------------------------------------------------------- 249\item 250\begin{verbatim} 251void FrontMtx_lowerAdjFronts ( FrontMtx *frontmtx, int J, 252 int *pnadj, int **padj ) ; 253\end{verbatim} 254\index{FrontMtx_lowerAdjFronts@{\tt FrontMtx\_lowerAdjFronts()}} 255This method fills {\tt *pnadj} with the number of fronts adjacent to 256{\tt J} in $L$ and fills {\tt *padj} with a pointer to the first 257entry of a vector containing the ids of the adjacent fronts. 258\par \noindent {\it Error checking:} 259If {\tt frontmtx}, {\tt pnadj} or {\tt ppadj} is {\tt NULL}, 260or if {\tt J} is not in {\tt [0,nfront)}, 261an error message is printed and the program exits. 262%----------------------------------------------------------------------- 263\item 264\begin{verbatim} 265void FrontMtx_upperAdjFronts ( FrontMtx *frontmtx, int J, 266 int *pnadj, int **padj ) ; 267\end{verbatim} 268\index{FrontMtx_upperAdjFronts@{\tt FrontMtx\_upperAdjFronts()}} 269This method fills {\tt *pnadj} with the number of fronts adjacent to 270{\tt J} in $U$ and fills {\tt *padj} with a pointer to the first 271entry of a vector containing the ids of the adjacent fronts. 272\par \noindent {\it Error checking:} 273If {\tt frontmtx}, {\tt pnadj} or {\tt ppadj} is {\tt NULL}, 274or if {\tt J} is not in {\tt [0,nfront)}, 275an error message is printed and the program exits. 276%----------------------------------------------------------------------- 277\item 278\begin{verbatim} 279int FrontMtx_nLowerBlocks ( FrontMtx *frontmtx ) ; 280\end{verbatim} 281\index{FrontMtx_nLowerBlocks@{\tt FrontMtx\_nLowerBlocks()}} 282This method returns the number of nonzero $L_{K,J}$ submatrices. 283\par \noindent {\it Error checking:} 284If {\tt frontmtx} is {\tt NULL}, 285an error message is printed and the program exits. 286%----------------------------------------------------------------------- 287\item 288\begin{verbatim} 289int FrontMtx_nUpperBlocks ( FrontMtx *frontmtx ) ; 290\end{verbatim} 291\index{FrontMtx_nUpperBlocks@{\tt FrontMtx\_nUpperBlocks()}} 292This method returns the number of nonzero $U_{J,K}$ submatrices. 293\par \noindent {\it Error checking:} 294If {\tt frontmtx} is {\tt NULL}, 295an error message is printed and the program exits. 296%----------------------------------------------------------------------- 297\item 298\begin{verbatim} 299IVL * FrontMtx_upperBlockIVL ( FrontMtx *frontmtx ) ; 300\end{verbatim} 301\index{FrontMtx_upperBlockIVL@{\tt FrontMtx\_upperBlockIVL()}} 302This method returns a pointer to the {\tt IVL} object that holds 303the upper blocks. 304\par \noindent {\it Error checking:} 305If {\tt frontmtx} is {\tt NULL}, 306an error message is printed and the program exits. 307%----------------------------------------------------------------------- 308\item 309\begin{verbatim} 310IVL * FrontMtx_lowerBlockIVL ( FrontMtx *frontmtx ) ; 311\end{verbatim} 312\index{FrontMtx_lowerBlockIVL@{\tt FrontMtx\_lowerBlockIVL()}} 313This method returns a pointer to the {\tt IVL} object that holds 314the lower blocks. 315\par \noindent {\it Error checking:} 316If {\tt frontmtx} is {\tt NULL}, 317an error message is printed and the program exits. 318%----------------------------------------------------------------------- 319\end{enumerate} 320\par 321\subsection{Initialization methods} 322\label{subsection:FrontMtx:proto:initialization} 323\par 324%======================================================================= 325\begin{enumerate} 326%----------------------------------------------------------------------- 327\item 328\begin{verbatim} 329void FrontMtx_init ( FrontMtx *frontmtx, ETree *frontETree, 330 IVL *symbfacIVL, int type, int symmetryflag, int sparsityflag, 331 int pivotingflag, int lockflag, int myid, IV *ownersIV, 332 SubMtxManager *manager, int msglvl, FILE *msgFile ) ; 333\end{verbatim} 334\index{FrontMtx_init@{\tt FrontMtx\_init()}} 335This method initializes the object, allocating and initializing the 336internal objects as necessary. 337See the previous section on data structures for the meanings of the 338{\tt type}, {\tt symmetryflag}, {\tt sparsityflag} and 339{\tt pivotingflag} parameters. 340The {\tt lockflag} parameter has the following meaning. 341\begin{itemize} 342\item {\tt 0} --- the {\tt Lock} object is not allocated 343 or initialized. 344\item {\tt 1} --- the {\tt Lock} object is allocated and initialized 345 to synchronize only threads in this process. 346\item {\tt 2} --- the {\tt Lock} object is allocated and initialized 347 to synchronize threads in this and other processes. 348\end{itemize} 349If {\tt lockflag} is not {\tt 0}, the lock is allocated and 350initialized. 351\par 352This method allocates as much storage as possible. 353When pivoting is not enabled and dense fronts are stored 354the structure of the factor matrix is fixed and given by the 355{\tt frontETree} object. 356The diagonal $D_{J,J}$, 357upper triangular $U_{J,J}$ and $U_{J,\bnd{J}}$ matrices, 358and lower triangular $L_{J,J}$ and $L_{\bnd{J},J}$ matrices 359are allocated. 360\par 361The {\tt myid} and {\tt ownersIV} parameters are used in 362a distributed environment where we specify which process 363owns each front. When we can preallocate data structures 364(when there is no pivoting and dense fronts are stored) we 365need each process to determine what parts of the data it 366can allocate and set up. In a serial or multithreaded 367environment, use {\tt ownersIV = NULL}. 368\par \noindent {\it Error checking:} 369If {\tt frontmtx}, {\tt frontETree} or {\tt symbfacIVL} is {\tt NULL}, 370or if {\tt type}, {\tt symmetryflag}, {\tt sparsityflag} 371or {\tt pivotingflag} are not valid, 372or if {\tt lockflag} is not {\tt 0}, {\tt 1} or {\tt 2}, 373or if {\tt ownersIV} is not {\tt NULL} and {\tt myid < 0}, 374an error message is printed and the program exits. 375%----------------------------------------------------------------------- 376\end{enumerate} 377\par 378\subsection{Utility Factorization methods} 379\label{subsection:FrontMtx:proto:utility-factor} 380\par 381The following methods are called by all the factor methods 382--- serial, multithreaded and MPI. 383\par 384%======================================================================= 385\begin{enumerate} 386%----------------------------------------------------------------------- 387\item 388\begin{verbatim} 389void FrontMtx_initializeFront ( FrontMtx *frontmtx, Chv *frontJ, int J ) ; 390\end{verbatim} 391\index{FrontMtx_initializeFront@{\tt FrontMtx\_initializeFront()}} 392This method is called to initialize a front. 393The number of internal rows and columns is found from the front 394{\tt ETree} object and the row and column indices are obtained 395from the symbolic factorization {\tt IVL} object. 396The front {\tt Chv} object is initialized via a call to 397{\tt Chv\_init()}, and the column indices and row indices (when 398nonsymemtric) are copied. 399Finally the front's entries are zeroed via a call to 400{\tt Chv\_zero()}. 401\par \noindent {\it Error checking:} 402None presently. 403%----------------------------------------------------------------------- 404\item 405\begin{verbatim} 406char FrontMtx_factorVisit ( FrontMtx *frontmtx, Pencil *pencil, int J, 407 int myid, int owners[], Chv *fronts[], int lookahead, double tau, 408 double droptol, char status[], IP *heads[], IV *pivotsizesIV, DV *workDV, 409 int parent[], ChvList *aggList, ChvList *postList, ChvManager *chvmanager, 410 int stats[], double cpus[], int msglvl, FILE *msgFile ) ; 411\end{verbatim} 412\index{FrontMtx_factorVisit@{\tt FrontMtx\_factorVisit()}} 413This method is called during the serial, multithreaded and MPI 414factorizations when front {\tt J} is visited during the bottom-up 415traversal of the tree. 416\par \noindent {\it Error checking:} 417None presently. 418%----------------------------------------------------------------------- 419\item 420\begin{verbatim} 421Chv * FrontMtx_setupFront ( FrontMtx *frontmtx, Pencil *pencil, int J, 422 int myid, int owners[], ChvManager *chvmanager, 423 double cpus[], int msglvl, FILE *msgFile ) ; 424\end{verbatim} 425\index{FrontMtx_setupFront@{\tt FrontMtx\_setupFront()}} 426This method is called by {\tt FrontMtx\_visitFront()} to initialize 427the front's {\tt Chv} object and load original entries if applicable. 428\par \noindent {\it Error checking:} 429None presently. 430%----------------------------------------------------------------------- 431\item 432\begin{verbatim} 433IP ** FrontMtx_factorSetup ( FrontMtx *frontmtx, IV *frontOwnersIV, 434 int myid, int msglvl, FILE *msgFile ) ; 435\end{verbatim} 436\index{FrontMtx_factorSetup@{\tt FrontMtx\_factorSetup()}} 437This method is called by the serial, multithreaded and MPI 438factorizations methods to initialize a data structure that contains 439the front-to-front updates that this thread or processor will perform. 440The data structure is a vector of pointers to {\tt IP} objects that 441holds the heads of list of updates for each front. 442\par \noindent {\it Error checking:} 443None presently. 444%----------------------------------------------------------------------- 445\item 446\begin{verbatim} 447int * FrontMtx_nactiveChild ( FrontMtx *frontmtx, char *status, int myid ) ; 448\end{verbatim} 449\index{FrontMtx_nactiveChild@{\tt FrontMtx\_nactiveChild()}} 450This method is called by the multithreaded and MPI factorizations 451to create an integer vector that contains the number of active 452children of each front with respect to this thread or processor. 453\par \noindent {\it Error checking:} 454If {\tt frontmtx} or {\tt status} is {\tt NULL}, 455or if ${\tt myid} < 0$, 456an error message is printed and the program exits. 457%----------------------------------------------------------------------- 458\item 459\begin{verbatim} 460Ideq * FrontMtx_setUpDequeue ( FrontMtx *frontmtx, int owners[], int myid, 461 char status[], IP *heads[], char activeFlag, 462 char inactiveFlag, int msglvl, FILE *msgFile ) ; 463\end{verbatim} 464\index{FrontMtx_nactiveChild@{\tt FrontMtx\_nactiveChild()}} 465This method is called by the multithreaded and MPI factorizations 466to create and return an integer dequeue object to schedule the bottom-up 467traversal of the front tree. 468\par \noindent {\it Error checking:} 469If {\tt frontmtx}, {\tt owners} or {\tt status} is {\tt NULL}, 470or if ${\tt myid} < 0$, 471an error message is printed and the program exits. 472%----------------------------------------------------------------------- 473\item 474\begin{verbatim} 475void FrontMtx_loadActiveLeaves ( FrontMtx *frontmtx, char status[], 476 char activeFlag, Ideq *dequeue ) ; 477\end{verbatim} 478\index{FrontMtx_loadActiveLeaves@{\tt FrontMtx\_loadActiveLeaves()}} 479This method is called by the multithreaded and MPI factor and solve 480methods to load the dequeue with the active leaves in the front 481tree with respect to the thread or processor. 482\par \noindent {\it Error checking:} 483None presently. 484%----------------------------------------------------------------------- 485\item 486\begin{verbatim} 487ChvList * FrontMtx_postList ( FrontMtx *frontmtx, IV *frontOwnersIV, 488 int lockflag ) ; 489\end{verbatim} 490\index{FrontMtx_postList@{\tt FrontMtx\_postList()}} 491This method is called by the multithreaded and MPI factor 492methods to create and return a list object to hold postponed 493chevrons and help synchronize the factorization. 494\par \noindent {\it Error checking:} 495None presently. 496%----------------------------------------------------------------------- 497\item 498\begin{verbatim} 499ChvList * FrontMtx_aggregateList ( FrontMtx *frontmtx, 500 IV *frontOwnersIV, int lockflag ) ; 501\end{verbatim} 502\index{FrontMtx_aggregateList@{\tt FrontMtx\_aggregateList()}} 503This method is called by the multithreaded factor 504methods to create and return a list object to hold aggregate 505fronts and help synchronize the factorization. 506There is an analogous {\tt FrontMtx\_MPI\_aggregateList()} method 507for the MPI environment. 508\par \noindent {\it Error checking:} 509If {\tt frontmtx} or {\tt frontOwnersIV} is {\tt NULL}, 510or if {\tt lockflag} is invalid, 511an error message is printed and the program exits. 512%----------------------------------------------------------------------- 513\item 514\begin{verbatim} 515void FrontMtx_loadEntries ( Chv *frontJ, DPencil *pencil, 516 int msglvl, FILE *msgFile) ; 517\end{verbatim} 518\index{FrontMtx_loadEntries@{\tt FrontMtx\_loadEntries()}} 519This method is called to load the original entries into a front. 520\par \noindent {\it Error checking:} 521If {\tt frontJ} is {\tt NULL}, 522or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 523an error message is printed and the program exits. 524%----------------------------------------------------------------------- 525\item 526\begin{verbatim} 527void FrontMtx_update ( FrontMtx *frontmtx, Chv *frontJ, IP *heads[], 528 char status[], DV *tempDV, int msglvl, FILE *msgFile) ; 529\end{verbatim} 530\index{FrontMtx_update@{\tt FrontMtx\_update()}} 531This method is called to update the current front stored in {\tt frontJ} 532from all descendent fronts. 533(For the multithreaded and MPI factorizations, updates come from 534all owned descendent fronts.) 535The {\tt heads[]} vector maintains the linked list of completed 536fronts that still have ancestors to update. 537The {\tt tempDV} object is used as working storage by the {\tt Chv} 538update methods, its size is automatically resized. 539When pivoting is disabled, the maximum size of the {\tt tempDV} 540object is three times the maximum number of internal rows and columns 541in a front. 542\par \noindent {\it Error checking:} 543None presently. 544%----------------------------------------------------------------------- 545\item 546\begin{verbatim} 547Chv * FrontMtx_assemblePostponedData ( FrontMtx *frontmtx, Chv *frontJ, 548 ChvList *postponedlist, ChvManager *chvmanager, int *pndelay) ; 549\end{verbatim} 550\index{FrontMtx_assemblePostponedData@{\tt FrontMtx\_assemblePostponedData()}} 551This method is called to assemble any postponed data 552from its children fronts into the current front. 553{\tt frontJ} contains the updates from the descendents. 554Any postponed data is found in the list in {\tt postponedlist}. 555If this list is empty, a new front is created to hold the aggregate 556updates and the postponed data, and 557the {\tt chvmanager} object receives the aggregate and postponed {\tt 558Chv} objects. 559The number of delayed rows and columns is returned in {\tt *pndelay} 560--- this is used during the factorization of the front that 561follows immediately. 562\par \noindent {\it Error checking:} 563None presently. 564%----------------------------------------------------------------------- 565\item 566\begin{verbatim} 567FrontMtx_storePostponedData ( FrontMtx *frontmtx, Chv *frontJ, 568 int npost, int K, ChvList *postponedlist, ChvManager *chvmanager ) ; 569\end{verbatim} 570\index{FrontMtx_storePostponedData@{\tt FrontMtx\_storePostponedData()}} 571This method is used to store any postponed rows and columns from 572the current front {\tt frontJ} into a {\tt Chv} object obtained 573from the {\tt chvmanager} object and place it into the list of 574postponed objects for {\tt K}, its parent, found in the {\tt 575postponedlist} object. 576The {\tt frontJ} object is unchanged by this method. 577\par \noindent {\it Error checking:} 578None presently. 579%----------------------------------------------------------------------- 580\item 581\begin{verbatim} 582FrontMtx_storeFront ( FrontMtx *frontmtx, Chv *frontJ, IV *pivotsizesIV, 583 double droptol, int msglvl, FILE *msgFile ) ; 584\end{verbatim} 585\index{FrontMtx_storeFront@{\tt FrontMtx\_storeFront()}} 586This method is used to store the eliminated rows and columns of the 587current front {\tt frontJ} into the factor matrix storage. 588\par \noindent {\it Error checking:} 589None presently. 590%----------------------------------------------------------------------- 591\end{enumerate} 592\par 593\subsection{Serial Factorization method} 594\label{subsection:FrontMtx:proto:factor} 595There are two factorization methods: the first is for factoring 596a matrix $A$ stored in a {\tt DInpMtx} object, the second factors 597a linear combination $A + \sigma B$ stored in a {\tt DPencil} object. 598\par 599%======================================================================= 600\begin{enumerate} 601%----------------------------------------------------------------------- 602\item 603\begin{verbatim} 604Chv * FrontMtx_factorInpMtx ( FrontMtx *frontmtx, InpMtx *inpmtx, double tau, 605 double droptol, ChvManager *chvmanager, int *perror, 606 double cpus[], int stats[], int msglvl, FILE *msgFile ) ; 607Chv * FrontMtx_factorPencil ( FrontMtx *frontmtx, Pencil *pencil, double tau, 608 double droptol, ChvManager *chvmanager, int *perror, 609 double cpus[], int stats[], int msglvl, FILE *msgFile ) ; 610\end{verbatim} 611\index{FrontMtx_factorInpMtx@{\tt FrontMtx\_factorInpMtx()}} 612\index{FrontMtx_factorPencil@{\tt FrontMtx\_factorPencil()}} 613These two serial factorization methods factor a matrix $A$ 614(stored in {\tt inpmtx}) or 615a matrix pencil $A + \sigma B$ (stored in {\tt pencil}). 616The {\tt tau} parameter is used when pivoting is enabled, each 617entry in $U$ and $L$ (when nonsymmetric) will have magnitude less 618than or equal to {\tt tau}. 619The {\tt droptol} parameter is used when the fronts are stored in 620a sparse format, each entry in $U$ and $L$ (when nonsymmetric) 621will have magnitude greater than or equal to {\tt droptol}. 622\par 623The return value is a pointer to the first element in a list of 624{\tt Chv} objects that contain the rows and columns that were 625not able to be eliminated. 626In all present cases, this should be {\tt NULL}; we have left this 627return value as a hook to future factorizations via stages. 628The {\tt perror} parameter is an address that is filled with an 629error code on return. 630If the factorization has completed, then {\tt *perror} is a 631negative number. 632If {\tt *perror} is in the range {\tt [0,nfront)}, then an error 633has been detected at front {\tt *perror}. 634On return, the {\tt cpus[]} vector is filled with the following 635information. 636\begin{itemize} 637\item 638{\tt cpus[0]} --- time spent initializing the fronts. 639\item 640{\tt cpus[1]} --- time spent loading the original entries. 641\item 642{\tt cpus[2]} --- time spent accumulating updates from descendents. 643\item 644{\tt cpus[3]} --- time spent assembling postponed data. 645\item 646{\tt cpus[4]} --- time spent to factor the fronts. 647\item 648{\tt cpus[5]} --- time spent to extract postponed data. 649\item 650{\tt cpus[6]} --- time spent to store the factor entries. 651\item 652{\tt cpus[7]} --- miscellaneous time. 653\item 654{\tt cpus[8]} --- total time in the method. 655\end{itemize} 656On return, the {\tt stats[]} vector is filled with the following 657information. 658\begin{itemize} 659\item 660{\tt stats[0]} --- number of pivots. 661\item 662{\tt stats[1]} --- number of pivot tests. 663\item 664{\tt stats[2]} --- number of delayed rows and columns. 665\item 666{\tt stats[3]} --- number of entries in $D$. 667\item 668{\tt stats[4]} --- number of entries in $L$. 669\item 670{\tt stats[5]} --- number of entries in $U$. 671\end{itemize} 672\par \noindent {\it Error checking:} 673If {\tt frontmtx}, {\tt pencil}, {\tt cpus} or {\tt stats} 674is {\tt NULL}, 675or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 676an error message is printed and the program exits. 677%----------------------------------------------------------------------- 678\end{enumerate} 679\par 680\subsection{QR factorization utility methods} 681\label{subsection:FrontMtx:proto:utilityQR} 682\par 683%======================================================================= 684\begin{enumerate} 685%----------------------------------------------------------------------- 686\item 687\begin{verbatim} 688void FrontMtx_QR_setup ( FrontMtx *frontmtx, InpMtx *mtxA, IVL **prowsIVL, 689 int **pfirstnz, int msglvl, FILE *msgFile ) ; 690\end{verbatim} 691\index{FrontMtx_QR_setup@{\tt FrontMtx\_QR\_setup()}} 692This method sets up the {\tt rowsIVL} and {\tt firstnz[]} data 693structures. 694The address of {\tt rowsIVL} is placed in {\tt *prowsIVL} 695and the address of {\tt firstnz} is placed in {\tt *pfirstnz}. 696List {\tt J} of {\tt rowsIVL} contains the rows of $A$ that will be 697assembled into front {\tt J}. 698The leading column with a nonzero entry in row {\tt j} is found in 699{\tt firstnz[j]}. 700\par \noindent {\it Error checking:} 701If {\tt frontmtx}, {\tt mtxA}, {\tt prowsIVL} or {\tt pfirstnz} 702is {\tt NULL}, 703or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 704an error message is printed and the program exits. 705%----------------------------------------------------------------------- 706\item 707\begin{verbatim} 708void FrontMtx_QR_factorVisit ( FrontMtx *frontmtx, int J, InpMtx *mtxA, 709 IVL *rowsIVL, int firstnz[], ChvList *updList, ChvManager *chvmanager, 710 char status[], int colmap[], DV *workDV, double cpus[], 711 double *pfacops, int msglvl, FILE *msgFile ) ; 712\end{verbatim} 713\index{FrontMtx_QR_factorVisit@{\tt FrontMtx\_QR\_factorVisit()}} 714This method visits front {\tt J} during the $QR$ factorization. 715The number of operations to reduce the staircase matrix to upper 716trapezoidal or triangular form is incremented in {\tt *pfacops}. 717\par \noindent {\it Error checking:} 718If {\tt frontmtx}, {\tt mtxA}, {\tt rowsIVL}, {\tt firstnz}, 719{\tt updlist}, {\tt chvmanager}, {\tt status}, {\tt colmap}, 720{\tt workDV}, {\tt cpus} or {\tt pfacops} is {\tt NULL}, 721or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 722an error message is printed and the program exits. 723%----------------------------------------------------------------------- 724\item 725\begin{verbatim} 726A2 * FrontMtx_QR_assembleFront ( FrontMtx *frontmtx, int J, InpMtx *mtxA, 727 IVL *rowsIVL, int firstnz[], int colmap[], Chv *firstchild, 728 DV *workDV, int msglvl, FILE *msgFile ) ; 729\end{verbatim} 730\index{FrontMtx_QR_assembleFront@{\tt FrontMtx\_QR\_assembleFront()}} 731This method creates an {\tt A2} object to hold the front, 732assembles any original rows of $A$ and any update 733matrices from the children into the front, 734and then returns the front. 735The rows and update matrices are assembled into staircase form, 736so no subsequent permutations of the rows is necessary. 737\par \noindent {\it Error checking:} 738If {\tt frontmtx}, {\tt mtxA}, {\tt rowsIVL}, {\tt firstnz}, 739{\tt colmap} or {\tt workDV} is {\tt NULL}, 740or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 741an error message is printed and the program exits. 742%----------------------------------------------------------------------- 743\item 744\begin{verbatim} 745void FrontMtx_QR_storeFront ( FrontMtx *frontmtx, int J, A2 *frontJ, 746 int msglvl, FILE *msgFile ) ; 747\end{verbatim} 748\index{FrontMtx_QR_storeFront@{\tt FrontMtx\_QR\_storeFront()}} 749This method takes as input {\tt frontJ}, the front in trapezoidal 750or triangular form. 751It scales the strict upper triangle or trapezoid by the diagonal 752entries, then squares the diagonal entries. 753(This transforms $R^TR$ into $(U^T + I)D(I+U)$ 754or $R^HR$ into $(U^H + I)D(I+U)$ for our solves.) 755It then stores the entries into the factor matrix. 756\par \noindent {\it Error checking:} 757If {\tt frontmtx} or {\tt frontJ} is {\tt NULL}, 758or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 759an error message is printed and the program exits. 760%----------------------------------------------------------------------- 761\item 762\begin{verbatim} 763Chv * FrontMtx_QR_storeUpdate ( FrontMtx *frontmtx, int J, A2 *frontJ, 764 ChvManager *chvmanager, int msglvl, FILE *msgFile ) ; 765\end{verbatim} 766\index{FrontMtx_QR_storeUpdate@{\tt FrontMtx\_QR\_storeUpdate()}} 767This method takes as input {\tt frontJ}, the front in trapezoidal 768or triangular form. 769It extracts the update matrix, stores the entries in a {\tt Chv} object, 770and returns the {\tt Chv} object. 771entries, then squares the diagonal entries. 772\par \noindent {\it Error checking:} 773If {\tt frontmtx}, {\tt frontJ} or {\tt chvmanager} is {\tt NULL}, 774or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 775an error message is printed and the program exits. 776%----------------------------------------------------------------------- 777\end{enumerate} 778\par 779\subsection{Serial $QR$ Factorization method} 780\label{subsection:FrontMtx:proto:factorQR} 781\par 782%======================================================================= 783\begin{enumerate} 784%----------------------------------------------------------------------- 785\item 786\begin{verbatim} 787void FrontMtx_QR_factor ( FrontMtx *frontmtx, InpMtx *mtxA, 788 ChvManager *chvmanager, double cpus[], 789 double *pfacops, int msglvl, FILE *msgFile ) ; 790\end{verbatim} 791\index{FrontMtx_QR_factor@{\tt FrontMtx\_QR\_factor()}} 792This method computes the 793$(U^T+I)D(I+U)$ factorization of $A^TA$ if $A$ is real 794or 795$(U^H+I)D(I+U)$ factorization of $A^HA$ if $A$ is complex. 796The {\tt chvmanager} object manages the working storage. 797On return, the {\tt cpus[]} vector is filled as follows. 798\begin{itemize} 799\item 800{\tt cpus[0]} -- setup time, time to compute the {\tt rowsIVL} 801and {\tt firstnz[]} objects 802\item 803{\tt cpus[1]} -- time to initialize and load the staircase matrices 804\item 805{\tt cpus[2]} -- time to factor the matrices 806\item 807{\tt cpus[3]} -- time to scale and store the factor entries 808\item 809{\tt cpus[4]} -- time to store the update entries 810\item 811{\tt cpus[5]} -- miscellaneous time 812\item 813{\tt cpus[6]} -- total time 814\end{itemize} 815On return, {\tt *pfacops} contains the number of floating point 816operations done by the factorization. 817\par \noindent {\it Error checking:} 818If {\tt frontmtx}, {\tt frontJ} or {\tt chvmanager} is {\tt NULL}, 819or if {\tt msglvl > 0} and {\tt msgFile} is {\tt NULL}, 820an error message is printed and the program exits. 821%----------------------------------------------------------------------- 822\end{enumerate} 823\par 824\subsection{Postprocessing methods} 825\label{subsection:FrontMtx:proto:postprocess} 826\par 827%======================================================================= 828\begin{enumerate} 829%----------------------------------------------------------------------- 830\item 831\begin{verbatim} 832void FrontMtx_postProcess ( FrontMtx *frontmtx, int msglvl, FILE *msgFile ) ; 833\end{verbatim} 834\index{FrontMtx_postProcess@{\tt FrontMtx\_postProcess()}} 835This method does post-processing chores after the factorization is 836complete. 837If pivoting was enabled, the method 838permutes the row and column adjacency objects, 839permutes the lower and upper matrices, 840and updates the block adjacency objects. 841The chevron submatrices $L_{\bnd{J},J}$ and $U_{J,\bnd{J}}$ 842are split into $L_{K,J}$ and $U_{J,K}$ 843where $K \cap \bnd{J} \ne \emptyset$. 844\par \noindent {\it Error checking:} 845If {\tt frontmtx} is {\tt NULL}, 846or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL}, 847an error message is printed and the program exits. 848%----------------------------------------------------------------------- 849\item 850\begin{verbatim} 851void FrontMtx_permuteUpperAdj ( FrontMtx *frontmtx, 852 int msglvl, FILE *msgFile ) ; 853void FrontMtx_permuteLowerAdj ( FrontMtx *frontmtx, 854 int msglvl, FILE *msgFile ) ; 855\end{verbatim} 856\index{FrontMtx_permuteUpperAdj@{\tt FrontMtx\_permuteUpperAdj()}} 857\index{FrontMtx_permuteLowerAdj@{\tt FrontMtx\_permuteLowerAdj()}} 858These methods are called during the postprocessing step, 859where they permute the upper and lower adjacency structures so that 860vertices in $\bnd{J}$ are in ascending order with respect to the 861indices in $K \cup \bnd{K}$, where $K$ is the parent of $J$. 862\par \noindent {\it Error checking:} 863If {\tt frontmtx} is {\tt NULL}, 864or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL}, 865an error message is printed and the program exits. 866%----------------------------------------------------------------------- 867\item 868\begin{verbatim} 869void FrontMtx_permuteUpperMatrices ( FrontMtx *frontmtx, 870 int msglvl, FILE *msgFile ) ; 871void FrontMtx_permuteLowerMatrices ( FrontMtx *frontmtx, 872 int msglvl, FILE *msgFile ) ; 873\end{verbatim} 874\index{FrontMtx_permuteUpperMatrices@{\tt FrontMtx\_permuteUpperMatrices()}} 875\index{FrontMtx_permuteLowerMatrices@{\tt FrontMtx\_permuteLowerMatrices()}} 876These methods are called during the postprocessing step, 877where they permute the upper $U_{J,\bnd{J}}$ and lower $L_{\bnd{J},J}$ 878submatrices so that 879the columns in $U_{J,\bnd{J}}$ and rows in $L_{\bnd{J},J}$ 880are in ascending order with the columns and rows of the final 881matrix. 882\par \noindent {\it Error checking:} 883If {\tt frontmtx} is {\tt NULL}, 884or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL}, 885an error message is printed and the program exits. 886%----------------------------------------------------------------------- 887\item 888\begin{verbatim} 889void FrontMtx_splitUpperMatrices ( FrontMtx *frontmtx, int msglvl, FILE *msgFile ) ; 890void FrontMtx_splitLowerMatrices ( FrontMtx *frontmtx, int msglvl, FILE *msgFile ) ; 891\end{verbatim} 892\index{FrontMtx_splitUpperMatrices@{\tt FrontMtx\_splitUpperMatrices()}} 893\index{FrontMtx_splitLowerMatrices@{\tt FrontMtx\_splitLowerMatrices()}} 894These methods are called during the postprocessing step, 895where they split the chevron submatrices $L_{\bnd{J},J}$ 896and $U_{J,\bnd{J}}$ into $L_{K,J}$ and $U_{J,K}$ 897where $K \cap \bnd{J} \ne \emptyset$. 898\par \noindent {\it Error checking:} 899If {\tt frontmtx} is {\tt NULL}, 900or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL}, 901an error message is printed and the program exits. 902%----------------------------------------------------------------------- 903\end{enumerate} 904\par 905\subsection{Utility Solve methods} 906\label{subsection:FrontMtx:proto:utility-solve} 907\par 908The following methods are called by all the solve methods 909--- serial, multithreaded and MPI. 910\par 911%======================================================================= 912\begin{enumerate} 913%----------------------------------------------------------------------- 914\item 915\begin{verbatim} 916SubMtx ** FrontMtx_loadRightHandSide ( FrontMtx *frontmtx, DenseMtx *mtxB, 917 int owners[], int myid, SubMtxManager *mtxmanager, 918 int msglvl, FILE *msgFile ) ; 919\end{verbatim} 920\index{FrontMtx_loadRightHandSide@{\tt FrontMtx\_loadRightHandSide()}} 921This method creates and returns a vector of pointers to {\tt 922SubMtx} objects that hold pointers to the right hand side 923submatrices owned by the thread or processor. 924\par \noindent {\it Error checking:} 925None presently. 926%----------------------------------------------------------------------- 927\item 928\begin{verbatim} 929void FrontMtx_forwardVisit ( FrontMtx *frontmtx, int J, int nrhs, 930 int *owners, int myid, SubMtxManager *mtxmanager, SubMtxList *aggList, 931 SubMtx *p_mtx[], char frontIsDone[], IP *heads[], SubMtx *p_agg[], 932 char status[], int msglvl, FILE *msgFile) ; 933\end{verbatim} 934\index{FrontMtx_forwardVisit@{\tt FrontMtx\_forwardVisit()}} 935This method is used to visit front {\tt J} during the forward solve, 936$(U^T + I)Y = B$, $(U^H + I)Y = B$ or $(L + I)Y = B$. 937\par \noindent {\it Error checking:} 938None presently. 939%----------------------------------------------------------------------- 940\item 941\begin{verbatim} 942void FrontMtx_diagonalVisit ( FrontMtx *frontmtx, int J, int owners[], 943 int myid, SubMtx *p_mtx[], char frontIsDone[], SubMtx *p_agg[], 944 int msglvl, FILE *msgFile ) ; 945\end{verbatim} 946\index{FrontMtx_diagonalVisit@{\tt FrontMtx\_diagonalVisit()}} 947This method is used to visit front {\tt J} during the diagonal solve, 948$DZ = Y$. 949\par \noindent {\it Error checking:} 950None presently. 951%----------------------------------------------------------------------- 952\item 953\begin{verbatim} 954void FrontMtx_backwardVisit ( FrontMtx *frontmtx, int J, int nrhs, 955 int *owners, int myid, SubMtxManager *mtxmanager, SubMtxList *aggList, 956 SubMtx *p_mtx[], char frontIsDone[], IP *heads[], SubMtx *p_agg[], 957 char status[], int msglvl, FILE *msgFile ) ; 958\end{verbatim} 959\index{FrontMtx_backwardVisit@{\tt FrontMtx\_backwardVisit()}} 960This method is used to visit front {\tt J} during the backward solve, 961$(U + I)Y = B$. 962\par \noindent {\it Error checking:} 963None presently. 964%----------------------------------------------------------------------- 965\item 966\begin{verbatim} 967void FrontMtx_storeSolution ( FrontMtx *frontmtx, int owners[], int myid, 968 SubMtxManager *mtxmanager, SubMtx *p_mtx[], 969 DenseMtx *mtxX, int msglvl, FILE *msgFile ) ; 970\end{verbatim} 971\index{FrontMtx_storeSolution@{\tt FrontMtx\_storeSolution()}} 972This method stores the solution in the {\tt solmtx} dense matrix object. 973\par \noindent {\it Error checking:} 974None presently. 975%----------------------------------------------------------------------- 976\item 977\begin{verbatim} 978IP ** FrontMtx_forwardSetup ( FrontMtx *frontmtx, int msglvl, FILE *msgFile ) ; 979\end{verbatim} 980\index{FrontMtx_forwardSetup@{\tt FrontMtx\_forwardSetup()}} 981This method is used to set up a data structure of {\tt IP} objects 982that hold the updates of the form 983$Y_J := Y_J - U_{I,J}^T X_I$, 984$Y_J := Y_J - U_{I,J}^H X_I$ or 985$Y_J := Y_J - L_{J,I} X_I$ 986that will be performed by this thread or processor. 987\par \noindent {\it Error checking:} 988None presently. 989%----------------------------------------------------------------------- 990\item 991\begin{verbatim} 992IP ** FrontMtx_backwardSetup ( FrontMtx *frontmtx, int msglvl, FILE *msgFile ) ; 993\end{verbatim} 994\index{FrontMtx_backwardSetup@{\tt FrontMtx\_backwardSetup()}} 995This method is used to set up a data structure of {\tt IP} objects 996that hold the updates of the form 997$Z_J := Z_J - U_{J,K} X_K$ 998that will be performed by this thread or processor. 999\par \noindent {\it Error checking:} 1000None presently. 1001%----------------------------------------------------------------------- 1002\item 1003\begin{verbatim} 1004void FrontMtx_loadActiveRoots ( FrontMtx *frontmtx, char status[], 1005 char activeFlag, Ideq *dequeue ) ; 1006\end{verbatim} 1007\index{FrontMtx_loadActiveRoots@{\tt FrontMtx\_loadActiveRoots()}} 1008This method loads the active roots for a thread or a processor into 1009the dequeue for the backward solve. 1010\par \noindent {\it Error checking:} 1011None presently. 1012%----------------------------------------------------------------------- 1013\end{enumerate} 1014\par 1015\subsection{Serial Solve method} 1016\label{subsection:FrontMtx:proto:solve-serial} 1017\par 1018\begin{enumerate} 1019%======================================================================= 1020\item 1021\begin{verbatim} 1022void FrontMtx_solve ( FrontMtx *frontmtx, DenseMtx *mtxX, DenseMtx *mtxB, 1023 SubMtxManager *mtxmanager, double cpus[], int msglvl, FILE *msgFile ) ; 1024\end{verbatim} 1025\index{FrontMtx_solve@{\tt FrontMtx\_solve()}} 1026This method is used to solve one of three linear systems of equations 1027--- 1028$(U^T + I)D(I + U) X = B$, 1029$(U^H + I)D(I + U) X = B$ or 1030$(L + I)D(I + U) X = B$. 1031Entries of $B$ are {\it read} from {\tt mtxB} and 1032entries of $X$ are written to {\tt mtxX}. 1033Therefore, {\tt mtxX} and {\tt mtxB} can be the same object. 1034(Note, this does not hold true for an MPI factorization with pivoting.) 1035The {\tt mtxmanager} object manages the working storage using the solve. 1036On return the {\tt cpus[]} vector is filled with the following. 1037\begin{itemize} 1038\item 1039{\tt cpus[0]} --- set up the solves 1040\item 1041{\tt cpus[1]} --- fetch right hand side and store solution 1042\item 1043{\tt cpus[2]} --- forward solve 1044\item 1045{\tt cpus[3]} --- diagonal solve 1046\item 1047{\tt cpus[4]} --- backward solve 1048\item 1049{\tt cpus[5]} --- total time in the method. 1050\end{itemize} 1051\par \noindent {\it Error checking:} 1052If {\tt frontmtx}, {\tt mtxB} or {\tt cpus} 1053is {\tt NULL}, 1054or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL}, 1055an error message is printed and the program exits. 1056%======================================================================= 1057\end{enumerate} 1058\par 1059\subsection{Serial $QR$ Solve method} 1060\label{subsection:FrontMtx:proto:QRsolve-serial} 1061\par 1062\begin{enumerate} 1063%======================================================================= 1064\item 1065\begin{verbatim} 1066void FrontMtx_QR_solve ( FrontMtx *frontmtx, InpMtx *mtxA, DenseMtx *mtxX, 1067 DenseMtx *mtxB, SubMtxManager *mtxmanager, 1068 double cpus[], int msglvl, FILE *msgFile ) ; 1069\end{verbatim} 1070\index{FrontMtx_QR_solve@{\tt FrontMtx\_QR\_solve()}} 1071This method is used to minimize $\|B - AX\|_F$, where 1072$A$ is stored in {\tt mtxA}, 1073$B$ is stored in {\tt mtxB}, 1074and $X$ will be stored in {\tt mtxX}. 1075The {\tt frontmtx} object contains a 1076$(U^T+I)D(I+U)$ factorization of $A^TA$ if $A$ is real 1077or 1078$(U^H+I)D(I+U)$ factorization of $A^HA$ if $A$ is complex. 1079We solve the seminormal equations 1080$(U^T+I)D(I+U)X = A^TB$ or $(U^H+I)D(I+U)X = A^HB$ 1081for $X$. 1082The {\tt mtxmanager} object manages the working storage 1083used in the solves. 1084On return the {\tt cpus[]} vector is filled with the following. 1085\begin{itemize} 1086\item 1087{\tt cpus[0]} --- set up the solves 1088\item 1089{\tt cpus[1]} --- fetch right hand side and store solution 1090\item 1091{\tt cpus[2]} --- forward solve 1092\item 1093{\tt cpus[3]} --- diagonal solve 1094\item 1095{\tt cpus[4]} --- backward solve 1096\item 1097{\tt cpus[5]} --- total time in the solve method. 1098\item 1099{\tt cpus[6]} --- time to compute $A^TB$ or $A^HB$. 1100\item 1101{\tt cpus[7]} --- total time. 1102\end{itemize} 1103\par \noindent {\it Error checking:} 1104If {\tt frontmtx}, {\tt mtxA}, {\tt mtxX}, {\tt mtxB} or {\tt cpus} 1105is {\tt NULL}, 1106or if {\tt msglvl} > 0 and {\tt msgFile} is {\tt NULL}, 1107an error message is printed and the program exits. 1108%======================================================================= 1109\end{enumerate} 1110\par 1111\subsection{Utility methods} 1112\label{subsection:FrontMtx:proto:utility} 1113\par 1114%======================================================================= 1115\begin{enumerate} 1116%----------------------------------------------------------------------- 1117\item 1118\begin{verbatim} 1119IV * FrontMtx_colmapIV ( FrontMtx *frontmtx ) ; 1120IV * FrontMtx_rowmapIV ( FrontMtx *frontmtx ) ; 1121\end{verbatim} 1122\index{FrontMtx_colmapIV@{\tt FrontMtx\_colmapIV()}} 1123\index{FrontMtx_rowmapIV@{\tt FrontMtx\_rowmapIV()}} 1124These methods construct and return an {\tt IV} object that map the 1125rows and columns to the fronts that contains them. 1126\par \noindent {\it Error checking:} 1127None presently. 1128%----------------------------------------------------------------------- 1129\item 1130\begin{verbatim} 1131IV * FrontMtx_ownedRowsIV ( FrontMtx *frontmtx, int myid, IV *ownersIV, 1132 int msglvl, FILE *msgFile ) ; 1133IV * FrontMtx_ownedColumnsIV ( FrontMtx *frontmtx, int myid, IV *ownersIV, 1134 int msglvl, FILE *msgFile ) ; 1135\end{verbatim} 1136\index{FrontMtx_ownedColumns@{\tt FrontMtx\_ownedColumns()}} 1137\index{FrontMtx_ownedRows@{\tt FrontMtx\_ownedRows()}} 1138These methods construct and return {\tt IV} objects that 1139contain the ids of the rows and columns that belong to fronts that 1140are owned by processor {\tt myid}. 1141If {\tt ownersIV} is {\tt NULL}, an {\tt IV} object is returned 1142that contains {\tt \{0,1,2,3, ..., nfront-1\}}. 1143\par \noindent {\it Error checking:} 1144If {\tt frontmtx} is {\tt NULL}, 1145an error message is printed and the program exits. 1146%----------------------------------------------------------------------- 1147\item 1148\begin{verbatim} 1149IVL * FrontMtx_makeUpperBlockIVL ( FrontMtx *frontmtx, IV *colmapIV ) ; 1150IVL * FrontMtx_makeLowerBlockIVL ( FrontMtx *frontmtx, IV *rowmapIV ) ; 1151\end{verbatim} 1152\index{FrontMtx_makeUpperBlockIVL@{\tt FrontMtx\_makeUpperBlockIVL()}} 1153\index{FrontMtx_makeLowerBlockIVL@{\tt FrontMtx\_makeLowerBlockIVL()}} 1154These methods construct and return {\tt IVL} objects that 1155contain the submatrix structure of the lower and upper factors. 1156The {\tt IV} objects map the rows and columns of the matrix to the 1157fronts in the factor matrix that contain them. 1158\par \noindent {\it Error checking:} 1159If {\tt frontmtx}, {\tt colmapIV} or {\tt rowmapIV} are {\tt NULL}, 1160an error message is printed and the program exits. 1161%----------------------------------------------------------------------- 1162\item 1163\begin{verbatim} 1164void FrontMtx_inertia ( FrontMtx *frontmtx, int *pnneg, int *pnzero, int *pnpos ) ; 1165\end{verbatim} 1166\index{FrontMtx_inertia@{\tt FrontMtx\_inertia()}} 1167This method determines the inertia of a symmetric matrix 1168based on the $(U^T + I)D(I + U)$ factorization. 1169The number of negative eigenvalues is returned in {\tt *pnneg}, 1170the number of zero eigenvalues is returned in {\tt *pnzero}, 1171and the number of positive eigenvalues is returned in {\tt *pnpos}. 1172\par \noindent {\it Error checking:} 1173If {\tt frontmtx}, {\tt pnneg}, {\tt pnzero} 1174or {\tt pnpos} is {\tt NULL}, 1175or if ${\tt symmetryflag} \ne 0$ 1176an error message is printed and the program exits. 1177%----------------------------------------------------------------------- 1178\item 1179\begin{verbatim} 1180int FrontMtx_nSolveOps ( FrontMtx *frontmtx ) ; 1181\end{verbatim} 1182\index{FrontMtx_nSolveOps@{\tt FrontMtx\_nSolveOps()}} 1183This method computes and return the number of floating point 1184operations for a solve with a single right hand side. 1185\par \noindent {\it Error checking:} 1186If {\tt frontmtx} is {\tt NULL}, 1187or if {\tt type} or {\tt symmetryflag} are invalid, 1188an error message is printed and the program exits. 1189%----------------------------------------------------------------------- 1190\end{enumerate} 1191\par 1192\subsection{IO methods} 1193\label{subsection:FrontMtx:proto:IO} 1194\par 1195%======================================================================= 1196\begin{enumerate} 1197%----------------------------------------------------------------------- 1198\item 1199\begin{verbatim} 1200int FrontMtx_readFromFile ( FrontMtx *frontmtx, char *fn ) ; 1201\end{verbatim} 1202\index{FrontMtx_readFromFile@{\tt FrontMtx\_readFromFile()}} 1203\par 1204This method reads a {\tt FrontMtx object} from a file. 1205It tries to open the file and if it is successful, 1206it then calls {\tt FrontMtx\_readFromFormattedFile()} or 1207{\tt FrontMtx\_readFromBinaryFile()}, 1208closes the file 1209and returns the value returned from the called routine. 1210\par \noindent {\it Error checking:} 1211If {\tt frontmtx} or {\tt fn} are {\tt NULL}, 1212or if {\tt fn} is not of the form 1213{\tt *.frontmtxf} (for a formatted file) 1214or {\tt *.frontmtxb} (for a binary file), 1215an error message is printed and the method returns zero. 1216%----------------------------------------------------------------------- 1217\item 1218\begin{verbatim} 1219int FrontMtx_readFromFormattedFile ( FrontMtx *frontmtx, FILE *fp ) ; 1220\end{verbatim} 1221\index{FrontMtx_readFromFormattedFile@{\tt FrontMtx\_readFromFormattedFile()}} 1222\par 1223This method reads a {\tt FrontMtx} object from a formatted file. 1224If there are no errors in reading the data, 1225the value {\tt 1} is returned. 1226If an IO error is encountered from {\tt fscanf}, zero is returned. 1227\par \noindent {\it Error checking:} 1228If {\tt frontmtx} or {\tt fp} are {\tt NULL} 1229an error message is printed and zero is returned. 1230%----------------------------------------------------------------------- 1231\item 1232\begin{verbatim} 1233int FrontMtx_readFromBinaryFile ( FrontMtx *frontmtx, FILE *fp ) ; 1234\end{verbatim} 1235\index{FrontMtx_readFromBinaryFile@{\tt FrontMtx\_readFromBinaryFile()}} 1236This method reads a {\tt FrontMtx} object from a binary file. 1237If there are no errors in reading the data, 1238the value {\tt 1} is returned. 1239If an IO error is encountered from {\tt fread}, zero is returned. 1240\par \noindent {\it Error checking:} 1241If {\tt frontmtx} or {\tt fp} are {\tt NULL} an error message 1242is printed and zero is returned. 1243%----------------------------------------------------------------------- 1244\item 1245\begin{verbatim} 1246int FrontMtx_writeToFile ( FrontMtx *frontmtx, char *fn ) ; 1247\end{verbatim} 1248\index{FrontMtx_writeToFile@{\tt FrontMtx\_writeToFile()}} 1249\par 1250This method writes a {\tt FrontMtx object} to a file. 1251It tries to open the file and if it is successful, 1252it then calls {\tt FrontMtx\_writeFromFormattedFile()} or 1253{\tt FrontMtx\_writeFromBinaryFile()}, 1254closes the file 1255and returns the value returned from the called routine. 1256\par \noindent {\it Error checking:} 1257If {\tt frontmtx} or {\tt fn} are {\tt NULL}, 1258or if {\tt fn} is not of the form 1259{\tt *.frontmtxf} (for a formatted file) 1260or {\tt *.frontmtxb} (for a binary file), 1261an error message is printed and the method returns zero. 1262%----------------------------------------------------------------------- 1263\item 1264\begin{verbatim} 1265int FrontMtx_writeToFormattedFile ( FrontMtx *frontmtx, FILE *fp ) ; 1266\end{verbatim} 1267\index{FrontMtx_writeToFormattedFile@{\tt FrontMtx\_writeToFormattedFile()}} 1268\par 1269This method writes a {\tt FrontMtx} object to a formatted file. 1270If there are no errors in writing the data, 1271the value {\tt 1} is returned. 1272If an IO error is encountered from {\tt fprintf}, zero is returned. 1273\par \noindent {\it Error checking:} 1274If {\tt frontmtx} or {\tt fp} are {\tt NULL} an error message 1275is printed and zero is returned. 1276%----------------------------------------------------------------------- 1277\item 1278\begin{verbatim} 1279int FrontMtx_writeToBinaryFile ( FrontMtx *frontmtx, FILE *fp ) ; 1280\end{verbatim} 1281\index{FrontMtx_writeToBinaryFile@{\tt FrontMtx\_writeToBinaryFile()}} 1282\par 1283This method writes a {\tt FrontMtx} object to a binary file. 1284If there are no errors in writing the data, 1285the value {\tt 1} is returned. 1286If an IO error is encountered from {\tt fwrite}, zero is returned. 1287\par \noindent {\it Error checking:} 1288If {\tt frontmtx} or {\tt fp} are {\tt NULL} an error message 1289is printed and zero is returned. 1290%----------------------------------------------------------------------- 1291\item 1292\begin{verbatim} 1293int FrontMtx_writeForHumanEye ( FrontMtx *frontmtx, FILE *fp ) ; 1294\end{verbatim} 1295\index{FrontMtx_writeForHumanEye@{\tt FrontMtx\_writeForHumanEye()}} 1296\par 1297This method writes a {\tt FrontMtx} object to a file in a human 1298readable format. 1299The method {\tt FrontMtx\_writeStats()} is called to write out the 1300header and statistics. 1301The value {\tt 1} is returned. 1302\par \noindent {\it Error checking:} 1303If {\tt frontmtx} or {\tt fp} are {\tt NULL} an error message 1304is printed and zero is returned. 1305%----------------------------------------------------------------------- 1306\item 1307\begin{verbatim} 1308int FrontMtx_writeStats ( FrontMtx *frontmtx, FILE *fp ) ; 1309\end{verbatim} 1310\index{FrontMtx_writeStats@{\tt FrontMtx\_writeStats()}} 1311\par 1312The header and statistics are written to a file. 1313The value {\tt 1} is returned. 1314\par \noindent {\it Error checking:} 1315If {\tt frontmtx} or {\tt fp} are {\tt NULL} an error message 1316is printed and zero is returned. 1317%----------------------------------------------------------------------- 1318\item 1319\begin{verbatim} 1320int FrontMtx_writeForMatlab ( FrontMtx *frontmtx, char *Lname, char *Dname, 1321 char *Uname, FILE *fp ) ; 1322\end{verbatim} 1323\index{FrontMtx_writeForMatlab@{\tt FrontMtx\_writeForMatlab()}} 1324\par 1325This method writes out the factor matrix entries in a 1326Matlab-readable form. 1327{\tt Lname} is a string for the lower triangular matrix, 1328{\tt Dname} is a string for the diagonal matrix, 1329and {\tt Uname} is a string for the upper triangular matrix. 1330\par \noindent {\it Error checking:} 1331If {\tt frontmtx}, {\tt Lname}, {\tt Dname}, {\tt Uname} 1332or {\tt fp} are {\tt NULL}, 1333 an error message is printed and zero is returned. 1334%----------------------------------------------------------------------- 1335\end{enumerate} 1336\par 1337