-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbits.cpp
1246 lines (864 loc) · 25.4 KB
/
bits.cpp
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
This is bits.cpp
Coxeter version 3.0 Copyright (C) 2002 Fokko du Cloux
See file main.cpp for full copyright notice
*/
#include "bits.h"
#include <limits.h>
/*****************************************************************************
This module regroups classes and functions for bit-access of structures.
Subsets of given structures will frequently in this program be represented
by bitmaps; these may be small bitmaps, fitting inside a single Ulong,
or larger ones, necessitating a list.
In this program, a bitmap will always be a list of unsigned chars, ensuring
portability across all platforms, independently of word size and endianism
problems. However, to accelerate bitwise operations we always make sure
that bitmaps are allocated in multiples of sizeof(Ulong) characters,
so that bitwise operations can be done one Ulong at a time.
*****************************************************************************/
/*****************************************************************************
Chapter I -- The Permutation class
A permutation of a set is just the enumeration of the elements of the set
(assumed to be running from 0 to N-1) in a certain order; a[j] is
interpreted as the image of element #j under a.
We have tried to be consistent in the whole program about this, and the
way permutations acts on sets and functions; when a acts on the range,
we somply apply a to the image of a function; when a acts on the domain,
we compose f with a^{-1} (we are able to do this essentially in-place.)
The following functions are defined :
- constructors and destructors :
- Permutation();
- Permutation(n);
- ~Permutation();
- manipulators :
- inverse() : inverts the permutation;
- compose(a) : increment by a under right composition;
- leftCompose(a) : same on the left;
*****************************************************************************/
namespace bits {
Permutation::Permutation():List<Ulong>()
{}
Permutation::Permutation(const Ulong& n):List<Ulong>(n)
{}
Permutation::~Permutation()
{}
Permutation& Permutation::identity(const Ulong& n)
/*
Sets the permutation to the identity permutation of [0,n[.
*/
{
setSize(n);
for (Ulong j = 0; j < size(); ++j) {
d_ptr[j] = j;
}
return *this;
}
Permutation& Permutation::inverse()
/*
Inverts the current permutation : new(old(x)) = x. This is a little
bit more tricky than our usual inversions, because it involves the
permutation itselves; we've opted for safety and used a buffer for the
whole permutation.
*/
{
static Permutation i(0);
i.setSize(size());
Permutation& t = *this;
for (SetElt x = 0; x < size(); ++x)
i[t[x]] = x;
t.assign(i);
return t;
}
Permutation& Permutation::rightCompose(const Permutation& a)
/*
Increments the current permutation by composition on the right with a :
new(x) = old(a(x)). The same problem occurs as with inverse.
*/
{
static Permutation c(0);
c.setSize(size());
Permutation& t = *this;
for (SetElt x = 0; x < size(); ++x)
c[x] = t[a[x]];
t.assign(c);
return t;
}
Permutation& Permutation::compose(const Permutation& a)
/*
Increments the current permutation by composition on the left with a :
new(x) = a(old(x)).
*/
{
for (SetElt x = 0; x < size(); ++x)
operator[](x) = a[operator[](x)];
return *this;
}
};
/*****************************************************************************
Chapter II -- The BitMap class.
The following functions are defined for BitMap :
- constructors :
- BitMap(Ulong n);
- ~BitMap() : standard destructor;
- accessors :
- bitCount() : returns the number of set bits;
- firstBit() : returns the bit-address of the first set bit;
- getBit(n) : checks if bit n is set;
- isEmpty(m) : checks if [m,->[ is empty;
- lastBit() : returns the bit-address of the last set bit;
- modifiers :
- assign(map) : sets the bitmap equal to map, resizing if necessary;
- clearBit(n) : clears bit n; (inlined)
- permute(q) : applies q to the bitmap;
- setBit(n) : sets bit n; (inlined)
- setSize(n) : resizes the bitmap to size n;
- operations :
- operator~ () : changes into opposite bitmap;
- operator&= (map) : intersects with map;
- operator|= (map) : does union with map;
- andnot(map) : intersects with the negative of map;
*****************************************************************************/
namespace bits {
/********** constructors and destructors *************************************/
BitMap::BitMap(const Ulong& n)
:d_map(n/BITS(LFlags)+(bool)(n%BITS(LFlags))), d_size(n)
/*
Constructor for the BitMap class; constructs a bitmap capable of
holding n bits.
*/
{
d_map.setSize(n/BITS(LFlags)+(bool)(n%BITS(LFlags)));
}
BitMap::~BitMap()
/*
No memory is directly allocated by BitMap.
*/
{}
/********** accessors ********************************************************/
Ulong BitMap::bitCount() const
/*
Returns the number of set bits in the bitmap.
*/
{
Ulong count = 0;
for (Ulong j = 0; j < d_map.size(); ++j)
count += bits::bitCount(d_map[j]);
return count;
}
Ulong BitMap::firstBit() const
/*
Returns the bit position of the first set bit.
NOTE : this looks totally wrong!
*/
{
Ulong first = 0;
LFlags f = (LFlags)1;
for (Ulong j = 0; j < d_map.size(); ++j) {
if (d_map[j]) { /* first bit found */
f = d_map[j];
return f;
}
else
first += BITS(LFlags);
}
return first + bits::firstBit(f);
}
bool BitMap::isEmpty(const Ulong& m) const
/*
This function checks whether the intersection of the bitmap with the
interval [m,size[ is empty
*/
{
Ulong lsize = d_size/BITS(LFlags)+(bool)(d_size%BITS(LFlags));
/* look at word containing m */
Ulong ml = m/BITS(LFlags);
Ulong mr = m%BITS(LFlags);
Ulong mc = BITS(LFlags)-1 - mr;
LFlags f = leqmask[mc] << mr;
if (d_map[ml]&f)
return(false);
for (Ulong j = ml+1; j < lsize; ++j) {
if (d_map[j])
return false;
}
return true;
}
Ulong BitMap::lastBit() const
/*
This function returns the bit-address of the last set bit in b. The
return value is b.size() if b is empty.
*/
{
if (d_size == 0)
return 0;
Ulong base = (d_size-1)/BITS(LFlags)+1;
while(base) {
base--;
LFlags f = d_map[base];
if (f)
return (base*BITS(LFlags)+constants::lastBit(f));
}
/* if we reach this point, the bitmap is empty */
return (d_size);
}
/********** modifiers ********************************************************/
BitMap& BitMap::assign(const BitMap& map)
/*
Copies the content of map into the current map.
*/
{
d_map.assign(map.d_map);
d_size = map.d_size;
return *this;
}
void BitMap::permute(Permutation& q)
/*
This function applies the permutation q to the bitmap b. Here b is
interpreted as a bool-valued table; we want that b[q[x]] hold the
value previously held by b[x]. This is a range-permutation, as
explained in kl.cpp.
*/
{
static BitMap b(0);
b.setSize(q.size());
b.reset();
for (Ulong i = 0; i < d_size; ++i) {
if (b.getBit(i))
continue;
for (Ulong j = q[i]; j != i; j = q[j]) {
bool t = getBit(j);
setBit(j,getBit(i));
setBit(i,t);
b.setBit(j);
}
b.setBit(i);
}
return;
}
void BitMap::setSize(const Ulong& n)
/*
Resizes the bitmap to hold n bits. If the size grows, it is guaranteed
that the new bits are set to zero.
*/
{
d_map.setSize(n/BITS(LFlags) + (bool)(n%BITS(LFlags)));
if (n > size()) { /* set new bits to zero */
Ulong f = size()/BITS(LFlags); /* word holding first new bit */
Ulong fb = size()%BITS(LFlags); /* bit address of first new bit in f */
LFlags old = ((1L << fb) - 1L); /* flags old bits */
d_map[f] &= old;
d_map.setZero(f+1,d_map.size()-f-1);
}
d_size = n;
}
/********** operators ********************************************************/
void BitMap::operator~ ()
/*
Transforms the bitmap into its complement. One has to be careful not to
exceed the size of the bitmap!
*/
{
for (Ulong j = 0; j < d_map.size(); ++j)
d_map[j] = ~d_map[j];
d_map[d_map.size()-1] &= lastchunk();
return;
}
void BitMap::operator&= (const BitMap& map)
/*
Does the bitwise intersection with map. It is assumed that map has at
least size size().
*/
{
for (Ulong j = 0; j < d_map.size(); ++j)
d_map[j] &= map.chunk(j);
return;
}
void BitMap::operator|= (const BitMap& map)
/*
Does the bitwise union with map. It is assumed that map has at
least size size().
*/
{
for (Ulong j = 0; j < d_map.size(); ++j)
d_map[j] |= map.chunk(j);
return;
}
void BitMap::andnot(const BitMap& map)
/*
Does the bitwise intersection with ~map. It is assumed that map has at
least size size().
*/
{
for (Ulong j = 0; j < d_map.size(); ++j)
d_map[j] &= ~(map.chunk(j));
return;
}
};
/****************************************************************************
Chapter III -- The Iterator class.
This is my first attempt at an STL-style iterator. I'm not trying to
stick exactly to the stl-notation and requirements, but I hope to be
in the right spirit. The Iterator class for bitmaps is bidirectional;
it traverses the set bits for the bitmap.
The only constructors are for begin() (an iterator pointing to the first
non-zero element) and end (a non-dereferenceable, past-the-end iterator.)
It is guaranteed that begin() == end() if the bitmap is empty (i.e.
bitCount returns zero.)
The data in the Iterator class have the following meaning. Recall that
a BitMap is implemented as a list of LFlags. There is a current such
LFlag, which is pointed by d_chunk; d_bitAddress is the bit address
of the current set bit. The past-the-end iterator is the one with
bitAddress equal to the size of the bitmap.
The following functions are defined :
- Iterator(const BitMap&, bool) : constructs begin() if true, end() if
false;
- operator* () : returns the position of the current bit;
- operator++ () : moves to the next set bit, or past-the-end;
- operator-- () : moves to the previous set bit (valid if iterator is
not begin());
- operator== (i) : says if the two iterators point to the same bit-address;
(inlined);
- operator!= (i) : the negation of operator==.
****************************************************************************/
namespace bits {
BitMap::Iterator::Iterator()
{}
BitMap::Iterator::Iterator(const BitMap& b)
:d_b(&b)
/*
Constructs begin().
*/
{
d_chunk = d_b->d_map.ptr();
d_bitAddress = 0;
for (d_bitAddress = 0; d_bitAddress < d_b->size();
d_bitAddress += BITS(LFlags)) {
if (*d_chunk) {
d_bitAddress += bits::firstBit(*d_chunk);
break;
}
++d_chunk;
}
if (d_bitAddress > d_b->size()) /* bitmap was empty */
d_bitAddress = d_b->size();
}
BitMap::Iterator::~Iterator()
/*
Automatic destruction is enough.
*/
{}
BitMap::Iterator& BitMap::Iterator::operator++ ()
/*
Increment operator (prefix notation). Valid if the iterator is
dereferenceable. Result is dereferenceable or past-the-end.
*/
{
LFlags f = *d_chunk >> bitPos();
f >>= 1;
if (f) {
d_bitAddress += bits::firstBit(f)+1;
}
else { /* go to next chunk */
d_bitAddress &= baseBits;
++d_chunk;
for (d_bitAddress += BITS(LFlags) ; d_bitAddress < d_b->size();
d_bitAddress += BITS(LFlags)) {
if (*d_chunk) {
d_bitAddress += bits::firstBit(*d_chunk);
break;
}
++d_chunk;
}
if (d_bitAddress > d_b->size())
d_bitAddress = d_b->size();
}
return *this;
}
BitMap::Iterator& BitMap::Iterator::operator-- ()
/*
Decrement operator (prefix notation). Valid if the iterator is past-the-end,
or is dereferenceable and not equal to begin().
*/
{
LFlags f = 0;
if (bitPos()) {
f = *d_chunk & leqmask[bitPos()-1];
}
if (f) {
d_bitAddress &= baseBits;
d_bitAddress += bits::lastBit(f);
}
else { /* go to previous chunk */
d_bitAddress &= baseBits;
while (d_bitAddress) {
d_bitAddress -= BITS(LFlags);
--d_chunk;
if (*d_chunk) {
d_bitAddress += bits::lastBit(*d_chunk);
break;
}
}
}
return *this;
}
BitMap::Iterator BitMap::begin() const
/*
Returns
*/
{
static Iterator i;
new(&i) Iterator(*this);
return i;
}
BitMap::Iterator BitMap::end() const
{
static Iterator i;
i.d_b = this;
i.d_bitAddress = d_size;
i.d_chunk = d_map.ptr()+d_map.size();
if (i.bitPos())
i.d_chunk--;
return i;
}
};
/****************************************************************************
Chapter IV -- The Partition class
A partition of a set is represented by a function of the set to the range
[0,N[, where N is the number of classes in the partition. Moreover it
is useful to have direct access to the number of classes.
The following functions are defined :
- constructors and destructors :
- Partition();
- Partition(n) : constructs a partition with a list of size n;
- ~Partition() (inlined);
- accessors :
- classCount() : returns the number of classes; (inlined)
- sort(v) : returns a permutation vector of the set, so that classes
are contiguous and sorted in their original order;
- writeClass(b,n) : sets b to hold class #n;
- modifiers :
- normalize() : normalizes the permutation;
- normalize(a) : writes the normalizing permutation in a;
- permute(a) : permutes the partition according to a;
- setClassCount(n) : sets the number of classes to n;
- setClassCount() : fill in the number of classes;
- input/output :
- printClassSizes(file) : prints the sizes of the classes;
NOTE : this class really has nothing to do with bits. It should probably
be moved to another module (maybe sort.h, or sets.h ?)
****************************************************************************/
namespace bits {
Partition::Partition()
{}
Partition::Partition(const Ulong &n):d_list(n),d_classCount(0)
{
d_list.setSize(n);
}
Partition::~Partition()
/*
No memory is directly allocated by the Partition constructors.
*/
{}
/******* accessors **********************************************************/
void Partition::sort(Permutation& a) const
/*
Puts in a the permutation vector for which the classes are contiguous,
in increasing order, and each class is in the enumeration order of the
original set. In other words, we have new[a[j]] = old[j].
We do this by counting each class, then putting each element directly
in its right place in a.
*/
{
if (size() == 0)
return;
static List<Ulong> count(0);
/* count class cardinalities */
count.setSize(d_classCount);
count.setZero();
for (Ulong j = 0; j < size(); ++j) {
count[d_list[j]]++;
}
/* put class offsets in count */
count.setData(count.ptr(),1,count.size()-1);
for (Ulong j = 2; j < count.size(); ++j)
count[j] += count[j-1];
count[0] = 0;
/* fill permutation */
a.setSize(size());
for (Ulong j = 0; j < size(); ++j) {
Ulong k = d_list[j];
a[j] = count[k];
count[k]++;
}
}
void Partition::sortI(Permutation& a) const
/*
Like sort, but returns the inverse permutation directly. This is in fact
used more frequently then sort, because the permutation returned by shortI
is the one we need for the traversal of the classes.
Here we have new[j] = old[a[j]].
*/
{
if (size() == 0)
return;
static List<Ulong> count(0);
/* count class cardinalities */
count.setSize(d_classCount);
count.setZero();
for (Ulong j = 0; j < size(); ++j) {
count[d_list[j]]++;
}
/* put class offsets in count */
count.setData(count.ptr(),1,count.size()-1);
for (Ulong j = 2; j < count.size(); ++j)
count[j] += count[j-1];
count[0] = 0;
/* fill permutation */
a.setSize(size());
for (Ulong j = 0; j < size(); ++j) {
Ulong k = d_list[j];
a[count[k]] = j;
count[k]++;
}
}
void Partition::writeClass(BitMap& b, const Ulong& n) const
/*
This function sets the bitmap to the bitmap of class #n. It is assumed
that b.size() is equal to size().
*/
{
b.reset();
for (Ulong j = 0; j < size(); ++j) {
if (d_list[j] == n)
b.setBit(j);
}
return;
}
/******* modifiers **********************************************************/
void Partition::normalize()
/*
Normalizes the partition by reordering the classes in the order of their
first elements. Hence, two normalized partitions are equal as partitions
iff they are equal as functions.
*/
{
static List<Ulong> a(0);
static BitMap b(0);
a.setSize(d_classCount);
b.setSize(d_classCount);
b.reset();
Ulong count = 0;
for (Ulong j = 0; j < size(); ++j) {
if (!b.getBit(d_list[j])) { /* new value */
b.setBit(d_list[j]);
a[d_list[j]] = count;
count++;
}
}
/* now a[k] is the order of appearance of value #k */
for (Ulong j = 0; j < size(); ++j) {
d_list[j] = a[d_list[j]];
}
return;
}
void Partition::normalize(Permutation& a)
/*
Same as normalize(), but records the permutation in a.
*/
{
static BitMap b(0);
a.setSize(d_classCount);
b.setSize(d_classCount);
b.reset();
Ulong count = 0;
for (Ulong j = 0; j < size(); ++j) {
if (!b.getBit(d_list[j])) { /* new value */
b.setBit(d_list[j]);
a[d_list[j]] = count;
count++;
}
}
/* now a[k] is the order of appearance of value #k */
for (Ulong j = 0; j < size(); ++j) {
d_list[j] = a[d_list[j]];
}
return;
}
void Partition::permute(const Permutation& a)
/*
Permutes the partition according to a (i.e., apply a to the domain of
the partition function.)
*/
{
static BitMap b(0);
b.setSize(size());
b.reset();
for (SetElt x = 0; x < size(); ++x) {
if (b.getBit(x))
continue;
for (SetElt y = a[x]; y != x; y = a[y]) {
Ulong buf = d_list[y];
d_list[y] = d_list[x];
d_list[x] = buf;
b.setBit(y);
}
b.setBit(x);
}
return;
}
void Partition::permuteRange(const Permutation& a)
/*
Applies the permutation a to the range of the partition function.
*/
{
for (SetElt x = 0; x < size(); ++x)
d_list[x] = a[d_list[x]];
return;
}
void Partition::setClassCount()
/*
Finds the number of classes.
*/
{
Ulong count = 0;
for (Ulong j = 0; j < size(); ++j) {
if (d_list[j] >= count)
count = d_list[j]+1;
}
d_classCount = count;
return;
}
/******** input/output ******************************************************/
void Partition::printClassSizes(FILE* file) const
/*
This function prints out the sizes of the classes in the partition.
*/
{
static List<Ulong> count(0);
count.setSize(d_classCount);
count.setZero();
for (Ulong j = 0; j < size(); ++j) {
count[d_list[j]]++;
}
for (Ulong j = 0; j < d_classCount; ++j) {
fprintf(file,"%lu",count[j]);
if (j < d_classCount-1)
fprintf(file,",");
}
fprintf(file,"\n");
return;
}
};
/****************************************************************************
Chapter V -- The PartitionIterator class.
This class is intended for the convenient traversal of a partition. At
each iteration, a new class is provided as a list (maybe this should
become a SubSet ?). To do this conveniently, a permutation d_a is used
to sort the partition by contiguous classes. The current class is
kept in d_class.
****************************************************************************/
namespace bits {
PartitionIterator::PartitionIterator(const Partition& pi)
:d_pi(pi),d_a(pi.size()),d_class(0),d_base(0),d_valid(true)
/*
*/
{
if (pi.size() == 0) {
d_valid = false;
goto done;
}
{
d_a.setSize(pi.size());
pi.sortI(d_a);
/* load first class */
Ulong j = 0;
for (; (j < d_a.size()) && (d_pi(d_a[j]) == d_pi(d_a[d_base])); ++j) {
d_class.append(d_a[j]);
}
}
done:
;
}
PartitionIterator::~PartitionIterator()
/*
Automatic destruction suffices.
*/
{}
void PartitionIterator::operator++ ()
{
d_base += d_class.size();
if (d_base == d_pi.size()) {
d_valid = false;
return;
}
Ulong j = d_base;
d_class.setSize(0);
for (; (j < d_a.size()) && (d_pi(d_a[j]) == d_pi(d_a[d_base])); ++j) {
d_class.append(d_a[j]);
}
}
};
/****************************************************************************
Chapter VI -- The SubSet class.
The SubSet class is designed to hold subsets of enumerated sets. Typically,
we will want to know which elements are in the subset, and also, to have
a quick way of deciding whether an arbitrary element is in it.