Changeset 5a1c78 in git
 Timestamp:
 Jan 15, 2017, 3:36:48 PM (6 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '5bec8f88c9ee2573d328cf7c3aff2bcb301d2395')
 Children:
 8ed7dc85f8531614409ce9273f8b59ae49fce769
 Parents:
 e85feda0c40361dfe1754b7c0fa791e33c600e71
 Location:
 Singular/dyn_modules/gfanlib
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

Singular/dyn_modules/gfanlib/bbcone.cc
re85fed r5a1c78 357 357 if ((u != NULL) && ((u>Typ() == BIGINTMAT_CMD)  (u>Typ() == INTMAT_CMD))) 358 358 { 359 if (u>next == NULL) return jjCONENORMALS1(res, u); 359 if (u>next == NULL) 360 { 361 BOOLEAN bo = jjCONENORMALS1(res, u); 362 gfan::deinitializeCddlibIfRequired(); 363 return bo; 364 } 360 365 } 361 366 leftv v = u>next; 362 367 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTMAT_CMD))) 363 368 { 364 if (v>next == NULL) return jjCONENORMALS2(res, u, v); 369 if (v>next == NULL) 370 { 371 BOOLEAN bo = jjCONENORMALS2(res, u, v); 372 gfan::deinitializeCddlibIfRequired(); 373 return bo; 374 } 365 375 } 366 376 leftv w = v>next; 367 377 if ((w != NULL) && (w>Typ() == INT_CMD)) 368 378 { 369 if (w>next == NULL) return jjCONENORMALS3(res, u, v, w); 379 if (w>next == NULL) 380 { 381 BOOLEAN bo = jjCONENORMALS3(res, u, v, w); 382 gfan::deinitializeCddlibIfRequired(); 383 return bo; 384 } 370 385 } 371 386 WerrorS("coneViaInequalities: unexpected parameters"); … … 513 528 if ((u != NULL) && ((u>Typ() == BIGINTMAT_CMD)  (u>Typ() == INTMAT_CMD))) 514 529 { 515 if (u>next == NULL) return jjCONERAYS1(res, u); 530 if (u>next == NULL) 531 { 532 BOOLEAN bo = jjCONERAYS1(res, u); 533 gfan::deinitializeCddlibIfRequired(); 534 return bo; 535 } 516 536 leftv v = u>next; 517 537 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTMAT_CMD))) 518 538 { 519 if (v>next == NULL) return jjCONERAYS2(res, u, v); 539 if (v>next == NULL) 540 { 541 BOOLEAN bo = jjCONERAYS2(res, u, v); 542 gfan::deinitializeCddlibIfRequired(); 543 return bo; 544 } 520 545 leftv w = v>next; 521 546 if ((w != NULL) && (w>Typ() == INT_CMD)) 522 547 { 523 if (w>next == NULL) return jjCONERAYS3(res, u, v, w); 548 if (w>next == NULL) 549 { 550 BOOLEAN bo = jjCONERAYS3(res, u, v, w); 551 gfan::deinitializeCddlibIfRequired(); 552 return bo; 553 } 524 554 } 525 555 } … … 531 561 BOOLEAN inequalities(leftv res, leftv args) 532 562 { 533 gfan::initializeCddlibIfRequired();534 563 leftv u = args; 535 564 if ((u != NULL) && (u>Typ() == coneID  u>Typ() == polytopeID)) 536 565 { 537 gfan:: ZCone* zc = (gfan::ZCone*)u>Data();538 566 gfan::initializeCddlibIfRequired(); 567 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 539 568 gfan::ZMatrix zmat = zc>getInequalities(); 540 569 res>rtyp = BIGINTMAT_CMD; 541 570 res>data = (void*) zMatrixToBigintmat(zmat); 571 gfan::deinitializeCddlibIfRequired(); 542 572 return FALSE; 543 573 } … … 548 578 BOOLEAN equations(leftv res, leftv args) 549 579 { 550 gfan::initializeCddlibIfRequired();551 580 leftv u = args; 552 581 if ((u != NULL) && (u>Typ() == coneID  u>Typ() == polytopeID)) 553 582 { 583 gfan::initializeCddlibIfRequired(); 554 584 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 555 585 gfan::ZMatrix zmat = zc>getEquations(); 556 586 res>rtyp = BIGINTMAT_CMD; 557 587 res>data = (void*) zMatrixToBigintmat(zmat); 588 gfan::deinitializeCddlibIfRequired(); 558 589 return FALSE; 559 590 } … … 564 595 BOOLEAN facets(leftv res, leftv args) 565 596 { 566 gfan::initializeCddlibIfRequired();567 597 leftv u = args; 568 598 if ((u != NULL) && (u>Typ() == coneID  u>Typ() == polytopeID)) 569 599 { 600 gfan::initializeCddlibIfRequired(); 570 601 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 571 602 gfan::ZMatrix zm = zc>getFacets(); 572 603 res>rtyp = BIGINTMAT_CMD; 573 604 res>data = (void*) zMatrixToBigintmat(zm); 605 gfan::deinitializeCddlibIfRequired(); 574 606 return FALSE; 575 607 } … … 580 612 BOOLEAN impliedEquations(leftv res, leftv args) 581 613 { 582 gfan::initializeCddlibIfRequired();583 614 leftv u = args; 584 615 if ((u != NULL) && (u>Typ() == coneID  u>Typ() == polytopeID)) 585 616 { 617 gfan::initializeCddlibIfRequired(); 586 618 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 587 619 gfan::ZMatrix zmat = zc>getImpliedEquations(); 588 620 res>rtyp = BIGINTMAT_CMD; 589 621 res>data = (void*) zMatrixToBigintmat(zmat); 622 gfan::deinitializeCddlibIfRequired(); 590 623 return FALSE; 591 624 } … … 596 629 BOOLEAN generatorsOfSpan(leftv res, leftv args) 597 630 { 598 gfan::initializeCddlibIfRequired();599 631 leftv u = args; 600 632 if ((u != NULL) && (u>Typ() == coneID  u>Typ() == polytopeID)) 601 633 { 634 gfan::initializeCddlibIfRequired(); 602 635 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 603 636 gfan::ZMatrix zmat = zc>generatorsOfSpan(); 604 637 res>rtyp = BIGINTMAT_CMD; 605 638 res>data = (void*) zMatrixToBigintmat(zmat); 639 gfan::deinitializeCddlibIfRequired(); 606 640 return FALSE; 607 641 } … … 612 646 BOOLEAN generatorsOfLinealitySpace(leftv res, leftv args) 613 647 { 614 gfan::initializeCddlibIfRequired();615 648 leftv u = args; 616 649 if ((u != NULL) && (u>Typ() == coneID  u>Typ() == polytopeID)) 617 650 { 651 gfan::initializeCddlibIfRequired(); 618 652 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 619 653 gfan::ZMatrix zmat = zc>generatorsOfLinealitySpace(); 620 654 res>rtyp = BIGINTMAT_CMD; 621 655 res>data = (void*) zMatrixToBigintmat(zmat); 656 gfan::deinitializeCddlibIfRequired(); 622 657 return FALSE; 623 658 } … … 628 663 BOOLEAN rays(leftv res, leftv args) 629 664 { 630 gfan::initializeCddlibIfRequired();631 leftv u = args;632 if ((u != NULL) && (u>Typ() == coneID))633 {665 leftv u = args; 666 if ((u != NULL) && (u>Typ() == coneID)) 667 { 668 gfan::initializeCddlibIfRequired(); 634 669 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 635 670 gfan::ZMatrix zm = zc>extremeRays(); 636 671 res>rtyp = BIGINTMAT_CMD; 637 672 res>data = (void*)zMatrixToBigintmat(zm); 673 gfan::deinitializeCddlibIfRequired(); 638 674 return FALSE; 639 675 } 640 676 if ((u != NULL) && (u>Typ() == fanID)) 641 677 { 678 gfan::initializeCddlibIfRequired(); 642 679 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 643 680 gfan::ZMatrix zmat = rays(zf); 644 681 res>rtyp = BIGINTMAT_CMD; 645 682 res>data = (void*) zMatrixToBigintmat(zmat); 683 gfan::deinitializeCddlibIfRequired(); 646 684 return FALSE; 647 685 } … … 652 690 BOOLEAN quotientLatticeBasis(leftv res, leftv args) 653 691 { 654 gfan::initializeCddlibIfRequired();655 leftv u = args;656 if ((u != NULL) && (u>Typ() == coneID))657 {692 leftv u = args; 693 if ((u != NULL) && (u>Typ() == coneID)) 694 { 695 gfan::initializeCddlibIfRequired(); 658 696 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 659 697 gfan::ZMatrix zmat = zc>quotientLatticeBasis(); 660 698 res>rtyp = BIGINTMAT_CMD; 661 699 res>data = (void*) zMatrixToBigintmat(zmat); 700 gfan::deinitializeCddlibIfRequired(); 662 701 return FALSE; 663 702 } … … 668 707 BOOLEAN getLinearForms(leftv res, leftv args) 669 708 { 670 gfan::initializeCddlibIfRequired();671 leftv u = args;672 if ((u != NULL) && (u>Typ() == coneID))673 {709 leftv u = args; 710 if ((u != NULL) && (u>Typ() == coneID)) 711 { 712 gfan::initializeCddlibIfRequired(); 674 713 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 675 714 gfan::ZMatrix zmat = zc>getLinearForms(); 676 715 res>rtyp = BIGINTMAT_CMD; 677 716 res>data = (void*) zMatrixToBigintmat(zmat); 717 gfan::deinitializeCddlibIfRequired(); 678 718 return FALSE; 679 719 } … … 684 724 BOOLEAN ambientDimension(leftv res, leftv args) 685 725 { 686 gfan::initializeCddlibIfRequired();687 726 leftv u=args; 688 727 if ((u != NULL) && (u>Typ() == coneID)) 689 728 { 729 gfan::initializeCddlibIfRequired(); 690 730 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 691 731 res>rtyp = INT_CMD; 692 732 res>data = (void*) (long) zc>ambientDimension(); 733 gfan::deinitializeCddlibIfRequired(); 693 734 return FALSE; 694 735 } 695 736 if ((u != NULL) && (u>Typ() == fanID)) 696 737 { 738 gfan::initializeCddlibIfRequired(); 697 739 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 698 740 res>rtyp = INT_CMD; 699 741 res>data = (void*) (long) getAmbientDimension(zf); 742 gfan::deinitializeCddlibIfRequired(); 700 743 return FALSE; 701 744 } 702 745 if ((u != NULL) && (u>Typ() == polytopeID)) 703 746 { 747 gfan::initializeCddlibIfRequired(); 704 748 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 705 749 res>rtyp = INT_CMD; 706 750 res>data = (void*) (long) getAmbientDimension(zc); 751 gfan::deinitializeCddlibIfRequired(); 707 752 return FALSE; 708 753 } … … 713 758 BOOLEAN dimension(leftv res, leftv args) 714 759 { 715 gfan::initializeCddlibIfRequired();716 760 leftv u=args; 717 761 if ((u != NULL) && (u>Typ() == coneID)) 718 762 { 763 gfan::initializeCddlibIfRequired(); 719 764 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 720 765 res>rtyp = INT_CMD; 721 766 res>data = (void*) (long) zc>dimension(); 767 gfan::deinitializeCddlibIfRequired(); 722 768 return FALSE; 723 769 } 724 770 if ((u != NULL) && (u>Typ() == fanID)) 725 771 { 772 gfan::initializeCddlibIfRequired(); 726 773 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 727 774 res>rtyp = INT_CMD; 728 775 res>data = (void*) (long) getDimension(zf); 776 gfan::deinitializeCddlibIfRequired(); 729 777 return FALSE; 730 778 } 731 779 if ((u != NULL) && (u>Typ() == polytopeID)) 732 780 { 781 gfan::initializeCddlibIfRequired(); 733 782 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 734 783 res>rtyp = INT_CMD; 735 784 res>data = (void*) (long) getDimension(zc); 785 gfan::deinitializeCddlibIfRequired(); 736 786 return FALSE; 737 787 } … … 742 792 BOOLEAN codimension(leftv res, leftv args) 743 793 { 744 gfan::initializeCddlibIfRequired();745 794 leftv u=args; 746 795 if ((u != NULL) && (u>Typ() == coneID)) 747 { 748 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 749 res>rtyp = INT_CMD; 750 res>data = (void*) (long) zc>codimension(); 751 return FALSE; 752 } 796 { 797 gfan::initializeCddlibIfRequired(); 798 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 799 res>rtyp = INT_CMD; 800 res>data = (void*) (long) zc>codimension(); 801 gfan::deinitializeCddlibIfRequired(); 802 return FALSE; 803 } 753 804 if ((u != NULL) && (u>Typ() == fanID)) 754 { 755 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 756 res>rtyp = INT_CMD; 757 res>data = (void*) (long) getCodimension(zf); 758 return FALSE; 759 } 805 { 806 gfan::initializeCddlibIfRequired(); 807 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 808 res>rtyp = INT_CMD; 809 res>data = (void*) (long) getCodimension(zf); 810 gfan::deinitializeCddlibIfRequired(); 811 return FALSE; 812 } 760 813 if ((u != NULL) && (u>Typ() == polytopeID)) 761 { 762 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 763 res>rtyp = INT_CMD; 764 res>data = (void*) (long) getCodimension(zc); 765 return FALSE; 766 } 814 { 815 gfan::initializeCddlibIfRequired(); 816 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 817 res>rtyp = INT_CMD; 818 res>data = (void*) (long) getCodimension(zc); 819 gfan::deinitializeCddlibIfRequired(); 820 return FALSE; 821 } 767 822 WerrorS("getCodimension: unexpected parameters"); 768 823 return TRUE; … … 771 826 BOOLEAN linealityDimension(leftv res, leftv args) 772 827 { 773 gfan::initializeCddlibIfRequired();774 828 leftv u=args; 775 829 if ((u != NULL) && (u>Typ() == coneID)) 776 830 { 831 gfan::initializeCddlibIfRequired(); 777 832 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 778 833 res>rtyp = INT_CMD; 779 834 res>data = (void*) (long) zc>dimensionOfLinealitySpace(); 835 gfan::deinitializeCddlibIfRequired(); 780 836 return FALSE; 781 837 } 782 838 if ((u != NULL) && (u>Typ() == fanID)) 783 839 { 840 gfan::initializeCddlibIfRequired(); 784 841 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 785 842 res>rtyp = INT_CMD; 786 843 res>data = (void*) (long) getLinealityDimension(zf); 844 gfan::deinitializeCddlibIfRequired(); 787 845 return FALSE; 788 846 } … … 793 851 BOOLEAN getMultiplicity(leftv res, leftv args) 794 852 { 795 gfan::initializeCddlibIfRequired();796 leftv u = args;797 if ((u != NULL) && (u>Typ() == coneID))798 {853 leftv u = args; 854 if ((u != NULL) && (u>Typ() == coneID)) 855 { 856 gfan::initializeCddlibIfRequired(); 799 857 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 800 858 number i = integerToNumber(zc>getMultiplicity()); 801 859 res>rtyp = BIGINT_CMD; 802 860 res>data = (void*) i; 861 gfan::deinitializeCddlibIfRequired(); 803 862 return FALSE; 804 863 } … … 809 868 BOOLEAN isOrigin(leftv res, leftv args) 810 869 { 811 gfan::initializeCddlibIfRequired();812 leftv u = args;813 if ((u != NULL) && (u>Typ() == coneID))814 {870 leftv u = args; 871 if ((u != NULL) && (u>Typ() == coneID)) 872 { 873 gfan::initializeCddlibIfRequired(); 815 874 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 816 875 int i = zc>isOrigin(); 817 876 res>rtyp = INT_CMD; 818 877 res>data = (void*) (long) i; 878 gfan::deinitializeCddlibIfRequired(); 819 879 return FALSE; 820 880 } … … 825 885 BOOLEAN isFullSpace(leftv res, leftv args) 826 886 { 827 gfan::initializeCddlibIfRequired();828 leftv u = args;829 if ((u != NULL) && (u>Typ() == coneID))830 {887 leftv u = args; 888 if ((u != NULL) && (u>Typ() == coneID)) 889 { 890 gfan::initializeCddlibIfRequired(); 831 891 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 832 892 int i = zc>isFullSpace(); 833 893 res>rtyp = INT_CMD; 834 894 res>data = (void*) (long) i; 895 gfan::deinitializeCddlibIfRequired(); 835 896 return FALSE; 836 897 } … … 841 902 BOOLEAN isSimplicial(leftv res, leftv args) 842 903 { 843 gfan::initializeCddlibIfRequired();844 904 leftv u=args; 845 905 if ((u != NULL) && (u>Typ() == coneID)) 846 906 { 907 gfan::initializeCddlibIfRequired(); 847 908 gfan::ZCone* zc = (gfan::ZCone*) u>Data(); 848 909 int b = zc>isSimplicial(); 849 910 res>rtyp = INT_CMD; 850 911 res>data = (void*) (long) b; 912 gfan::deinitializeCddlibIfRequired(); 851 913 return FALSE; 852 914 } 853 915 if ((u != NULL) && (u>Typ() == fanID)) 854 916 { 917 gfan::initializeCddlibIfRequired(); 855 918 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 856 919 bool b = isSimplicial(zf); 857 920 res>rtyp = INT_CMD; 858 921 res>data = (void*) (long) b; 922 gfan::deinitializeCddlibIfRequired(); 859 923 return FALSE; 860 924 } … … 865 929 BOOLEAN containsPositiveVector(leftv res, leftv args) 866 930 { 867 gfan::initializeCddlibIfRequired();868 leftv u = args;869 if ((u != NULL) && (u>Typ() == coneID))870 {931 leftv u = args; 932 if ((u != NULL) && (u>Typ() == coneID)) 933 { 934 gfan::initializeCddlibIfRequired(); 871 935 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 872 936 int i = zc>containsPositiveVector(); 873 937 res>rtyp = INT_CMD; 874 938 res>data = (void*) (long) i; 939 gfan::deinitializeCddlibIfRequired(); 875 940 return FALSE; 876 941 } … … 881 946 BOOLEAN linealitySpace(leftv res, leftv args) 882 947 { 883 gfan::initializeCddlibIfRequired();884 leftv u = args;885 if ((u != NULL) && (u>Typ() == coneID))886 {948 leftv u = args; 949 if ((u != NULL) && (u>Typ() == coneID)) 950 { 951 gfan::initializeCddlibIfRequired(); 887 952 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 888 953 gfan::ZCone* zd = new gfan::ZCone(zc>linealitySpace()); 889 954 res>rtyp = coneID; 890 955 res>data = (void*) zd; 956 gfan::deinitializeCddlibIfRequired(); 891 957 return FALSE; 892 958 } … … 897 963 BOOLEAN dualCone(leftv res, leftv args) 898 964 { 899 gfan::initializeCddlibIfRequired();900 leftv u = args;901 if ((u != NULL) && (u>Typ() == coneID))902 {965 leftv u = args; 966 if ((u != NULL) && (u>Typ() == coneID)) 967 { 968 gfan::initializeCddlibIfRequired(); 903 969 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 904 970 gfan::ZCone* zd = new gfan::ZCone(zc>dualCone()); 905 971 res>rtyp = coneID; 906 972 res>data = (void*) zd; 973 gfan::deinitializeCddlibIfRequired(); 907 974 return FALSE; 908 975 } … … 913 980 BOOLEAN negatedCone(leftv res, leftv args) 914 981 { 915 gfan::initializeCddlibIfRequired();916 leftv u = args;917 if ((u != NULL) && (u>Typ() == coneID))918 {982 leftv u = args; 983 if ((u != NULL) && (u>Typ() == coneID)) 984 { 985 gfan::initializeCddlibIfRequired(); 919 986 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 920 987 gfan::ZCone* zd = new gfan::ZCone(zc>negated()); 921 988 res>rtyp = coneID; 922 989 res>data = (void*) zd; 990 gfan::deinitializeCddlibIfRequired(); 923 991 return FALSE; 924 992 } … … 929 997 BOOLEAN semigroupGenerator(leftv res, leftv args) 930 998 { 931 gfan::initializeCddlibIfRequired();932 leftv u = args;933 if ((u != NULL) && (u>Typ() == coneID))934 {999 leftv u = args; 1000 if ((u != NULL) && (u>Typ() == coneID)) 1001 { 1002 gfan::initializeCddlibIfRequired(); 935 1003 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 936 1004 int d = zc>dimension(); … … 941 1009 res>rtyp = BIGINTMAT_CMD; 942 1010 res>data = (void*) zVectorToBigintmat(zv); 1011 gfan::deinitializeCddlibIfRequired(); 943 1012 return FALSE; 944 1013 } 1014 gfan::deinitializeCddlibIfRequired(); 945 1015 Werror("expected dim of cone one larger than dim of lin space\n" 946 1016 "but got dimensions %d and %d", d, dLS); … … 952 1022 BOOLEAN relativeInteriorPoint(leftv res, leftv args) 953 1023 { 954 gfan::initializeCddlibIfRequired();955 leftv u = args;956 if ((u != NULL) && (u>Typ() == coneID))957 {1024 leftv u = args; 1025 if ((u != NULL) && (u>Typ() == coneID)) 1026 { 1027 gfan::initializeCddlibIfRequired(); 958 1028 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 959 1029 gfan::ZVector zv = zc>getRelativeInteriorPoint(); 960 1030 res>rtyp = BIGINTMAT_CMD; 961 1031 res>data = (void*) zVectorToBigintmat(zv); 1032 gfan::deinitializeCddlibIfRequired(); 962 1033 return FALSE; 963 1034 } … … 968 1039 BOOLEAN uniquePoint(leftv res, leftv args) 969 1040 { 970 gfan::initializeCddlibIfRequired();971 leftv u = args;972 if ((u != NULL) && (u>Typ() == coneID))973 {1041 leftv u = args; 1042 if ((u != NULL) && (u>Typ() == coneID)) 1043 { 1044 gfan::initializeCddlibIfRequired(); 974 1045 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 975 1046 gfan::ZVector zv = zc>getUniquePoint(); 976 1047 res>rtyp = BIGINTMAT_CMD; 977 1048 res>data = (void*) zVectorToBigintmat(zv); 1049 gfan::deinitializeCddlibIfRequired(); 978 1050 return FALSE; 979 1051 } … … 1005 1077 BOOLEAN randomPoint(leftv res, leftv args) 1006 1078 { 1007 gfan::initializeCddlibIfRequired();1008 leftv u = args;1009 if ((u != NULL) && (u>Typ() == coneID))1010 {1079 leftv u = args; 1080 if ((u != NULL) && (u>Typ() == coneID)) 1081 { 1082 gfan::initializeCddlibIfRequired(); 1011 1083 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1012 1084 gfan::ZVector zv = randomPoint(zc); 1013 1085 res>rtyp = BIGINTMAT_CMD; 1014 1086 res>data = (void*) zVectorToBigintmat(zv); 1087 gfan::deinitializeCddlibIfRequired(); 1015 1088 return FALSE; 1016 1089 } … … 1021 1094 BOOLEAN setMultiplicity(leftv res, leftv args) 1022 1095 { 1023 gfan::initializeCddlibIfRequired();1024 1096 leftv u = args; 1025 1097 if ((u != NULL) && (u>Typ() == coneID)) … … 1029 1101 if ((v != NULL) && (v>Typ() == INT_CMD)) 1030 1102 { 1103 gfan::initializeCddlibIfRequired(); 1031 1104 int val = (int)(long)v>Data(); 1032 1105 zc>setMultiplicity(gfan::Integer(val)); 1033 1106 res>rtyp = NONE; 1034 1107 res>data = NULL; 1108 gfan::deinitializeCddlibIfRequired(); 1035 1109 return FALSE; 1036 1110 } … … 1042 1116 BOOLEAN setLinearForms(leftv res, leftv args) 1043 1117 { 1044 gfan::initializeCddlibIfRequired();1045 1118 leftv u = args; 1046 1119 if ((u != NULL) && (u>Typ() == coneID)) … … 1050 1123 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTVEC_CMD))) 1051 1124 { 1125 gfan::initializeCddlibIfRequired(); 1052 1126 bigintmat* mat=NULL; 1053 1127 if (v>Typ() == INTVEC_CMD) … … 1066 1140 if (v>Typ() == INTVEC_CMD) 1067 1141 delete mat; 1068 return FALSE; 1142 gfan::deinitializeCddlibIfRequired(); 1143 return FALSE; 1069 1144 } 1070 1145 } … … 1095 1170 BOOLEAN coneToPolytope(leftv res, leftv args) 1096 1171 { 1097 gfan::initializeCddlibIfRequired();1098 leftv u = args;1099 if ((u != NULL) && (u>Typ() == coneID))1100 {1172 leftv u = args; 1173 if ((u != NULL) && (u>Typ() == coneID)) 1174 { 1175 gfan::initializeCddlibIfRequired(); 1101 1176 gfan::ZCone* zc = (gfan::ZCone*) u>Data(); 1102 1177 gfan::ZMatrix ineq=zc>getInequalities(); … … 1105 1180 res>rtyp = polytopeID; 1106 1181 res>data = (void*) zd; 1182 gfan::deinitializeCddlibIfRequired(); 1107 1183 return FALSE; 1108 1184 } … … 1113 1189 BOOLEAN intersectCones(leftv res, leftv args) 1114 1190 { 1115 gfan::initializeCddlibIfRequired();1116 1191 leftv u = args; 1117 1192 if ((u != NULL) && (u>Typ() == coneID)) … … 1120 1195 if ((v != NULL) && (v>Typ() == coneID)) 1121 1196 { 1197 gfan::initializeCddlibIfRequired(); 1122 1198 gfan::ZCone* zc1 = (gfan::ZCone*)u>Data(); 1123 1199 gfan::ZCone* zc2 = (gfan::ZCone*)v>Data(); … … 1128 1204 Werror("expected ambient dims of both cones to coincide\n" 1129 1205 "but got %d and %d", d1, d2); 1206 gfan::deinitializeCddlibIfRequired(); 1130 1207 return TRUE; 1131 1208 } … … 1134 1211 res>rtyp = coneID; 1135 1212 res>data = (void *)new gfan::ZCone(zc3); 1213 gfan::deinitializeCddlibIfRequired(); 1136 1214 return FALSE; 1137 1215 } 1138 1216 if ((v != NULL) && (v>Typ() == polytopeID)) 1139 1217 { 1218 gfan::initializeCddlibIfRequired(); 1140 1219 gfan::ZCone* zc11 = (gfan::ZCone*)u>Data(); 1141 1220 gfan::ZCone zc1 = liftUp(*zc11); … … 1147 1226 Werror("expected ambient dims of both cones to coincide\n" 1148 1227 "but got %d and %d", d1, d2); 1228 gfan::deinitializeCddlibIfRequired(); 1149 1229 return TRUE; 1150 1230 } … … 1153 1233 res>rtyp = polytopeID; 1154 1234 res>data = (void *)new gfan::ZCone(zc3); 1235 gfan::deinitializeCddlibIfRequired(); 1155 1236 return FALSE; 1156 1237 } … … 1161 1242 if ((v != NULL) && (v>Typ() == coneID)) 1162 1243 { 1244 gfan::initializeCddlibIfRequired(); 1163 1245 gfan::ZCone* zc1 = (gfan::ZCone*)u>Data(); 1164 1246 gfan::ZCone* zc22 = (gfan::ZCone*)v>Data(); … … 1170 1252 Werror("expected ambient dims of both cones to coincide\n" 1171 1253 "but got %d and %d", d1, d2); 1254 gfan::deinitializeCddlibIfRequired(); 1172 1255 return TRUE; 1173 1256 } … … 1176 1259 res>rtyp = polytopeID; 1177 1260 res>data = (void *)new gfan::ZCone(zc3); 1261 gfan::deinitializeCddlibIfRequired(); 1178 1262 return FALSE; 1179 1263 } 1180 1264 if ((v != NULL) && (v>Typ() == polytopeID)) 1181 1265 { 1266 gfan::initializeCddlibIfRequired(); 1182 1267 gfan::ZCone* zc1 = (gfan::ZCone*)u>Data(); 1183 1268 gfan::ZCone* zc2 = (gfan::ZCone*)v>Data(); … … 1188 1273 Werror("expected ambient dims of both cones to coincide\n" 1189 1274 "but got %d and %d", d1, d2); 1275 gfan::deinitializeCddlibIfRequired(); 1190 1276 return TRUE; 1191 1277 } … … 1194 1280 res>rtyp = polytopeID; 1195 1281 res>data = (void *)new gfan::ZCone(zc3); 1282 gfan::deinitializeCddlibIfRequired(); 1196 1283 return FALSE; 1197 1284 } … … 1203 1290 BOOLEAN convexHull(leftv res, leftv args) 1204 1291 { 1205 gfan::initializeCddlibIfRequired();1206 1292 leftv u = args; 1207 1293 if ((u != NULL) && (u>Typ() == coneID)) … … 1210 1296 if ((v != NULL) && (v>Typ() == coneID)) 1211 1297 { 1298 gfan::initializeCddlibIfRequired(); 1212 1299 gfan::ZCone* zc1 = (gfan::ZCone*)u>Data(); 1213 1300 gfan::ZCone* zc2 = (gfan::ZCone*)v>Data(); … … 1218 1305 Werror("expected ambient dims of both cones to coincide\n" 1219 1306 "but got %d and %d", d1, d2); 1220 return TRUE; 1307 gfan::deinitializeCddlibIfRequired(); 1308 return TRUE; 1221 1309 } 1222 1310 gfan::ZMatrix zm1 = zc1>extremeRays(); … … 1230 1318 res>rtyp = coneID; 1231 1319 res>data = (void*) zc; 1320 gfan::deinitializeCddlibIfRequired(); 1232 1321 return FALSE; 1233 1322 } 1234 1323 if ((v != NULL) && (v>Typ() == polytopeID)) 1235 1324 { 1325 gfan::initializeCddlibIfRequired(); 1236 1326 gfan::ZCone* zc11 = (gfan::ZCone*)u>Data(); 1237 1327 gfan::ZCone zc1 = liftUp(*zc11); … … 1243 1333 Werror("expected ambient dims of both cones to coincide\n" 1244 1334 "but got %d and %d", d1, d2); 1335 gfan::deinitializeCddlibIfRequired(); 1245 1336 return TRUE; 1246 1337 } … … 1253 1344 res>rtyp = polytopeID; 1254 1345 res>data = (void*) zc; 1255 return FALSE; 1346 gfan::deinitializeCddlibIfRequired(); 1347 return FALSE; 1256 1348 } 1257 1349 } … … 1261 1353 if ((v != NULL) && (v>Typ() == coneID)) 1262 1354 { 1355 gfan::initializeCddlibIfRequired(); 1263 1356 gfan::ZCone* zc1 = (gfan::ZCone*)u>Data(); 1264 1357 gfan::ZCone* zc22 = (gfan::ZCone*)v>Data(); … … 1270 1363 Werror("expected ambient dims of both cones to coincide\n" 1271 1364 "but got %d and %d", d1, d2); 1365 gfan::deinitializeCddlibIfRequired(); 1272 1366 return TRUE; 1273 1367 } … … 1280 1374 res>rtyp = polytopeID; 1281 1375 res>data = (void*) zc; 1376 gfan::deinitializeCddlibIfRequired(); 1282 1377 return FALSE; 1283 1378 } 1284 1379 if ((v != NULL) && (v>Typ() == polytopeID)) 1285 1380 { 1381 gfan::initializeCddlibIfRequired(); 1286 1382 gfan::ZCone* zc1 = (gfan::ZCone*)u>Data(); 1287 1383 gfan::ZCone* zc2 = (gfan::ZCone*)v>Data(); … … 1292 1388 Werror("expected ambient dims of both cones to coincide\n" 1293 1389 "but got %d and %d", d1, d2); 1390 gfan::deinitializeCddlibIfRequired(); 1294 1391 return TRUE; 1295 1392 } … … 1301 1398 res>rtyp = polytopeID; 1302 1399 res>data = (void*) zc; 1400 gfan::deinitializeCddlibIfRequired(); 1303 1401 return FALSE; 1304 1402 } … … 1310 1408 BOOLEAN coneLink(leftv res, leftv args) 1311 1409 { 1312 gfan::initializeCddlibIfRequired();1313 1410 leftv u = args; 1314 1411 if ((u != NULL) && (u>Typ() == coneID)) … … 1317 1414 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTVEC_CMD))) 1318 1415 { 1416 gfan::initializeCddlibIfRequired(); 1319 1417 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1320 1418 bigintmat* iv = NULL; … … 1333 1431 Werror("expected ambient dim of cone and size of vector\n" 1334 1432 " to be equal but got %d and %d", d1, d2); 1433 gfan::deinitializeCddlibIfRequired(); 1335 1434 return TRUE; 1336 1435 } … … 1338 1437 { 1339 1438 WerrorS("the provided intvec does not lie in the cone"); 1439 gfan::deinitializeCddlibIfRequired(); 1340 1440 return TRUE; 1341 1441 } … … 1347 1447 if (v>Typ() == INTMAT_CMD) 1348 1448 delete iv; 1449 gfan::deinitializeCddlibIfRequired(); 1349 1450 return FALSE; 1350 1451 } … … 1356 1457 BOOLEAN containsInSupport(leftv res, leftv args) 1357 1458 { 1358 gfan::initializeCddlibIfRequired();1359 1459 leftv u=args; 1360 1460 if ((u != NULL) && (u>Typ() == coneID)) … … 1363 1463 if ((v != NULL) && (v>Typ() == coneID)) 1364 1464 { 1465 gfan::initializeCddlibIfRequired(); 1365 1466 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1366 1467 gfan::ZCone* zd = (gfan::ZCone*)v>Data(); … … 1371 1472 Werror("expected cones with same ambient dimensions\n but got" 1372 1473 " dimensions %d and %d", d1, d2); 1474 gfan::deinitializeCddlibIfRequired(); 1373 1475 return TRUE; 1374 1476 } … … 1376 1478 res>rtyp = INT_CMD; 1377 1479 res>data = (void*) (long) b; 1480 gfan::deinitializeCddlibIfRequired(); 1378 1481 return FALSE; 1379 1482 } 1380 1483 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTVEC_CMD))) 1381 1484 { 1485 gfan::initializeCddlibIfRequired(); 1382 1486 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1383 1487 bigintmat* iv = NULL; … … 1397 1501 Werror("expected cones with same ambient dimensions\n but got" 1398 1502 " dimensions %d and %d", d1, d2); 1503 gfan::deinitializeCddlibIfRequired(); 1399 1504 return TRUE; 1400 1505 } … … 1406 1511 if (v>Typ() == INTMAT_CMD) 1407 1512 delete iv; 1513 gfan::deinitializeCddlibIfRequired(); 1408 1514 return FALSE; 1409 1515 } … … 1415 1521 BOOLEAN containsRelatively(leftv res, leftv args) 1416 1522 { 1417 gfan::initializeCddlibIfRequired();1418 1523 leftv u = args; 1419 1524 if ((u != NULL) && (u>Typ() == coneID)) … … 1422 1527 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTVEC_CMD))) 1423 1528 { 1529 gfan::initializeCddlibIfRequired(); 1424 1530 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1425 1531 bigintmat* iv = NULL; … … 1442 1548 if (v>Typ() == INTMAT_CMD) 1443 1549 delete iv; 1550 gfan::deinitializeCddlibIfRequired(); 1444 1551 return FALSE; 1445 1552 } … … 1447 1554 if (v>Typ() == INTMAT_CMD) 1448 1555 delete iv; 1556 gfan::deinitializeCddlibIfRequired(); 1449 1557 Werror("expected ambient dim of cone and size of vector\n" 1450 1558 "to be equal but got %d and %d", d1, d2); … … 1457 1565 BOOLEAN hasFace(leftv res, leftv args) 1458 1566 { 1459 gfan::initializeCddlibIfRequired();1460 1567 leftv u=args; 1461 1568 if ((u != NULL) && (u>Typ() == coneID)) … … 1464 1571 if ((v != NULL) && (v>Typ() == coneID)) 1465 1572 { 1573 gfan::initializeCddlibIfRequired(); 1466 1574 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1467 1575 gfan::ZCone* zd = (gfan::ZCone*)v>Data(); … … 1469 1577 res>rtyp = INT_CMD; 1470 1578 res>data = (void*) (long) b; 1579 gfan::deinitializeCddlibIfRequired(); 1471 1580 return FALSE; 1472 1581 } … … 1477 1586 if ((v != NULL) && (v>Typ() == polytopeID)) 1478 1587 { 1588 gfan::initializeCddlibIfRequired(); 1479 1589 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1480 1590 gfan::ZCone* zd = (gfan::ZCone*)v>Data(); … … 1482 1592 res>rtyp = INT_CMD; 1483 1593 res>data = (void*) (long) b; 1594 gfan::deinitializeCddlibIfRequired(); 1484 1595 return FALSE; 1485 1596 } … … 1491 1602 BOOLEAN canonicalizeCone(leftv res, leftv args) 1492 1603 { 1493 gfan::initializeCddlibIfRequired();1494 1604 leftv u=args; 1495 1605 if ((u != NULL) && (u>Typ() == coneID)) 1496 1606 { 1607 gfan::initializeCddlibIfRequired(); 1497 1608 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 1498 1609 gfan::ZCone* zd = new gfan::ZCone(*zc); … … 1500 1611 res>rtyp = coneID; 1501 1612 res>data = (void*) zd; 1613 gfan::deinitializeCddlibIfRequired(); 1502 1614 return FALSE; 1503 1615 } … … 1508 1620 BOOLEAN containsCone(leftv res, leftv args) 1509 1621 { 1510 gfan::initializeCddlibIfRequired();1511 1622 leftv u=args; 1512 1623 if ((u != NULL) && (u>Typ() == LIST_CMD)) … … 1515 1626 if ((v != NULL) && (v>Typ() == coneID)) 1516 1627 { 1628 gfan::initializeCddlibIfRequired(); 1517 1629 lists l = (lists) u>Data(); 1518 1630 gfan::ZCone* zc = (gfan::ZCone*) v>Data(); … … 1524 1636 { 1525 1637 WerrorS("containsCone: entries of wrong type in list"); 1638 gfan::deinitializeCddlibIfRequired(); 1526 1639 return TRUE; 1527 1640 } … … 1536 1649 res>rtyp = INT_CMD; 1537 1650 res>data = (char*) (long) b; 1651 gfan::deinitializeCddlibIfRequired(); 1538 1652 return FALSE; 1539 1653 } … … 1545 1659 BOOLEAN faceContaining(leftv res, leftv args) 1546 1660 { 1547 gfan::initializeCddlibIfRequired();1548 1661 leftv u = args; 1549 1662 if ((u != NULL) && (u>Typ() == coneID)) … … 1552 1665 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTVEC_CMD))) 1553 1666 { 1667 gfan::initializeCddlibIfRequired(); 1554 1668 gfan::ZCone* zc = (gfan::ZCone*) u>Data(); 1555 1669 … … 1575 1689 if (v>Typ() == INTVEC_CMD) 1576 1690 delete point1; 1691 gfan::deinitializeCddlibIfRequired(); 1577 1692 return FALSE; 1578 1693 } 
Singular/dyn_modules/gfanlib/bbfan.cc
re85fed r5a1c78 42 42 gfan::ZFan* zf = (gfan::ZFan*)d; 43 43 std::string s = zf>toString(2+4+8+128); 44 gfan::deinitializeCddlibIfRequired(); 44 45 return omStrDup(s.c_str()); 45 46 // ======= … … 176 177 BOOLEAN emptyFan(leftv res, leftv args) 177 178 { 178 gfan::initializeCddlibIfRequired();179 179 leftv u = args; 180 180 if (u == NULL) … … 267 267 BOOLEAN numberOfConesOfDimension(leftv res, leftv args) 268 268 { 269 gfan::initializeCddlibIfRequired();270 269 leftv u=args; 271 270 if ((u != NULL) && (u>Typ() == fanID)) … … 280 279 if ((x != NULL) && (x>Typ() == INT_CMD)) 281 280 { 281 gfan::initializeCddlibIfRequired(); 282 282 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 283 283 int d = (int)(long)v>Data(); … … 296 296 res>rtyp = INT_CMD; 297 297 res>data = (void*) (long) n; 298 gfan::deinitializeCddlibIfRequired(); 298 299 return FALSE; 299 300 } 300 301 res>rtyp = INT_CMD; 301 302 res>data = (void*) (long) 0; 303 gfan::deinitializeCddlibIfRequired(); 302 304 return FALSE; 303 305 } … … 312 314 BOOLEAN ncones(leftv res, leftv args) 313 315 { 314 gfan::initializeCddlibIfRequired();315 316 leftv u=args; 316 317 if ((u != NULL) && (u>Typ() == fanID)) 317 318 { 319 gfan::initializeCddlibIfRequired(); 318 320 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 319 321 int d = zf>getAmbientDimension(); … … 325 327 res>rtyp = INT_CMD; 326 328 res>data = (void*) (long) n; 329 gfan::deinitializeCddlibIfRequired(); 327 330 return FALSE; 328 331 } … … 333 336 BOOLEAN nmaxcones(leftv res, leftv args) 334 337 { 335 gfan::initializeCddlibIfRequired();336 338 leftv u=args; 337 339 if ((u != NULL) && (u>Typ() == fanID)) 338 340 { 341 gfan::initializeCddlibIfRequired(); 339 342 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 340 343 … … 345 348 res>rtyp = INT_CMD; 346 349 res>data = (void*) (long) n; 350 gfan::deinitializeCddlibIfRequired(); 347 351 return FALSE; 348 352 } … … 372 376 BOOLEAN isCompatible(leftv res, leftv args) 373 377 { 374 gfan::initializeCddlibIfRequired();375 378 leftv u=args; 376 379 if ((u != NULL) && (u>Typ() == fanID)) … … 379 382 if ((v != NULL) && (v>Typ() == coneID)) 380 383 { 384 gfan::initializeCddlibIfRequired(); 381 385 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 382 386 gfan::ZCone* zc = (gfan::ZCone*)v>Data(); … … 384 388 res>rtyp = INT_CMD; 385 389 res>data = (void*) (long) b; 390 gfan::deinitializeCddlibIfRequired(); 386 391 return FALSE; 387 392 } … … 393 398 BOOLEAN insertCone(leftv res, leftv args) 394 399 { 395 gfan::initializeCddlibIfRequired();396 400 leftv u=args; 397 401 if ((u != NULL) && (u>rtyp==IDHDL) && (u>e==NULL) && (u>Typ() == fanID)) … … 400 404 if ((v != NULL) && (v>Typ() == coneID)) 401 405 { 406 gfan::initializeCddlibIfRequired(); 402 407 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 403 408 gfan::ZCone* zc = (gfan::ZCone*)v>Data(); … … 414 419 { 415 420 WerrorS("insertCone: cone and fan not compatible"); 421 gfan::deinitializeCddlibIfRequired(); 416 422 return TRUE; 417 423 } … … 422 428 res>data = NULL; 423 429 IDDATA((idhdl)u>data) = (char*) zf; 430 gfan::deinitializeCddlibIfRequired(); 424 431 return FALSE; 425 432 } … … 451 458 BOOLEAN containsInCollection(leftv res, leftv args) 452 459 { 453 gfan::initializeCddlibIfRequired();454 460 leftv u=args; 455 461 if ((u != NULL) && (u>Typ() == fanID)) … … 458 464 if ((v != NULL) && (v>Typ() == coneID)) 459 465 { 466 gfan::initializeCddlibIfRequired(); 460 467 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 461 468 gfan::ZCone* zc = (gfan::ZCone*)v>Data(); … … 464 471 res>rtyp = INT_CMD; 465 472 res>data = (void*) (long) (int) containsInCollection(zf,zc); 473 gfan::deinitializeCddlibIfRequired(); 466 474 return FALSE; 467 475 } 476 gfan::deinitializeCddlibIfRequired(); 468 477 WerrorS("containsInCollection: mismatching ambient dimensions"); 469 478 return TRUE; … … 510 519 BOOLEAN removeCone(leftv res, leftv args) 511 520 { 512 gfan::initializeCddlibIfRequired();513 521 leftv u=args; 514 522 if ((u != NULL) && (u>Typ() == fanID)) … … 517 525 if ((v != NULL) && (v>Typ() == coneID)) 518 526 { 527 gfan::initializeCddlibIfRequired(); 519 528 gfan::ZFan* zf = (gfan::ZFan*)u>Data(); 520 529 gfan::ZCone* zc = (gfan::ZCone*)v>Data(); … … 530 539 { 531 540 WerrorS("removeCone: cone not contained in fan"); 541 gfan::deinitializeCddlibIfRequired(); 532 542 return TRUE; 533 543 } … … 538 548 res>data = NULL; 539 549 IDDATA((idhdl)u>data) = (char*) zf; 550 gfan::deinitializeCddlibIfRequired(); 540 551 return FALSE; 541 552 } … … 547 558 BOOLEAN getCone(leftv res, leftv args) 548 559 { 549 gfan::initializeCddlibIfRequired();550 560 leftv u=args; 551 561 if ((u != NULL) && (u>Typ() == fanID)) … … 557 567 if ((w != NULL) && (w>Typ() == INT_CMD)) 558 568 { 569 gfan::initializeCddlibIfRequired(); 559 570 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 560 571 int d = (int)(long)v>Data(); … … 589 600 res>rtyp = coneID; 590 601 res>data = (void*)new gfan::ZCone(zc); 602 gfan::deinitializeCddlibIfRequired(); 591 603 return FALSE; 592 604 } … … 594 606 { 595 607 WerrorS("getCone: invalid dimension; no cones in this dimension"); 608 gfan::deinitializeCddlibIfRequired(); 596 609 return TRUE; 597 610 } … … 600 613 { 601 614 WerrorS("getCone: invalid index"); 615 gfan::deinitializeCddlibIfRequired(); 602 616 return TRUE; 603 617 } … … 606 620 { 607 621 WerrorS("getCone: invalid dimension"); 622 gfan::deinitializeCddlibIfRequired(); 608 623 return TRUE; 609 624 } … … 612 627 { 613 628 WerrorS("getCone: invalid specifier for orbit or maximal"); 629 gfan::deinitializeCddlibIfRequired(); 614 630 return TRUE; 615 631 } … … 623 639 BOOLEAN getCones(leftv res, leftv args) 624 640 { 625 gfan::initializeCddlibIfRequired();626 641 leftv u=args; 627 642 if ((u != NULL) && (u>Typ() == fanID)) … … 630 645 if ((v != NULL) && (v>Typ() == INT_CMD)) 631 646 { 647 gfan::initializeCddlibIfRequired(); 632 648 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 633 649 int d = (int)(long)v>Data(); … … 665 681 res>rtyp = LIST_CMD; 666 682 res>data = (void*) L; 683 gfan::deinitializeCddlibIfRequired(); 667 684 return FALSE; 668 685 } … … 670 687 { 671 688 WerrorS("getCones: invalid dimension; no cones in this dimension"); 689 gfan::deinitializeCddlibIfRequired(); 672 690 return TRUE; 673 691 } … … 676 694 { 677 695 WerrorS("getCones: invalid dimension"); 696 gfan::deinitializeCddlibIfRequired(); 678 697 return TRUE; 679 698 } … … 682 701 { 683 702 WerrorS("getCones: invalid specifier for orbit or maximal"); 703 gfan::deinitializeCddlibIfRequired(); 684 704 return TRUE; 685 705 } … … 698 718 BOOLEAN isPure(leftv res, leftv args) 699 719 { 700 gfan::initializeCddlibIfRequired();701 720 leftv u=args; 702 721 if ((u != NULL) && (u>Typ() == fanID)) 703 722 { 723 gfan::initializeCddlibIfRequired(); 704 724 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 705 725 int b = zf>isPure(); 706 726 res>rtyp = INT_CMD; 707 727 res>data = (void*) (long) b; 728 gfan::deinitializeCddlibIfRequired(); 708 729 return FALSE; 709 730 } … … 729 750 BOOLEAN fVector(leftv res, leftv args) 730 751 { 731 gfan::initializeCddlibIfRequired();732 752 leftv u=args; 733 753 if ((u != NULL) && (u>Typ() == fanID)) 734 754 { 755 gfan::initializeCddlibIfRequired(); 735 756 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 736 757 gfan::ZVector zv=zf>getFVector(); 737 758 res>rtyp = BIGINTMAT_CMD; 738 759 res>data = (void*) zVectorToBigintmat(zv); 760 gfan::deinitializeCddlibIfRequired(); 739 761 return FALSE; 740 762 } … … 745 767 gfan::ZMatrix rays(const gfan::ZFan* const zf) 746 768 { 747 gfan::initializeCddlibIfRequired();748 769 gfan::ZMatrix rays(0,zf>getAmbientDimension()); 749 770 for (int i=0; i<zf>numberOfConesOfDimension(1,0,0); i++) … … 757 778 int numberOfConesWithVector(gfan::ZFan* zf, gfan::ZVector* v) 758 779 { 759 gfan::initializeCddlibIfRequired();760 780 int count = 0; 761 781 int ambientDim = zf>getAmbientDimension(); … … 775 795 BOOLEAN numberOfConesWithVector(leftv res, leftv args) 776 796 { 777 gfan::initializeCddlibIfRequired();778 797 leftv u=args; 779 798 if ((u != NULL) && (u>Typ() == fanID)) … … 782 801 if ((v != NULL) && (v>Typ() == BIGINTMAT_CMD)) 783 802 { 803 gfan::initializeCddlibIfRequired(); 784 804 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 785 805 bigintmat* v0 = (bigintmat*) v>Data(); … … 788 808 { 789 809 WerrorS("numberOfConesWithVector: mismatching dimensions"); 810 gfan::deinitializeCddlibIfRequired(); 790 811 return TRUE; 791 812 } … … 795 816 res>rtyp = INT_CMD; 796 817 res>data = (void*) (long) count; 818 gfan::deinitializeCddlibIfRequired(); 797 819 return FALSE; 798 820 } … … 804 826 BOOLEAN fanFromString(leftv res, leftv args) 805 827 { 806 gfan::initializeCddlibIfRequired();807 828 leftv u=args; 808 829 if ((u != NULL) && (u>Typ() == STRING_CMD)) 809 { 810 std::string fanInString = (char*) u>Data(); 811 std::istringstream s(fanInString); 812 gfan::ZFan* zf = new gfan::ZFan(s); 813 res>rtyp = fanID; 814 res>data = (void*) zf; 815 return FALSE; 816 } 830 { 831 gfan::initializeCddlibIfRequired(); 832 std::string fanInString = (char*) u>Data(); 833 std::istringstream s(fanInString); 834 gfan::ZFan* zf = new gfan::ZFan(s); 835 res>rtyp = fanID; 836 res>data = (void*) zf; 837 gfan::deinitializeCddlibIfRequired(); 838 return FALSE; 839 } 817 840 WerrorS("fanFromString: unexpected parameters"); 818 841 return TRUE; … … 821 844 BOOLEAN fanViaCones(leftv res, leftv args) 822 845 { 823 gfan::initializeCddlibIfRequired();824 846 leftv u=args; 825 847 if ((u != NULL) && (u>Typ() == LIST_CMD)) … … 828 850 if (lSize(L)>1) 829 851 { 852 gfan::initializeCddlibIfRequired(); 830 853 if (L>m[0].Typ() != coneID) 831 854 { … … 841 864 { 842 865 WerrorS("fanViaCones: entries of wrong type in list"); 866 gfan::deinitializeCddlibIfRequired(); 843 867 return TRUE; 844 868 } … … 847 871 { 848 872 WerrorS("fanViaCones: inconsistent ambient dimensions amongst cones in list"); 873 gfan::deinitializeCddlibIfRequired(); 849 874 return TRUE; 850 875 } … … 853 878 res>rtyp = fanID; 854 879 res>data = (void*) zf; 880 gfan::deinitializeCddlibIfRequired(); 855 881 return FALSE; 856 882 } … … 861 887 if ((u != NULL) && (u>Typ() == coneID)) 862 888 { 889 gfan::initializeCddlibIfRequired(); 863 890 gfan::ZCone* zc = (gfan::ZCone*) u>Data(); 864 891 gfan::ZFan* zf = new gfan::ZFan(zc>ambientDimension()); … … 870 897 { 871 898 WerrorS("fanViaCones: arguments of wrong type"); 899 gfan::deinitializeCddlibIfRequired(); 900 delete zf; 872 901 return TRUE; 873 902 } … … 876 905 { 877 906 WerrorS("fanViaCones: inconsistent ambient dimensions amongst input cones"); 907 gfan::deinitializeCddlibIfRequired(); 908 delete zf; 878 909 return TRUE; 879 910 } … … 882 913 res>rtyp = fanID; 883 914 res>data = (void*) zf; 915 gfan::deinitializeCddlibIfRequired(); 884 916 return FALSE; 885 917 } … … 972 1004 BOOLEAN commonRefinement(leftv res, leftv args) 973 1005 { 974 gfan::initializeCddlibIfRequired();975 1006 leftv u=args; 976 1007 if ((u != NULL) && (u>Typ() == fanID)) … … 979 1010 if ((v != NULL) && (v>Typ() == fanID)) 980 1011 { 1012 gfan::initializeCddlibIfRequired(); 981 1013 gfan::ZFan* zf = (gfan::ZFan*) u>Data(); 982 1014 gfan::ZFan* zg = (gfan::ZFan*) v>Data(); … … 984 1016 res>rtyp = fanID; 985 1017 res>data = (void*) zr; 1018 gfan::deinitializeCddlibIfRequired(); 986 1019 return FALSE; 987 1020 } 
Singular/dyn_modules/gfanlib/bbpolytope.cc
re85fed r5a1c78 185 185 BOOLEAN polytopeViaVertices(leftv res, leftv args) 186 186 { 187 gfan::initializeCddlibIfRequired();188 187 leftv u = args; 189 188 if ((u != NULL) && ((u>Typ() == BIGINTMAT_CMD)  (u>Typ() == INTMAT_CMD))) 190 189 { 191 if (u>next == NULL) return ppCONERAYS1(res, u); 190 if (u>next == NULL) 191 { 192 gfan::initializeCddlibIfRequired(); 193 BOOLEAN bo = ppCONERAYS1(res, u); 194 gfan::deinitializeCddlibIfRequired(); 195 return bo; 196 } 192 197 leftv v = u>next; 193 198 if ((v != NULL) && (v>Typ() == INT_CMD)) 194 199 { 195 if (v>next == NULL) return ppCONERAYS3(res, u, v); 200 if (v>next == NULL) 201 { 202 gfan::initializeCddlibIfRequired(); 203 BOOLEAN bo = ppCONERAYS3(res, u, v); 204 gfan::deinitializeCddlibIfRequired(); 205 return bo; 206 } 196 207 } 197 208 } … … 320 331 BOOLEAN polytopeViaNormals(leftv res, leftv args) 321 332 { 322 gfan::initializeCddlibIfRequired();323 333 leftv u = args; 324 334 if ((u != NULL) && ((u>Typ() == BIGINTMAT_CMD)  (u>Typ() == INTMAT_CMD))) 325 335 { 326 if (u>next == NULL) return ppCONENORMALS1(res, u); 336 if (u>next == NULL) 337 { 338 gfan::initializeCddlibIfRequired(); 339 BOOLEAN bo = ppCONENORMALS1(res, u); 340 gfan::deinitializeCddlibIfRequired(); 341 return bo; 342 } 327 343 } 328 344 leftv v = u>next; 329 345 if ((v != NULL) && ((v>Typ() == BIGINTMAT_CMD)  (v>Typ() == INTMAT_CMD))) 330 346 { 331 if (v>next == NULL) return ppCONENORMALS2(res, u, v); 347 if (v>next == NULL) 348 { 349 gfan::initializeCddlibIfRequired(); 350 BOOLEAN bo = ppCONENORMALS2(res, u, v); 351 gfan::deinitializeCddlibIfRequired(); 352 return bo; 353 } 332 354 } 333 355 leftv w = v>next; 334 356 if ((w != NULL) && (w>Typ() == INT_CMD)) 335 357 { 336 if (w>next == NULL) return ppCONENORMALS3(res, u, v, w); 358 if (w>next == NULL) 359 { 360 gfan::initializeCddlibIfRequired(); 361 BOOLEAN bo = ppCONENORMALS3(res, u, v, w); 362 gfan::deinitializeCddlibIfRequired(); 363 return bo; 364 } 337 365 } 338 366 WerrorS("polytopeViaInequalities: unexpected parameters"); … … 342 370 BOOLEAN vertices(leftv res, leftv args) 343 371 { 344 gfan::initializeCddlibIfRequired();345 372 leftv u = args; 346 373 if ((u != NULL) && (u>Typ() == polytopeID)) 347 { 348 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 349 gfan::ZMatrix zmat = zc>extremeRays(); 350 res>rtyp = BIGINTMAT_CMD; 351 res>data = (void*)zMatrixToBigintmat(zmat); 352 return FALSE; 353 } 374 { 375 gfan::initializeCddlibIfRequired(); 376 gfan::ZCone* zc = (gfan::ZCone*)u>Data(); 377 gfan::ZMatrix zmat = zc>extremeRays(); 378 res>rtyp = BIGINTMAT_CMD; 379 res>data = (void*)zMatrixToBigintmat(zmat); 380 gfan::deinitializeCddlibIfRequired(); 381 return FALSE; 382 } 354 383 WerrorS("vertices: unexpected parameters"); 355 384 return TRUE; … … 401 430 BOOLEAN newtonPolytope(leftv res, leftv args) 402 431 { 403 gfan::initializeCddlibIfRequired();404 432 leftv u = args; 405 433 if ((u != NULL) && (u>Typ() == POLY_CMD)) 406 434 { 435 gfan::initializeCddlibIfRequired(); 407 436 poly p = (poly)u>Data(); 408 437 res>rtyp = polytopeID; 409 438 res>data = (void*) new gfan::ZCone(newtonPolytope(p,currRing)); 439 gfan::deinitializeCddlibIfRequired(); 410 440 return FALSE; 411 441 } … … 416 446 BOOLEAN scalePolytope(leftv res, leftv args) 417 447 { 418 gfan::initializeCddlibIfRequired();419 448 leftv u = args; 420 449 if ((u != NULL) && (u>Typ() == INT_CMD)) … … 423 452 if ((v != NULL) && (v>Typ() == polytopeID)) 424 453 { 454 gfan::initializeCddlibIfRequired(); 425 455 int s = (int)(long) u>Data(); 426 456 gfan::ZCone* zp = (gfan::ZCone*) v>Data(); … … 433 463 res>rtyp = polytopeID; 434 464 res>data = (void*) zq; 465 gfan::deinitializeCddlibIfRequired(); 435 466 return FALSE; 436 467 } … … 442 473 BOOLEAN dualPolytope(leftv res, leftv args) 443 474 { 444 gfan::initializeCddlibIfRequired();445 475 leftv u = args; 446 476 if ((u != NULL) && (u>Typ() == polytopeID)) 447 477 { 478 gfan::initializeCddlibIfRequired(); 448 479 gfan::ZCone* zp = (gfan::ZCone*) u>Data(); 449 480 gfan::ZCone* zq = new gfan::ZCone(zp>dualCone()); 450 481 res>rtyp = polytopeID; 451 482 res>data = (void*) zq; 483 gfan::deinitializeCddlibIfRequired(); 452 484 return FALSE; 453 485 } … … 458 490 BOOLEAN mixedVolume(leftv res, leftv args) 459 491 { 460 gfan::initializeCddlibIfRequired();461 492 leftv u = args; 462 493 if ((u != NULL) && (u>Typ() == LIST_CMD)) 463 494 { 495 gfan::initializeCddlibIfRequired(); 464 496 lists l = (lists) u>Data(); 465 497 int k = lSize(l)+1; … … 499 531 { 500 532 WerrorS("mixedVolume: entries of unsupported type in list"); 533 gfan::deinitializeCddlibIfRequired(); 501 534 return TRUE; 502 535 } … … 506 539 res>rtyp = BIGINT_CMD; 507 540 res>data = (void*) integerToNumber(mv); 541 gfan::deinitializeCddlibIfRequired(); 508 542 return FALSE; 509 543 }
Note: See TracChangeset
for help on using the changeset viewer.