Changeset ffb732 in git
 Timestamp:
 Aug 26, 2014, 12:17:46 PM (9 years ago)
 Branches:
 (u'spielwiese', '91e5db82acc17434e4062bcfa44e6efa7d41fd30')
 Children:
 d1a30265ddb8a7ddc9d68bb7a60e37212c7f06b0
 Parents:
 8b7b108474a7f7dcc5bffc2636ab9027c6131d3d
 gitauthor:
 Martin Lee <martinlee84@web.de>20140826 12:17:46+02:00
 gitcommitter:
 Martin Lee <martinlee84@web.de>20140826 12:29:12+02:00
 Location:
 factory
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

factory/cfCharSets.cc
r8b7b108 rffb732 437 437 l= tmp.getFirst(); 438 438 439 tmp= minus (tmp, l);439 tmp= Difference (tmp, l, operator==); 440 440 441 441 select (ppi, l.length(), ppi1, ppi2); … … 444 444 445 445 if (count > 0) 446 ppi= MyUnion (ListCFList (l), ppi1);446 ppi= Union (ppi1, ListCFList (l), operator==); 447 447 else 448 448 ppi= ListCFList(); … … 455 455 if (charset.length() > 0 && charset.getFirst().level() > 0) 456 456 { 457 result= MyUnion (result, ListCFList (charset));457 result= Union (ListCFList (charset), result, operator==); 458 458 ini= factorsOfInitials (charset); 459 459 … … 468 468 469 469 tmp2= adjoin (ini, l, qqi); 470 tmp= MyUnion (tmp, tmp2);470 tmp= Union (tmp2, tmp, operator==); 471 471 472 472 StoredFactors.FS1= CFList(); … … 616 616 { 617 617 nr_of_iteration += 1; 618 ppi= MyUnion (ListCFList (qs), ppi1);618 ppi= Union (ppi1, ListCFList (qs), operator==); 619 619 } 620 620 … … 636 636 if (!isSubset (cs,qs)) 637 637 cs= charSetViaCharSetN (Union (qs,cs)); 638 if (! isMember (cs, pi))638 if (!find (pi, cs, operator==)) 639 639 { 640 pi= MyUnion (pi, ListCFList (cs));640 pi= Union (ListCFList (cs), pi, operator==); 641 641 if (cs.getFirst().level() > 0) 642 642 { … … 645 645 if (indexRed <= 0) //irreducible 646 646 { 647 qsi= MyUnion (qsi, ListCFList(cs));647 qsi= Union (ListCFList(cs), qsi, operator==); 648 648 if (cs.length() == highestlevel) 649 649 is= factorPSet (factorset); … … 674 674 } 675 675 is= Union (factorsOfInitials (cst), is); 676 iss= MyUnion (adjoin (is, qs, qqi), adjoinb (ts, qs, qqi, cst));676 iss= Union (adjoinb (ts, qs, qqi, cst), adjoin (is, qs, qqi), operator==); 677 677 } 678 678 else … … 685 685 { 686 686 qhi.removeFirst(); 687 qhi= MyUnion (qhi, iss);687 qhi= Union (iss, qhi, operator==); 688 688 } 689 689 else 
factory/cfCharSetsUtil.cc
r8b7b108 rffb732 457 457 458 458 /* basic operations on lists */ 459 460 bool461 isMember (const CanonicalForm& f, const CFList& F)462 {463 for (CFListIterator i= F; i.hasItem(); i++)464 {465 if (i.getItem().mapinto() == f.mapinto())466 return 1;467 }468 return 0;469 }470 471 /// are list A and B the same?472 bool473 isSame (const CFList& A, const CFList& B)474 {475 if (A.length() != B.length())476 return 0;477 478 CFListIterator i;479 480 for (i= A; i.hasItem(); i++)481 {482 if (!isMember (i.getItem(), B))483 return 0;484 }485 for (i= B; i.hasItem(); i++)486 {487 if (!isMember (i.getItem(), A))488 return 0;489 }490 return 1;491 }492 493 494 /// is List cs contained in List of lists pi?495 bool496 isMember (const CFList& cs, const ListCFList& pi)497 {498 if (pi.isEmpty())499 return 0;500 501 ListCFListIterator i;502 503 for (i= pi; i.hasItem(); i++)504 {505 if (i.getItem().length() != cs.length())506 continue;507 if (isSame (cs, i.getItem()))508 return 1;509 }510 return 0;511 }512 513 459 /// is PS a subset of Cset ? 514 460 bool … … 517 463 for (CFListIterator i= PS; i.hasItem(); i++) 518 464 { 519 if (! isMember (i.getItem(), Cset))465 if (!find (Cset, i.getItem())) 520 466 return 0; 521 467 } 522 468 return 1; 523 }524 525 /// Union of two List of Lists526 ListCFList527 MyUnion (const ListCFList& a, const ListCFList& b)528 {529 if (a.isEmpty())530 return b;531 if (b.isEmpty())532 return a;533 534 ListCFList output;535 ListCFListIterator i;536 CFList elem;537 538 for (i= a; i.hasItem(); i++)539 {540 elem= i.getItem();541 if ((!elem.isEmpty()) && (!isMember (elem, output)))542 output.append(elem);543 }544 545 for (i= b; i.hasItem(); i++)546 {547 elem= i.getItem();548 if ((!elem.isEmpty()) && (!isMember (elem, output)))549 output.append(elem);550 }551 return output;552 469 } 553 470 … … 570 487 { 571 488 elem= i.getItem(); 572 if ((!elem.isEmpty()) && (! isMember (elem, b)))489 if ((!elem.isEmpty()) && (!find (b, elem, operator==))) 573 490 b.insert(elem); 574 491 } 575 }576 577 ///if list b is member of the list of lists a remove b and return the rest578 ListCFList579 minus (const ListCFList& a, const CFList& b)580 {581 ListCFList output;582 ListCFListIterator i;583 CFList elem;584 585 for (i= a; i.hasItem(); i++)586 {587 elem= i.getItem();588 if ((!elem.isEmpty()) && (!isSame (elem, b)))589 output.append (elem);590 }591 return output;592 }593 594 /// remove all elements of b from list of lists a and return the rest595 ListCFList596 minus (const ListCFList& a, const ListCFList& b)597 {598 ListCFList output= a;599 600 for (ListCFListIterator i= b; i.hasItem(); i++)601 output = minus (output, i.getItem());602 603 return output;604 492 } 605 493 … … 621 509 return iss; 622 510 623 qhi= minus (qh, qs);511 qhi= Difference (qh, qs, operator==); 624 512 length= qhi.length(); 625 513 … … 659 547 if (iscopy.isEmpty()) 660 548 return iss; 661 qhi= minus (qh, qs);549 qhi= Difference (qh, qs, operator==); 662 550 length= qhi.length(); 663 551 for (i= iscopy; i.hasItem(); i++) … … 1052 940 { 1053 941 iitem= i.getItem(); 1054 if (! isMember (iitem, mem))942 if (!find (mem, iitem, operator==)) 1055 943 { 1056 944 j= i; … … 1059 947 { 1060 948 jitem= j.getItem(); 1061 if (! isMember (jitem, mem))949 if (!find (mem, jitem, operator==)) 1062 950 { 1063 951 if (contractsub (iitem, jitem)) … … 1075 963 } 1076 964 } 1077 return minus (cs,ts);1078 } 1079 965 return Difference (cs,ts, operator==); 966 } 967 
factory/cfCharSetsUtil.h
r8b7b108 rffb732 101 101 102 102 bool 103 isMember (const CFList& cs, const ListCFList& pi);104 105 bool106 103 isSubset (const CFList &PS, const CFList& Cset); 107 108 ListCFList109 minus (const ListCFList& a, const CFList& b);110 104 111 105 ListCFList … … 115 109 adjoinb (const CFList & is, const CFList & qs, const ListCFList & qh, 116 110 const CFList & cs); 117 118 ListCFList119 MyUnion (const ListCFList& a, const ListCFList& b);120 111 121 112 void
Note: See TracChangeset
for help on using the changeset viewer.