source: trunk/symbol_table/id_group_strms.py @ 2043

Last change on this file since 2043 was 2043, checked in by ksherdy, 7 years ago

Added div2 pablo equations and demo. Worked out errors in prior version.

File size: 2.4 KB
Line 
1from bitutil import *
2
3class Groups():
4        starts = 0
5        ends = 0
6        ends_1 = 0
7        ends_2 = 0
8        ends_3 = 0
9        ends_4 = 0
10        ends_5 = 0
11        ends_6 = 0
12        ends_7 = 0
13        ends_8 = 0
14        ends_9 = 0
15        ends_10 = 0
16        ends_11 = 0
17        ends_12 = 0
18        ends_13 = 0
19        ends_14 = 0
20        ends_15 = 0
21        ends_16 = 0
22        ends_gte_17 = 0
23
24def Gen_lgth_groups(groups):
25
26        cursor = groups.starts
27        temp = groups.ends
28
29        # Group symbols of length 1
30        cursor = pablo.Advance(cursor)
31        groups.ends_1 = cursor & temp
32        temp = temp & ~groups.ends_1
33
34        # Group symbols of length 2
35        cursor = pablo.Advance(cursor)
36        groups.ends_2 = cursor & temp
37        temp = temp & ~groups.ends_2
38
39        # Group symbols of length 3
40        cursor = pablo.Advance(cursor)
41        groups.ends_3 = cursor & temp
42        temp = temp & ~groups.ends_3
43
44        # Group symbols of length 4
45        cursor = pablo.Advance(cursor)
46        groups.ends_4 = cursor & temp
47        temp = temp & ~groups.ends_4
48
49        # Group symbols of length 5
50        cursor = pablo.Advance(cursor)
51        groups.ends_5 = cursor & temp
52        temp = temp & ~groups.ends_5
53
54        # Group symbols of length 6
55        cursor = pablo.Advance(cursor)
56        groups.ends_6 = cursor & temp
57        temp = temp & ~groups.ends_6
58
59        # Group symbols of length 7
60        cursor = pablo.Advance(cursor)
61        groups.ends_7 = cursor & temp
62        temp = temp & ~groups.ends_7
63
64        # Group symbols of length 8
65        cursor = pablo.Advance(cursor)
66        groups.ends_8 = cursor & temp
67        temp = temp & ~groups.ends_8
68
69        # Group symbols of length 9
70        cursor = pablo.Advance(cursor)
71        groups.ends_9 = cursor & temp
72        temp = temp & ~groups.ends_9
73
74        # Group symbols of length 10
75        cursor = pablo.Advance(cursor)
76        groups.ends_10 = cursor & temp
77        temp = temp & ~groups.ends_10
78
79        # Group symbols of length 11
80        cursor = pablo.Advance(cursor)
81        groups.ends_11 = cursor & temp
82        temp = temp & ~groups.ends_11
83
84        # Group symbols of length 12
85        cursor = pablo.Advance(cursor)
86        groups.ends_12 = cursor & temp
87        temp = temp & ~groups.ends_12
88
89        # Group symbols of length 13
90        cursor = pablo.Advance(cursor)
91        groups.ends_13 = cursor & temp
92        temp = temp & ~groups.ends_13
93
94        # Group symbols of length 14
95        cursor = pablo.Advance(cursor)
96        groups.ends_14 = cursor & temp
97        temp = temp & ~groups.ends_14
98
99        # Group symbols of length 15
100        cursor = pablo.Advance(cursor)
101        groups.ends_15 = cursor & temp
102        temp = temp & ~groups.ends_15
103
104        # Group symbols of length 16
105        cursor = pablo.Advance(cursor)
106        groups.ends_16 = cursor & temp
107        temp = temp & ~groups.ends_16
108
109        # Group symbols of length greater than 16
110        groups.ends_gte_17 = temp
111
112def Main(groups):
113        Gen_lgth_groups(groups)
114
Note: See TracBrowser for help on using the repository browser.