Blame view

fvn_sparse/UMFPACK/Source/umf_fsize.c 2.19 KB
422234dc3   daniau   git-svn-id: https...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  /* ========================================================================== */
  /* === UMF_fsize ============================================================ */
  /* ========================================================================== */
  
  /* -------------------------------------------------------------------------- */
  /* UMFPACK Copyright (c) Timothy A. Davis, CISE,                              */
  /* Univ. of Florida.  All Rights Reserved.  See ../Doc/License for License.   */
  /* web: http://www.cise.ufl.edu/research/sparse/umfpack                       */
  /* -------------------------------------------------------------------------- */
  
  /* Determine the largest frontal matrix size for each subtree.   Called by
   * UMF_colamd and UMF_analyze.  Only required to sort the children of each
   * node prior to AMD_postorder. */
  
  #include "umf_internal.h"
  
  GLOBAL void UMF_fsize
  (
      Int nn,
      Int Fsize [ ],
      Int Fnrows [ ],
      Int Fncols [ ],
      Int Parent [ ],
      Int Npiv [ ]
  )
  {
      Int j, parent, frsize, r, c ;
  
      for (j = 0 ; j < nn ; j++)
      {
  	Fsize [j] = EMPTY ;
      }
  
      /* ---------------------------------------------------------------------- */
      /* find max front size for tree rooted at node j, for each front j */
      /* ---------------------------------------------------------------------- */
  
      DEBUG1 (("
  
  ========================================FRONTS:
  ")) ;
      for (j = 0 ; j < nn ; j++)
      {
  	if (Npiv [j] > 0)
  	{
  	    /* this is a frontal matrix */
  	    parent = Parent [j] ;
  	    r = Fnrows [j] ;
  	    c = Fncols [j] ;
  	    frsize = r * c ;
  	    /* avoid integer overflow */
  	    if (INT_OVERFLOW (((double) r) * ((double) c)))
  	    {
  		/* :: frsize int overflow :: */
  		frsize = Int_MAX ;
  	    }
  	    DEBUG1 ((""ID" : npiv "ID" size "ID" parent "ID" ",
  		j, Npiv [j], frsize, parent)) ;
  	    Fsize [j] = MAX (Fsize [j], frsize) ;
  	    DEBUG1 (("Fsize [j = "ID"] = "ID"
  ", j, Fsize [j])) ;
  	    if (parent != EMPTY)
  	    {
  		/* find the maximum frontsize of self and children */
  		ASSERT (Npiv [parent] > 0) ;
  		ASSERT (parent > j) ;
  		Fsize [parent] = MAX (Fsize [parent], Fsize [j]) ;
  		DEBUG1 (("Fsize [parent = "ID"] = "ID"
  ",
  		    parent, Fsize [parent]));
  	    }
  	}
      }
  }