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 void 00030 spruneL( 00031 const int jcol, /* in */ 00032 const int *perm_r, /* in */ 00033 const int pivrow, /* in */ 00034 const int nseg, /* in */ 00035 const int *segrep, /* in */ 00036 const int *repfnz, /* in */ 00037 int *xprune, /* out */ 00038 GlobalLU_t *Glu /* modified - global LU data structures */ 00039 ) 00040 { 00041 /* 00042 * Purpose 00043 * ======= 00044 * Prunes the L-structure of supernodes whose L-structure 00045 * contains the current pivot row "pivrow" 00046 * 00047 */ 00048 float utemp; 00049 int jsupno, irep, irep1, kmin, kmax, krow, movnum; 00050 int i, ktemp, minloc, maxloc; 00051 int do_prune; /* logical variable */ 00052 int *xsup, *supno; 00053 int *lsub, *xlsub; 00054 float *lusup; 00055 int *xlusup; 00056 00057 xsup = Glu->xsup; 00058 supno = Glu->supno; 00059 lsub = Glu->lsub; 00060 xlsub = Glu->xlsub; 00061 lusup = Glu->lusup; 00062 xlusup = Glu->xlusup; 00063 00064 /* 00065 * For each supernode-rep irep in U[*,j] 00066 */ 00067 jsupno = supno[jcol]; 00068 for (i = 0; i < nseg; i++) { 00069 00070 irep = segrep[i]; 00071 irep1 = irep + 1; 00072 do_prune = FALSE; 00073 00074 /* Don't prune with a zero U-segment */ 00075 if ( repfnz[irep] == EMPTY ) 00076 continue; 00077 00078 /* If a snode overlaps with the next panel, then the U-segment 00079 * is fragmented into two parts -- irep and irep1. We should let 00080 * pruning occur at the rep-column in irep1's snode. 00081 */ 00082 if ( supno[irep] == supno[irep1] ) /* Don't prune */ 00083 continue; 00084 00085 /* 00086 * If it has not been pruned & it has a nonz in row L[pivrow,i] 00087 */ 00088 if ( supno[irep] != jsupno ) { 00089 if ( xprune[irep] >= xlsub[irep1] ) { 00090 kmin = xlsub[irep]; 00091 kmax = xlsub[irep1] - 1; 00092 for (krow = kmin; krow <= kmax; krow++) 00093 if ( lsub[krow] == pivrow ) { 00094 do_prune = TRUE; 00095 break; 00096 } 00097 } 00098 00099 if ( do_prune ) { 00100 00101 /* Do a quicksort-type partition 00102 * movnum=TRUE means that the num values have to be exchanged. 00103 */ 00104 movnum = FALSE; 00105 if ( irep == xsup[supno[irep]] ) /* Snode of size 1 */ 00106 movnum = TRUE; 00107 00108 while ( kmin <= kmax ) { 00109 00110 if ( perm_r[lsub[kmax]] == EMPTY ) 00111 kmax--; 00112 else if ( perm_r[lsub[kmin]] != EMPTY ) 00113 kmin++; 00114 else { /* kmin below pivrow, and kmax above pivrow: 00115 * interchange the two subscripts 00116 */ 00117 ktemp = lsub[kmin]; 00118 lsub[kmin] = lsub[kmax]; 00119 lsub[kmax] = ktemp; 00120 00121 /* If the supernode has only one column, then we 00122 * only keep one set of subscripts. For any subscript 00123 * interchange performed, similar interchange must be 00124 * done on the numerical values. 00125 */ 00126 if ( movnum ) { 00127 minloc = xlusup[irep] + (kmin - xlsub[irep]); 00128 maxloc = xlusup[irep] + (kmax - xlsub[irep]); 00129 utemp = lusup[minloc]; 00130 lusup[minloc] = lusup[maxloc]; 00131 lusup[maxloc] = utemp; 00132 } 00133 00134 kmin++; 00135 kmax--; 00136 00137 } 00138 00139 } /* while */ 00140 00141 xprune[irep] = kmin; /* Pruning */ 00142 00143 #ifdef CHK_PRUNE 00144 printf(" After spruneL(),using col %d: xprune[%d] = %d\n", 00145 jcol, irep, kmin); 00146 #endif 00147 } /* if do_prune */ 00148 00149 } /* if */ 00150 00151 } /* for each U-segment... */ 00152 }