Blender V2.61 - r43446

relax_snode.c

Go to the documentation of this file.
00001 
00004 /*
00005  * -- SuperLU routine (version 2.0) --
00006  * Univ. of California Berkeley, Xerox Palo Alto Research Center,
00007  * and Lawrence Berkeley National Lab.
00008  * November 15, 1997
00009  *
00010  */
00011 /*
00012   Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
00013  
00014   THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
00015   EXPRESSED OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
00016  
00017   Permission is hereby granted to use or copy this program for any
00018   purpose, provided the above notices are retained on all copies.
00019   Permission to modify the code and to distribute modified code is
00020   granted, provided the above notices are retained, and a notice that
00021   the code was modified is included with the above copyright notice.
00022 */
00023 
00024 #include "ssp_defs.h"
00025 
00026 void
00027 relax_snode (
00028          const     int n,
00029          int       *et,           /* column elimination tree */
00030          const int relax_columns, /* max no of columns allowed in a
00031                      relaxed snode */
00032          int       *descendants,  /* no of descendants of each node
00033                      in the etree */
00034          int       *relax_end     /* last column in a supernode */
00035          )
00036 {
00037 /*
00038  * Purpose
00039  * =======
00040  *    relax_snode() - Identify the initial relaxed supernodes, assuming that 
00041  *    the matrix has been reordered according to the postorder of the etree.
00042  *
00043  */ 
00044     register int j, parent;
00045     register int snode_start;   /* beginning of a snode */
00046     
00047     ifill (relax_end, n, EMPTY);
00048     for (j = 0; j < n; j++) descendants[j] = 0;
00049 
00050     /* Compute the number of descendants of each node in the etree */
00051     for (j = 0; j < n; j++) {
00052     parent = et[j];
00053     if ( parent != n )  /* not the dummy root */
00054         descendants[parent] += descendants[j] + 1;
00055     }
00056 
00057     /* Identify the relaxed supernodes by postorder traversal of the etree. */
00058     for (j = 0; j < n; ) { 
00059         parent = et[j];
00060         snode_start = j;
00061     while ( parent != n && descendants[parent] < relax_columns ) {
00062         j = parent;
00063         parent = et[j];
00064     }
00065     /* Found a supernode with j being the last column. */
00066     relax_end[snode_start] = j;     /* Last column is recorded */
00067     j++;
00068     /* Search for a new leaf */
00069     while ( descendants[j] != 0 && j < n ) j++;
00070     }
00071 
00072     /*printf("No of relaxed snodes: %d; relaxed columns: %d\n", 
00073         nsuper, no_relaxed_col); */
00074 }