1 |
aw0a |
1 |
/* |
2 |
|
|
* mtx: Ascend Sparse Matrix Package |
3 |
|
|
* by Benjamin Andrew Allan |
4 |
|
|
* Derived from mtx by Karl Michael Westerberg |
5 |
|
|
* Created: 5/3/90 |
6 |
|
|
* Version: $Revision: 1.4 $ |
7 |
|
|
* Version control file: $RCSfile: mtx_reorder.h,v $ |
8 |
|
|
* Date last modified: $Date: 1997/07/18 12:15:17 $ |
9 |
|
|
* Last modified by: $Author: mthomas $ |
10 |
|
|
* |
11 |
|
|
* This file is part of the SLV solver. |
12 |
|
|
* |
13 |
|
|
* Copyright (C) 1996 Benjamin Andrew Allan |
14 |
|
|
* |
15 |
|
|
* The SLV solver is free software; you can redistribute |
16 |
|
|
* it and/or modify it under the terms of the GNU General Public License as |
17 |
|
|
* published by the Free Software Foundation; either version 2 of the |
18 |
|
|
* License, or (at your option) any later version. |
19 |
|
|
* |
20 |
|
|
* The SLV solver is distributed in hope that it will be |
21 |
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
23 |
|
|
* General Public License for more details. |
24 |
|
|
* |
25 |
|
|
* You should have received a copy of the GNU General Public License along with |
26 |
|
|
* the program; if not, write to the Free Software Foundation, Inc., 675 |
27 |
|
|
* Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING. |
28 |
|
|
* COPYING is found in ../compiler. |
29 |
|
|
*/ |
30 |
|
|
#ifndef __MTX_REORDER_H_SEEN__ |
31 |
|
|
#define __MTX_REORDER_H_SEEN__ |
32 |
|
|
/* requires #include "mtx.h" */ |
33 |
|
|
|
34 |
|
|
enum mtx_reorder_method { |
35 |
|
|
mtx_UNKNOWN, /* junk method */ |
36 |
|
|
mtx_SPK1, /* Stadtherr's SPK1 reordering */ |
37 |
|
|
mtx_TSPK1, /* transpose of Stadtherr's SPK1 reordering */ |
38 |
|
|
mtx_NATURAL /* kinda pointless, don't you think? */ |
39 |
|
|
}; |
40 |
|
|
|
41 |
|
|
extern int mtx_reorder(mtx_matrix_t,mtx_region_t *, enum mtx_reorder_method); |
42 |
|
|
/** |
43 |
|
|
*** mtx_reorder(sys,region,rmeth) |
44 |
|
|
*** mtx_matrix_t mtx; |
45 |
|
|
*** mtx_region_t *region; |
46 |
|
|
*** enum mtx_reorder_method; |
47 |
|
|
*** |
48 |
|
|
*** The specified region of the coefficient matrix is reordered. |
49 |
|
|
*** The specified region |
50 |
|
|
*** is assumed to contain only nonempty rows and columns and have a full |
51 |
|
|
*** diagonal. |
52 |
|
|
*** If the matrix in is from a nonlinear system, the |
53 |
|
|
*** pattern in the matrix should probably be the structural one (as |
54 |
|
|
*** opposed to the numerically derived incidence which may be less.) |
55 |
|
|
*** |
56 |
|
|
*** If you use the numerically derived incidence, you will need to reorder |
57 |
|
|
*** before every factorization. This is generally not cost effective. |
58 |
|
|
*** If region given is mtx_ENTIRE_MATRIX, a search will be done to find |
59 |
|
|
*** an appropriate bounding region in the coefficient mtx. This is |
60 |
|
|
*** not a particularly cheap search. |
61 |
|
|
*** |
62 |
|
|
*** The reorder call should be done (once) at |
63 |
|
|
*** the beginning of any series of linear solutions being performed on |
64 |
|
|
*** on structurally identical matrices. |
65 |
|
|
*** |
66 |
|
|
*** We HATE mtx_ENTIRE_MATRIX as the input region. |
67 |
|
|
*** |
68 |
|
|
*** Brief notes on the reorderings available. |
69 |
|
|
*** SPK1: |
70 |
|
|
*** TSPK1: Both these operate only on a square region which is of. |
71 |
|
|
*** full rank (in particular it should have a 0 free diagonal). |
72 |
|
|
*** If you give us a bogus region, we will Try to make something |
73 |
|
|
*** decent of it, but good results are improbable. |
74 |
|
|
*** Natural: Blesses the system and does nothing. |
75 |
|
|
*** Again, the rows/cols not in the diagonal are dependent. |
76 |
|
|
*** |
77 |
|
|
*** On reordering in general: 'Optimal' reordering is an NP complete |
78 |
|
|
*** task. Real reordering methods are heuristic and tend to break down |
79 |
|
|
*** when the matrix being reordered is in some sense 'large' so that |
80 |
|
|
*** the tie-breaking and other heuristics fail. |
81 |
|
|
*** |
82 |
|
|
*** Return 0 if ok, 1 if bad input detected, 2 if unable to do. |
83 |
|
|
**/ |
84 |
|
|
#endif /* __MTX_REORDER_H_SEEN__ */ |