Blender V2.61 - r43446
|
00001 00006 /* 00007 * -- SuperLU routine (version 2.0) -- 00008 * Univ. of California Berkeley, Xerox Palo Alto Research Center, 00009 * and Lawrence Berkeley National Lab. 00010 * November 15, 1997 00011 * 00012 */ 00013 /* 00014 Copyright (c) 1994 by Xerox Corporation. All rights reserved. 00015 00016 THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 00017 EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 00018 00019 Permission is hereby granted to use or copy this program for any 00020 purpose, provided the above notices are retained on all copies. 00021 Permission to modify the code and to distribute modified code is 00022 granted, provided the above notices are retained, and a notice that 00023 the code was modified is included with the above copyright notice. 00024 */ 00025 00026 #include "ssp_defs.h" 00027 #include "util.h" 00028 00029 int 00030 ssnode_dfs ( 00031 const int jcol, /* in - start of the supernode */ 00032 const int kcol, /* in - end of the supernode */ 00033 const int *asub, /* in */ 00034 const int *xa_begin, /* in */ 00035 const int *xa_end, /* in */ 00036 int *xprune, /* out */ 00037 int *marker, /* modified */ 00038 GlobalLU_t *Glu /* modified */ 00039 ) 00040 { 00041 /* Purpose 00042 * ======= 00043 * ssnode_dfs() - Determine the union of the row structures of those 00044 * columns within the relaxed snode. 00045 * Note: The relaxed snodes are leaves of the supernodal etree, therefore, 00046 * the portion outside the rectangular supernode must be zero. 00047 * 00048 * Return value 00049 * ============ 00050 * 0 success; 00051 * >0 number of bytes allocated when run out of memory. 00052 * 00053 */ 00054 register int i, k, ifrom, ito, nextl, new_next; 00055 int nsuper, krow, kmark, mem_error; 00056 int *xsup, *supno; 00057 int *lsub, *xlsub; 00058 int nzlmax; 00059 00060 xsup = Glu->xsup; 00061 supno = Glu->supno; 00062 lsub = Glu->lsub; 00063 xlsub = Glu->xlsub; 00064 nzlmax = Glu->nzlmax; 00065 00066 nsuper = ++supno[jcol]; /* Next available supernode number */ 00067 nextl = xlsub[jcol]; 00068 00069 for (i = jcol; i <= kcol; i++) { 00070 /* For each nonzero in A[*,i] */ 00071 for (k = xa_begin[i]; k < xa_end[i]; k++) { 00072 krow = asub[k]; 00073 kmark = marker[krow]; 00074 if ( kmark != kcol ) { /* First time visit krow */ 00075 marker[krow] = kcol; 00076 lsub[nextl++] = krow; 00077 if ( nextl >= nzlmax ) { 00078 if ( (mem_error = sLUMemXpand(jcol, nextl, LSUB, &nzlmax, Glu)) ) 00079 return (mem_error); 00080 lsub = Glu->lsub; 00081 } 00082 } 00083 } 00084 supno[i] = nsuper; 00085 } 00086 00087 /* Supernode > 1, then make a copy of the subscripts for pruning */ 00088 if ( jcol < kcol ) { 00089 new_next = nextl + (nextl - xlsub[jcol]); 00090 while ( new_next > nzlmax ) { 00091 if ( (mem_error = sLUMemXpand(jcol, nextl, LSUB, &nzlmax, Glu)) ) 00092 return (mem_error); 00093 lsub = Glu->lsub; 00094 } 00095 ito = nextl; 00096 for (ifrom = xlsub[jcol]; ifrom < nextl; ) 00097 lsub[ito++] = lsub[ifrom++]; 00098 for (i = jcol+1; i <= kcol; i++) xlsub[i] = nextl; 00099 nextl = ito; 00100 } 00101 00102 xsup[nsuper+1] = kcol + 1; 00103 supno[kcol+1] = nsuper; 00104 xprune[kcol] = nextl; 00105 xlsub[kcol+1] = nextl; 00106 00107 return 0; 00108 } 00109