1 /*  SubMtx.h  */
2 
3 #include "../cfiles.h"
4 #include "../A2.h"
5 #include "../ZV.h"
6 #include "../DV.h"
7 #include "../SPOOLES.h"
8 
9 /*--------------------------------------------------------------------*/
10 /*
11    ---------------------------------------------------------------
12    structure to hold a block of a block matrix.
13    e.g., the block partition would be by supernodes.
14 
15    type -- type of matrix
16       1 -- real
17       2 -- complex
18    mode -- storage mode of matrix
19       0 -- dense stored by rows
20       1 -- dense stored by columns
21       2 -- sparse stored by rows
22       3 -- sparse stored by columns
23       4 -- sparse stored by triples
24       5 -- sparse stored by dense subrows
25       6 -- sparse stored by dense subcolumns
26       7 -- diagonal
27       8 -- block diagonal symmetric
28            (upper part of each block stored by rows)
29       9 -- block diagonal hermitian (complex only)
30            (upper part of each block stored by rows)
31    rowid    -- block row to which this matrix belongs
32    colid    -- block column to which this matrix belongs
33    nrow     -- number of rows
34    ncol     -- number of columns
35    nent     -- number of entries
36    entries  -- pointer to the entries
37    wrkDV    -- DV object that manages workspace
38    next     -- pointer to next SubMtx object in a singly linked list
39 
40    created -- 98jan29, cca
41    -----------------------------------------------------------------
42 */
43 typedef struct _SubMtx   SubMtx ;
44 struct _SubMtx {
45    int      type     ;
46    int      mode     ;
47    int      rowid    ;
48    int      colid    ;
49    int      nrow     ;
50    int      ncol     ;
51    int      nent     ;
52    double   *entries ;
53    DV       wrkDV    ;
54    SubMtx   *next    ;
55 } ;
56 /*
57    ------------------------
58    real/complex type macros
59    ------------------------
60 */
61 #define SUBMTX_IS_REAL(chv)    ((chv)->type == SPOOLES_REAL)
62 #define SUBMTX_IS_COMPLEX(chv) ((chv)->type == SPOOLES_COMPLEX)
63 /*
64    -------------------
65    storage mode macros
66    -------------------
67 */
68 #define SUBMTX_DENSE_ROWS           0
69 #define SUBMTX_DENSE_COLUMNS        1
70 #define SUBMTX_SPARSE_ROWS          2
71 #define SUBMTX_SPARSE_COLUMNS       3
72 #define SUBMTX_SPARSE_TRIPLES       4
73 #define SUBMTX_DENSE_SUBROWS        5
74 #define SUBMTX_DENSE_SUBCOLUMNS     6
75 #define SUBMTX_DIAGONAL             7
76 #define SUBMTX_BLOCK_DIAGONAL_SYM   8
77 #define SUBMTX_BLOCK_DIAGONAL_HERM  9
78 
79 #define SUBMTX_IS_DENSE_ROWS(chv) \
80    ((chv)->mode == SUBMTX_DENSE_ROWS)
81 #define SUBMTX_IS_DENSE_COLUMNS(chv) \
82    ((chv)->mode == SUBMTX_DENSE_COLUMNS)
83 #define SUBMTX_IS_SPARSE_ROWS(chv) \
84    ((chv)->mode == SUBMTX_SPARSE_ROWS)
85 #define SUBMTX_IS_SPARSE_COLUMNS(chv) \
86    ((chv)->mode == SUBMTX_SPARSE_COLUMNS)
87 #define SUBMTX_IS_SPARSE_TRIPLES(chv) \
88    ((chv)->mode == SUBMTX_SPARSE_TRIPLES)
89 #define SUBMTX_IS_DENSE_SUBROWS(chv) \
90    ((chv)->mode == SUBMTX_DENSE_SUBROWS)
91 #define SUBMTX_IS_DENSE_SUBCOLUMNS(chv) \
92    ((chv)->mode == SUBMTX_DENSE_SUBCOLUMNS)
93 #define SUBMTX_IS_DIAGONAL(chv) \
94    ((chv)->mode == SUBMTX_DIAGONAL)
95 #define SUBMTX_IS_BLOCK_DIAGONAL_SYM(chv) \
96    ((chv)->mode == SUBMTX_BLOCK_DIAGONAL_SYM)
97 #define SUBMTX_IS_BLOCK_DIAGONAL_HERM(chv) \
98    ((chv)->mode == SUBMTX_BLOCK_DIAGONAL_HERM)
99 /*--------------------------------------------------------------------*/
100 /*
101 ------------------------------------------------------------------------
102 ----- methods found in basics.c ----------------------------------------
103 ------------------------------------------------------------------------
104 */
105 /*
106    -----------------------
107    simplest constructor
108 
109    created -- 98may01, cca
110    -----------------------
111 */
112 SubMtx *
113 SubMtx_new (
114    void
115 ) ;
116 /*
117    -----------------------
118    set the default fields
119 
120    created -- 98may01, cca
121    -----------------------
122 */
123 void
124 SubMtx_setDefaultFields (
125    SubMtx   *mtx
126 ) ;
127 /*
128    --------------------------------------------------
129    clear the data fields, releasing allocated storage
130 
131    created -- 98may01, cca
132    --------------------------------------------------
133 */
134 void
135 SubMtx_clearData (
136    SubMtx   *mtx
137 ) ;
138 /*
139    ------------------------------------------
140    destructor, free's the object and its data
141 
142    created -- 98may01, cca
143    ------------------------------------------
144 */
145 void
146 SubMtx_free (
147    SubMtx   *mtx
148 ) ;
149 /*--------------------------------------------------------------------*/
150 /*
151 ------------------------------------------------------------------------
152 ----- methods found in instance.c --------------------------------------
153 ------------------------------------------------------------------------
154 */
155 /*
156    ------------------------------------------
157    purpose -- fill *prowid with the row id
158               and  *pcolid with the column id
159 
160    created -- 98may01, cca
161    ------------------------------------------
162 */
163 void
164 SubMtx_ids (
165    SubMtx   *mtx,
166    int      *prowid,
167    int      *pcolid
168 ) ;
169 /*
170    -------------------------------------
171    purpose -- set the row and column ids
172 
173    created -- 98may01, cca
174    -------------------------------------
175 */
176 void
177 SubMtx_setIds (
178    SubMtx   *mtx,
179    int      rowid,
180    int      colid
181 ) ;
182 /*
183    ---------------------------------------------------
184    purpose -- fill *pnrow with the # of rows
185               and  *pncol with the # of columns
186               and  *pnent with the # of matrix entries
187 
188    created -- 98may01, cca
189    ---------------------------------------------------
190 */
191 void
192 SubMtx_dimensions (
193    SubMtx   *mtx,
194    int      *pnrow,
195    int      *pncol,
196    int      *pnent
197 ) ;
198 /*
199    ------------------------------------------------------------
200    purpose --
201      fill *pnrow with the number of rows
202      if prowind != NULL then
203         fill *prowind with the base location of the row indices
204      endif
205 
206    created -- 98may01, cca
207    ------------------------------------------------------------
208 */
209 void
210 SubMtx_rowIndices (
211    SubMtx   *mtx,
212    int      *pnrow,
213    int      **prowind
214 ) ;
215 /*
216    ---------------------------------------------------------------
217    purpose --
218      fill *pncol with the number of column
219      if pcolind != NULL then
220         fill *prowind with the base location of the column indices
221      endif
222 
223    created -- 98may01, cca
224    ---------------------------------------------------------------
225 */
226 void
227 SubMtx_columnIndices (
228    SubMtx   *mtx,
229    int      *pncol,
230    int      **pcolind
231 ) ;
232 /*
233    ---------------------------------
234    purpose -- for dense storage
235      *pnrow    with mtx->nrow
236      *pncol    with mtx->ncol
237      *pinc1    with row increment
238      *pinc2    with column increment
239      *pentries with mtx->entries
240 
241    created -- 98may01, cca
242    ---------------------------------
243 */
244 void
245 SubMtx_denseInfo (
246    SubMtx     *mtx,
247    int        *pnrow,
248    int        *pncol,
249    int        *pinc1,
250    int        *pinc2,
251    double     **pentries
252 ) ;
253 /*
254    ---------------------------------------------
255    purpose -- for sparse rows, fill
256      *pnrow    with # of rows
257      *pnent    with # of indices
258      *psizes   with sizes[] of rows
259      *pindices with indices[] for column indices
260      *pentries with entries[] for matrix entries
261 
262    created -- 98may01, cca
263    ---------------------------------------------
264 */
265 void
266 SubMtx_sparseRowsInfo (
267    SubMtx     *mtx,
268    int        *pnrow,
269    int        *pnent,
270    int        **psizes,
271    int        **pindices,
272    double     **pentries
273 ) ;
274 /*
275    ----------------------------------------------
276    purpose -- for sparse columns, fill
277      *pncol    with # of columns
278      *pnent    with # of matrix entries
279      *psizes   with sizes[ncol], column sizes
280      *pindices with indices[nent], matrix row ids
281      *pentries with entries[nent], matrix entries
282 
283    created -- 98may01, cca
284    ----------------------------------------------
285 */
286 void
287 SubMtx_sparseColumnsInfo (
288    SubMtx     *mtx,
289    int        *pncol,
290    int        *pnent,
291    int        **psizes,
292    int        **pindices,
293    double     **pentries
294 ) ;
295 /*
296    ----------------------------------------------------
297    purpose -- for sparse triples, fill
298      *pnent    with # of matrix entries
299      *prowids  with rowids[nent], row ids of entries
300      *prowids  with colids[nent], column ids of entries
301      *pentries with entries[nent], matrix entries
302 
303    created -- 98may01, cca
304    ----------------------------------------------------
305 */
306 void
307 SubMtx_sparseTriplesInfo (
308    SubMtx     *mtx,
309    int        *pnent,
310    int        **prowids,
311    int        **pcolids,
312    double     **pentries
313 ) ;
314 /*
315    -----------------------------------------------------------
316    purpose -- for dense subrows, fill
317      *pnrow      with # of rows
318      *pnent      with # of matrix entries
319      *pfirstlocs with firstlocs[nrow], column of first nonzero
320      *psizes     with sizes[nrow], number of nonzero columns
321      *pentries   with entries[nent], matrix entries
322 
323    created -- 98may01, cca
324    -----------------------------------------------------------
325 */
326 void
327 SubMtx_denseSubrowsInfo (
328    SubMtx     *mtx,
329    int        *pnrow,
330    int        *pnent,
331    int        **pfirstlocs,
332    int        **psizes,
333    double     **pentries
334 ) ;
335 /*
336    -----------------------------------------------------------
337    purpose -- for dense subcolumns, fill
338      *pncol      with # of columns
339      *pnent      with # of matrix entries
340      *pfirstlocs with firstlocs[ncol], row of first nonzero
341      *psizes     with sizes[ncol], number of nonzero rows
342      *pentries   with entries[nent], matrix entries
343 
344    created -- 98may01, cca
345    -----------------------------------------------------------
346 */
347 void
348 SubMtx_denseSubcolumnsInfo (
349    SubMtx   *mtx,
350    int      *pncol,
351    int      *pnent,
352    int      **pfirstlocs,
353    int      **psizes,
354    double   **pentries
355 ) ;
356 /*
357    ------------------------------------------------
358    purpose -- for a diagonal matrix, fill
359      *pncol      with # of columns
360      *pentries   with entries[nent], matrix entries
361 
362    created -- 98may01, cca
363    ------------------------------------------------
364 */
365 void
366 SubMtx_diagonalInfo (
367    SubMtx   *mtx,
368    int      *pncol,
369    double   **pentries
370 ) ;
371 /*
372    ------------------------------------------------------
373    purpose -- for a block diagonal symmetric matrix, fill
374      *pncol        with # of columns
375      *pnent        with # of entries
376      *ppivotsizes  with pivotsizes[ncol]
377      *pentries     with entries[nent], matrix entries
378 
379    created -- 98may01, cca
380    ------------------------------------------------------
381 */
382 void
383 SubMtx_blockDiagonalInfo (
384    SubMtx   *mtx,
385    int      *pncol,
386    int      *pnent,
387    int      **ppivotsizes,
388    double   **pentries
389 ) ;
390 /*
391    -------------------------------------------------------
392    purpose -- to find matrix entry (irow,jcol) if present.
393 
394    return value --
395      if entry (irow,jcol) is not present then
396         *pValue is 0.0
397         return value is -1
398      else entry (irow,jcol) is present then
399         *pValue is the matrix entry
400         return value is offset into entries array
401      endif
402 
403    created -- 98may01, cca
404    -------------------------------------------------------
405 */
406 int
407 SubMtx_realEntry (
408    SubMtx   *mtx,
409    int      irow,
410    int      jcol,
411    double   *pValue
412 ) ;
413 /*
414    -------------------------------------------------------
415    purpose -- to find matrix entry (irow,jcol) if present.
416 
417    return value --
418      if entry (irow,jcol) is not present then
419         *pReal and *pImag are 0.0
420         return value is -1
421      else entry (irow,jcol) is present then
422         (*pReal,*pImag) is the matrix entry
423         return value is offset into entries array
424      endif
425 
426    created -- 98may01, cca
427    -------------------------------------------------------
428 */
429 int
430 SubMtx_complexEntry (
431    SubMtx   *mtx,
432    int      irow,
433    int      jcol,
434    double   *pReal,
435    double   *pImag
436 ) ;
437 /*
438    -------------------------------------------------
439    purpose -- to return a pointer to the location of
440                matrix entry (irow,jcol) if present.
441 
442    if entry (irow,jcol) is not present then
443       *ppValue is NULL
444    else entry (irow,jcol) is present then
445       *ppValue is the location of the matrix entry
446    endif
447 
448    created -- 98may01, cca
449    -------------------------------------------------
450 */
451 void
452 SubMtx_locationOfRealEntry (
453    SubMtx   *mtx,
454    int      irow,
455    int      jcol,
456    double   **ppValue
457 ) ;
458 /*
459    --------------------------------------------------------
460    purpose -- to return a pointer to the location of
461                matrix entry (irow,jcol) if present.
462 
463    if entry (irow,jcol) is not present then
464       (*ppReal,*ppImag) is (NULL,NULL)
465    else entry (irow,jcol) is present then
466       (*ppReal,*ppImag) is the location of the matrix entry
467    endif
468 
469    created -- 98may01, cca
470    --------------------------------------------------------
471 */
472 void
473 SubMtx_locationOfComplexEntry (
474    SubMtx   *mtx,
475    int      irow,
476    int      jcol,
477    double   **ppReal,
478    double   **ppImag
479 ) ;
480 /*--------------------------------------------------------------------*/
481 /*
482 ------------------------------------------------------------------------
483 ----- methods found in init.c ------------------------------------------
484 ------------------------------------------------------------------------
485 */
486 /*
487    ------------------------------------------------------------
488    return the number of bytes needed for an object of this size
489 
490    created -- 98may01, cca
491    ------------------------------------------------------------
492 */
493 int
494 SubMtx_nbytesNeeded (
495    int   type,
496    int   mode,
497    int   nrow,
498    int   ncol,
499    int   nent
500 ) ;
501 /*
502    ------------------------------------
503    return the number of bytes in use in
504    the workspace owned by this object
505 
506    created -- 98may01, cca
507    ------------------------------------
508 */
509 int
510 SubMtx_nbytesInUse (
511    SubMtx   *mtx
512 ) ;
513 /*
514    ------------------------------------------------------
515    return a pointer to the workspace owned by this object
516 
517    created -- 98may01, cca
518    ------------------------------------------------------
519 */
520 void *
521 SubMtx_workspace (
522    SubMtx   *mtx
523 ) ;
524 /*
525    ----------------------------------------------------------------
526   return the number of bytes in the workspace owned by this object
527 
528    created -- 98may01, cca
529    ----------------------------------------------------------------
530 */
531 int
532 SubMtx_nbytesInWorkspace (
533    SubMtx   *mtx
534 ) ;
535 /*
536    -------------------------------------------------------------
537    set the number of bytes in the workspace owned by this object
538 
539    created -- 98may01, cca
540    -------------------------------------------------------------
541 */
542 void
543 SubMtx_setNbytesInWorkspace (
544    SubMtx   *mtx,
545    int      nbytes
546 ) ;
547 /*
548    ---------------------------------------
549    purpose -- set the fields of the object
550 
551    created -- 98may01, cca
552    ---------------------------------------
553 */
554 void
555 SubMtx_setFields (
556    SubMtx   *mtx,
557    int      type,
558    int      mode,
559    int      rowid,
560    int      colid,
561    int      nrow,
562    int      ncol,
563    int      nent
564 ) ;
565 /*
566    ----------------------------
567    purpose -- basic initializer
568 
569    created -- 98may01, cca
570    ----------------------------
571 */
572 void
573 SubMtx_init (
574    SubMtx   *mtx,
575    int      type,
576    int      mode,
577    int      rowid,
578    int      colid,
579    int      nrow,
580    int      ncol,
581    int      nent
582 ) ;
583 /*
584    ---------------------------------------------------------
585    purpose -- initialize the object from its working storage
586               used when the object is a MPI message
587 
588    created -- 98may01, cca
589    ---------------------------------------------------------
590 */
591 void
592 SubMtx_initFromBuffer (
593    SubMtx   *mtx
594 ) ;
595 /*--------------------------------------------------------------------*/
596 /*
597 ------------------------------------------------------------------------
598 ----- methods found in initRandom.c ------------------------------------
599 ------------------------------------------------------------------------
600 */
601 /*
602    ------------------------------------------------
603    purpose -- to initialize a matrix object with
604       random entries and possibly random structure.
605 
606    created -- 98feb16, cca
607    ------------------------------------------------
608 */
609 void
610 SubMtx_initRandom (
611    SubMtx   *mtx,
612    int      type,
613    int      mode,
614    int      rowid,
615    int      colid,
616    int      nrow,
617    int      ncol,
618    int      nent,
619    int      seed
620 ) ;
621 /*
622    ------------------------------------------------
623    purpose -- to initialize a matrix object with
624       random entries in the upper triangle
625 
626    strict = 1 --> strict upper triangle
627 
628    created -- 98feb16, cca
629    ------------------------------------------------
630 */
631 void
632 SubMtx_initRandomUpperTriangle (
633    SubMtx   *mtx,
634    int      type,
635    int      mode,
636    int      rowid,
637    int      colid,
638    int      nrow,
639    int      ncol,
640    int      nent,
641    int      seed,
642    int      strict
643 ) ;
644 /*
645    ------------------------------------------------
646    purpose -- to initialize a matrix object with
647       random entries in the lower triangle
648 
649    strict = 1 --> strict lower triangle
650 
651    created -- 98feb16, cca
652    ------------------------------------------------
653 */
654 void
655 SubMtx_initRandomLowerTriangle (
656    SubMtx   *mtx,
657    int      type,
658    int      mode,
659    int      rowid,
660    int      colid,
661    int      nrow,
662    int      ncol,
663    int      nent,
664    int      seed,
665    int      strict
666 ) ;
667 /*--------------------------------------------------------------------*/
668 /*
669 ------------------------------------------------------------------------
670 ----- methods found in scalevec.c --------------------------------------
671 ------------------------------------------------------------------------
672 */
673 /*
674    -----------------------------------
675    purpose -- compute [y0] := A * [x0]
676 
677    created -- 98apr17, cca
678    -----------------------------------
679 */
680 void
681 SubMtx_scale1vec (
682    SubMtx   *mtxA,
683    double   y0[],
684    double   x0[]
685 ) ;
686 /*
687    -------------------------------------
688    purpose -- compute [y0 y1] := [x0 x1]
689 
690    created -- 98apr17, cca
691    -------------------------------------
692 */
693 void
694 SubMtx_scale2vec (
695    SubMtx     *mtxA,
696    double   y0[],
697    double   y1[],
698    double   x0[],
699    double   x1[]
700 ) ;
701 /*
702    -----------------------------------------------
703    purpose -- compute [y0 y1 y2] := A * [x0 x1 x2]
704 
705    created -- 98apr17, cca
706    -----------------------------------------------
707 */
708 void
709 SubMtx_scale3vec (
710    SubMtx     *mtxA,
711    double   y0[],
712    double   y1[],
713    double   y2[],
714    double   x0[],
715    double   x1[],
716    double   x2[]
717 ) ;
718 /*--------------------------------------------------------------------*/
719 /*
720 ------------------------------------------------------------------------
721 ----- methods found in solve.c -----------------------------------------
722 ------------------------------------------------------------------------
723 */
724 /*
725    -----------------------------------------------------------------
726    purpose -- solve A X = B,
727       where
728         (1) X overwrites B
729         (2) A must be lower or upper triangular,
730             diagonal or block diagonal
731         (3) if A is strict lower or upper triangular,
732             then we solve (I + A) X = B
733         (4) columns(A) = rows(X)
734         (5) rows(A)    = rows(B)
735         (6) B has type SUBMTX_DENSE_COLUMNS
736         (7) if A is SUBMTX_DENSE_SUBROWS or SUBMTX_SPARSE_ROWS
737             then A must be strict lower triangular
738         (8) if A is SUBMTX_DENSE_SUBCOLUMNS or SUBMTX_SPARSE_COLUMNS
739             then A must be strict upper triangular
740         (9) A can be SUBMTX_DIAGONAL, SUBMTX_BLOCK_DIAGONAL_SYM
741             or SUBMTX_BLOCK_DIAGONAL_HERM
742 
743    created -- 98may01, cca
744    -----------------------------------------------------------------
745 */
746 void
747 SubMtx_solve (
748    SubMtx   *mtxA,
749    SubMtx   *mtxB
750 ) ;
751 /*--------------------------------------------------------------------*/
752 /*
753 ------------------------------------------------------------------------
754 ----- methods found in solveT.c ----------------------------------------
755 ------------------------------------------------------------------------
756 */
757 /*
758    -----------------------------------------------------------------
759    purpose -- solve (A^T + I) X = B,
760       where
761         (1) X overwrites B
762         (2) A must be strict lower or upper triangular
763         (3) columns(A) = rows(X)
764         (4) rows(A)    = rows(B)
765         (5) B has type SUBMTX_DENSE_COLUMNS
766         (6) if A is SUBMTX_DENSE_SUBROWS or SUBMTX_SPARSE_ROWS
767             then A must be strict lower triangular
768         (7) if A is SUBMTX_DENSE_SUBCOLUMNS or SUBMTX_SPARSE_COLUMNS
769             then A must be strict upper triangular
770 
771    created -- 98may01, cca
772    -----------------------------------------------------------------
773 */
774 void
775 SubMtx_solveT (
776    SubMtx   *mtxA,
777    SubMtx   *mtxB
778 ) ;
779 /*--------------------------------------------------------------------*/
780 /*
781 ------------------------------------------------------------------------
782 ----- methods found in solveH.c ----------------------------------------
783 ------------------------------------------------------------------------
784 */
785 /*
786    -------------------------------------------------------------
787    purpose -- solve (A^H + I) X = B,
788       where
789         (1) X overwrites B
790         (2) A must be strict lower or upper triangular
791         (2) A, B and X are complex
792         (4) columns(A) = rows(X)
793         (5) rows(A)    = rows(B)
794         (6) B has mode SUBMTX_DENSE_COLUMNS
795         (7) if A is SUBMTX_DENSE_SUBROWS or SUBMTX_SPARSE_ROWS
796             then A must be strict lower triangular
797         (8) if A is SUBMTX_DENSE_SUBCOLUMNS or SUBMTX_SPARSE_COLUMNS
798             then A must be strict upper triangular
799 
800    created -- 98may01, cca
801    -------------------------------------------------------------
802 */
803 void
804 SubMtx_solveH (
805    SubMtx   *mtxA,
806    SubMtx   *mtxB
807 ) ;
808 /*--------------------------------------------------------------------*/
809 /*
810 ------------------------------------------------------------------------
811 ----- methods found in solveupd.c --------------------------------------
812 ------------------------------------------------------------------------
813 */
814 /*
815    ----------------------------------------------------
816    purpose -- perform the matrix-matrix multiply
817       Y := Y - A * X used in the forward and backsolves
818       where
819         (1) rows(A) \subseteq rows(Y)
820         (2) rows(A) are local w.r.t. rows(Y)
821         (3) cols(A) \subseteq rows(X)
822         (4) cols(A) are local w.r.t. rows(X)
823         (5) cols(Y) = cols(X)
824         (6) Y and X have mode SUBMTX_DENSE_COLUMNS
825 
826    created -- 98may02, cca
827    ----------------------------------------------------
828 */
829 void
830 SubMtx_solveupd (
831    SubMtx   *mtxY,
832    SubMtx   *mtxA,
833    SubMtx   *mtxX
834 ) ;
835 /*--------------------------------------------------------------------*/
836 /*
837 ------------------------------------------------------------------------
838 ----- methods found in solveupdT.c -------------------------------------
839 ------------------------------------------------------------------------
840 */
841 /*
842    ------------------------------------------------------
843    purpose -- perform the matrix-matrix multiply
844       Y := Y - A^T * X used in the forward and backsolves
845       where
846         (1) rows(A) \subseteq rows(Y)
847         (2) rows(A) are local w.r.t. rows(Y)
848         (3) cols(A) \subseteq rows(X)
849         (4) cols(A) are local w.r.t. rows(X)
850         (5) cols(Y) = cols(X)
851         (6) Y and X have type SUBMTX_DENSE_COLUMNS
852 
853    created -- 98may02, cca
854    -----------------------------------------------------
855 */
856 void
857 SubMtx_solveupdT (
858    SubMtx     *mtxY,
859    SubMtx     *mtxA,
860    SubMtx     *mtxX
861 ) ;
862 /*--------------------------------------------------------------------*/
863 /*
864 ------------------------------------------------------------------------
865 ----- methods found in solveupdH.c -------------------------------------
866 ------------------------------------------------------------------------
867 */
868 /*
869    ------------------------------------------------------
870    purpose -- perform the matrix-matrix multiply
871       Y := Y - A^H * X used in the forward and backsolves
872       where
873         (1) rows(A) \subseteq rows(Y)
874         (2) rows(A) are local w.r.t. rows(Y)
875         (3) cols(A) \subseteq rows(X)
876         (4) cols(A) are local w.r.t. rows(X)
877         (5) cols(Y) = cols(X)
878         (6) Y and X have type SUBMTX_DENSE_COLUMNS
879 
880    created -- 98may02, cca
881    -----------------------------------------------------
882 */
883 void
884 SubMtx_solveupdH (
885    SubMtx     *mtxY,
886    SubMtx     *mtxA,
887    SubMtx     *mtxX
888 ) ;
889 /*--------------------------------------------------------------------*/
890 /*
891 ------------------------------------------------------------------------
892 ----- methods found in sort.c ------------------------------------------
893 ------------------------------------------------------------------------
894 */
895 /*
896    -----------------------------------------------------------
897    purpose -- sort the rows of the matrix into ascending order
898 
899    created -- 98mar02, cca
900    -----------------------------------------------------------
901 */
902 void
903 SubMtx_sortRowsUp (
904    SubMtx   *mtx
905 ) ;
906 /*
907    --------------------------------------------------------------
908    purpose -- sort the columns of the matrix into ascending order
909 
910    created -- 98mar02, cca
911    --------------------------------------------------------------
912 */
913 void
914 SubMtx_sortColumnsUp (
915    SubMtx   *mtx
916 ) ;
917 /*--------------------------------------------------------------------*/
918 /*
919 ------------------------------------------------------------------------
920 ----- methods found in util.c ------------------------------------------
921 ------------------------------------------------------------------------
922 */
923 /*
924    -----------------------------------------
925    purpose -- to fill rowDV with the entries
926               in row irow of the matrix
927 
928    created -- 98may01, cca
929    -----------------------------------------
930 */
931 void
932 SubMtx_fillRowDV (
933    SubMtx   *mtx,
934    int      irow,
935    DV       *rowDV
936 ) ;
937 /*
938    -----------------------------------------
939    purpose -- to fill rowZV with the entries
940               in row irow of the matrix
941 
942    created -- 98may01, cca
943    -----------------------------------------
944 */
945 void
946 SubMtx_fillRowZV (
947    SubMtx   *mtx,
948    int      irow,
949    ZV       *rowZV
950 ) ;
951 /*
952    -----------------------------------------
953    purpose -- to fill colDV with the entries
954               in column icol of the matrix
955 
956    created -- 98may01, cca
957    -----------------------------------------
958 */
959 void
960 SubMtx_fillColumnDV (
961    SubMtx   *mtx,
962    int      icol,
963    DV       *colDV
964 ) ;
965 /*
966    -----------------------------------------
967    purpose -- to fill colZV with the entries
968               in column icol of the matrix
969 
970    created -- 98may01, cca
971    -----------------------------------------
972 */
973 void
974 SubMtx_fillColumnZV (
975    SubMtx   *mtx,
976    int      icol,
977    ZV       *colZV
978 ) ;
979 /*
980    ------------------------------------------------------
981    purpose -- return the magnitude of the largest element
982 
983    created -- 98may01, cca
984    ------------------------------------------------------
985 */
986 double
987 SubMtx_maxabs (
988    SubMtx   *mtx
989 ) ;
990 /*
991    -----------------------------------------
992    purpose -- zero the entries in the matrix
993 
994    created -- 98may04, cca
995    -----------------------------------------
996 */
997 void
998 SubMtx_zero (
999    SubMtx   *mtx
1000 ) ;
1001 /*--------------------------------------------------------------------*/
1002 /*
1003 ------------------------------------------------------------------------
1004 ----- methods found in IO.c --------------------------------------------
1005 ------------------------------------------------------------------------
1006 */
1007 /*
1008    --------------------------------------------------
1009    purpose -- to read in an SubMtx object from a file
1010 
1011    input --
1012 
1013       fn -- filename, must be *.submtxb or *.submtxf
1014 
1015    return value -- 1 if success, 0 if failure
1016 
1017    created -- 98feb15, cca
1018    --------------------------------------------------
1019 */
1020 int
1021 SubMtx_readFromFile (
1022    SubMtx   *mtx,
1023    char     *fn
1024 ) ;
1025 /*
1026    -------------------------------------------------------
1027    purpose -- to read an SubMtx object from a formatted file
1028 
1029    return value -- 1 if success, 0 if failure
1030 
1031    created -- 96jun23, cca
1032    -------------------------------------------------------
1033 */
1034 int
1035 SubMtx_readFromFormattedFile (
1036    SubMtx    *mtx,
1037    FILE   *fp
1038 ) ;
1039 /*
1040    ------------------------------------------------------
1041    purpose -- to read an SubMtx object from a binary file
1042 
1043    return value -- 1 if success, 0 if failure
1044 
1045    created -- 96jun23, cca
1046    ------------------------------------------------------
1047 */
1048 int
1049 SubMtx_readFromBinaryFile (
1050    SubMtx   *mtx,
1051    FILE     *fp
1052 ) ;
1053 /*
1054    ----------------------------------------------
1055    purpose -- to write an SubMtx object to a file
1056 
1057    input --
1058 
1059       fn -- filename
1060         *.submtxb -- binary
1061         *.submtxf -- formatted
1062         anything else -- for human eye
1063 
1064    return value -- 1 if success, 0 otherwise
1065 
1066    created -- 96jun23, cca
1067    ----------------------------------------------
1068 */
1069 int
1070 SubMtx_writeToFile (
1071    SubMtx   *mtx,
1072    char     *fn
1073 ) ;
1074 /*
1075    --------------------------------------------------------
1076    purpose -- to write an SubMtx object to a formatted file
1077 
1078    return value -- 1 if success, 0 otherwise
1079 
1080    created -- 96jun23, cca
1081    --------------------------------------------------------
1082 */
1083 int
1084 SubMtx_writeToFormattedFile (
1085    SubMtx   *mtx,
1086    FILE     *fp
1087 ) ;
1088 /*
1089    -----------------------------------------------------
1090    purpose -- to write an SubMtx object to a binary file
1091 
1092    return value -- 1 if success, 0 otherwise
1093 
1094    created -- 96jun23, cca
1095    -----------------------------------------------------
1096 */
1097 int
1098 SubMtx_writeToBinaryFile (
1099    SubMtx   *mtx,
1100    FILE     *fp
1101 ) ;
1102 /*
1103    -------------------------------------------------------
1104    purpose -- write a SubMtx object in human readable form
1105 
1106    created -- 98feb07, cca
1107    -------------------------------------------------------
1108 */
1109 int
1110 SubMtx_writeForHumanEye (
1111    SubMtx   *mtx,
1112    FILE     *fp
1113 ) ;
1114 /*
1115    -------------------------------------------------------------------
1116    purpose -- write the header and scalar quantities for a SubMtx object
1117 
1118    created -- 98feb07, cca
1119    -------------------------------------------------------------------
1120 */
1121 int
1122 SubMtx_writeStats (
1123    SubMtx   *mtx,
1124    FILE   *fp
1125 ) ;
1126 /*
1127    --------------------------------------------------
1128    purpose -- write the matrix entries out for matlab
1129 
1130    created -- 98feb07, cca
1131    --------------------------------------------------
1132 */
1133 void
1134 SubMtx_writeForMatlab (
1135    SubMtx   *mtx,
1136    char   *mtxname,
1137    FILE   *fp
1138 ) ;
1139 /*--------------------------------------------------------------------*/
1140