File: PCAD2ESPCAD.c

package info (click to toggle)
qepcad 1.74%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,828 kB
  • sloc: ansic: 27,242; cpp: 2,995; makefile: 1,285; perl: 91
file content (89 lines) | stat: -rw-r--r-- 2,727 bytes parent folder | download | duplicates (2)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*======================================================================
                      PCAD2ESPCAD(P,Ps,Ds,A)

PCAD to ESPCAD conversion.

Inputs
  P  :  A projection factor set structure.
  Ps :  A projection factor set structure, Ps contained in P.
  Ds :  A PCAD cell in the PCAD defined by Ps, where the references
        to QECPAD cell structures are to cells whose signitures
        are defined with respect to Ps.
  A  :  The parent ESPCAD cell for the cell being constructed.

Outputs
  EDs:  An ESPCAD corresponding to the cell Ds.

======================================================================*/
#include "espcad.h"

static Word LIST8(Word a1, Word a2, Word a3, Word a4, Word a5, Word a6, Word a7, Word a8)
{
  return COMP2(a1,a2,LIST6(a3,a4,a5,a6,a7,a8));
}


Word PCAD2ESPCAD(Word P,Word Ps,Word Ds,Word A)
{
       Word C,i,s,ss,P_i,Ps_i,S,Ss,c,EDs,T,t,Tp,u,v;

Step1: /* Initialize. */
       C = LELTI(Ds,SC_REP);
       i = LELTI(C,LEVEL);

Step2: /* Generate correct i-level signiture list. */
       if (i > 0 ) {
         ss = NIL;
         s = FIRST(LELTI(C,SIGNPF));
         P_i = LELTI(P,i); Ps_i = LELTI(Ps,i);
         while(Ps_i != NIL) {
           if (EQUAL(LELTI(FIRST(P_i),PO_LABEL),
                     LELTI(FIRST(Ps_i),PO_LABEL))) {
             ss = COMP(FIRST(s),ss);
             Ps_i = RED(Ps_i); }
           P_i = RED(P_i);
           s = RED(s); }
         s = INV(ss); }
       else
	 s = NIL;

Step3: /* Construct extended Sub-CAD cell structure. */
       EDs = LIST8(C,A,LELTI(Ds,SC_INX),NIL,s,NIL,UNDET,UNDET);

Step4: /* Generate extended child list and add root number vector. */
       S = LELTI(Ds,SC_CDTV);
       if (ISLIST(S)) {
         for(S = CINV(S),Ss = NIL; S != NIL; S = RED(S)) {
           c = FIRST(S);
           Ss = COMP(PCAD2ESPCAD(P,Ps,c,EDs),Ss); }
         S = Ss; }
       else
         SLELTI(EDs,SC_TMPM,S);
       SLELTI(EDs,SC_CDTV,S);
       SLELTI(EDs,SC_RRNV,ESPCADCRNV(EDs));

Step5: /* Set the extended sign vector of cell's children. */
       if (ISLIST(S)) {
	 /* Set T to -1 in all positions corresponding to polynomials
            that vanish identically over EDs, and 1 everywhere else. */
	 for(T = NIL, v = CINV(LELTI(EDs,SC_RRNV)); v != NIL; v = RED(v))
	   if (FIRST(v) == -1)
	     T = COMP(-1,T);
	   else
	     T = COMP(1,T);
	 /* Loop over each child cell, updating T and attatching it. */
	 while (S != NIL) {
	   ADV(S,&s,&S);
	   Tp = CINV(T);
	   u = CINV(LELTI(s,SC_SIGN));
	   for(T = NIL; Tp != NIL; Tp = RED(Tp), u = RED(u)) {
	     t = FIRST(Tp);
	     if (FIRST(u) == 0 || EVEN(t))
	       t++;
	     T = COMP(t,T); }
	   SLELTI(s,SC_EXTS,T); } }

Return: /* Prepare to return. */
       return EDs;

}