Changeset a5d9313 in git for kernel/clapsing.cc
 Timestamp:
 Apr 13, 2005, 6:38:10 PM (18 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 b52e66d4fefb16e3d45544260d89f4f400225ff2
 Parents:
 c3aa450764b8bf858d17c6300167912f9a0ab03f
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/clapsing.cc
rc3aa45 ra5d9313 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 // $Id: clapsing.cc,v 1. 5 20050330 13:17:08Singular Exp $5 // $Id: clapsing.cc,v 1.6 20050413 16:38:10 Singular Exp $ 6 6 /* 7 7 * ABSTRACT: interface between Singular and factory … … 663 663 } 664 664 665 int singclap_factorize_retry; 666 extern int si_factor_reminder; 667 665 668 ideal singclap_factorize ( poly f, intvec ** v , int with_exps) 666 669 { … … 738 741 CFFList L; 739 742 number N=NULL; 740 number NN=NULL;743 CanonicalForm T_F(0); 741 744 number old_lead_coeff=nCopy(pGetCoeff(f)); 742 745 … … 748 751 //if (f!=NULL) // already tested at start of routine 749 752 { 750 number n0=nCopy(pGetCoeff(f)); 751 if (with_exps==0) 752 N=nCopy(n0); 753 pCleardenom(f); 754 NN=nDiv(n0,pGetCoeff(f)); 755 nDelete(&n0); 756 if (with_exps==0) 757 { 758 nDelete(&N); 759 N=nCopy(NN); 760 } 753 pCleardenom_n(f,N); 761 754 } 762 755 } 763 756 CanonicalForm F( convSingPClapP( f ) ); 757 T_F=F; 764 758 if (nGetChar()==0) /* Q */ 765 759 { … … 781 775 setCharacteristic( c, primepower(c) ); 782 776 CanonicalForm F( convSingGFClapGF( f ) ); 777 T_F=F; 783 778 if (F.isUnivariate()) 784 779 { … … 796 791 if (rField_is_Q_a()) setCharacteristic( 0 ); 797 792 else setCharacteristic( nGetChar() ); 793 pCleardenom_n(f,N); 798 794 if (currRing>minpoly!=NULL) 799 795 { … … 801 797 Variable a=rootOf(mipo); 802 798 CanonicalForm F( convSingAPClapAP( f,a ) ); 799 T_F=F; 803 800 L.insert(F); 804 801 if (rField_is_Zp_a() && F.isUnivariate()) … … 809 806 { 810 807 CanonicalForm G( convSingTrPClapP( f ) ); 808 T_F=G; 811 809 #ifdef HAVE_LIBFAC_P 812 810 if (rField_is_Q_a()) … … 835 833 { 836 834 CanonicalForm F( convSingTrPClapP( f ) ); 835 T_F=F; 837 836 if (rField_is_Q_a()) 838 837 { … … 861 860 int n = L.length(); 862 861 CFFListIterator J=L; 862 CanonicalForm T=1; 863 for ( ; J.hasItem(); J++ ) 864 { 865 int T_e = J.getItem().exp(); 866 while(T_e>0) { T *= J.getItem().factor(); T_e; } 867 } 868 T_F=T; 869 if (!T_F.isZero()) 870 { 871 poly T_F_conv=pOne(); 872 J=L; 873 for ( ; J.hasItem(); J++ ) 874 { 875 poly p; 876 int T_e = J.getItem().exp(); 877 if (rField_is_Zp()  rField_is_Q()) /* Q, Fp */ 878 p=( convClapPSingP( J.getItem().factor() )); 879 else if (rField_is_Extension()) /* Q(a), Fp(a) */ 880 { 881 if (currRing>minpoly==NULL) 882 p=( convClapPSingTrP( J.getItem().factor() )); 883 else 884 p=( convClapAPSingAP( J.getItem().factor() )); 885 } 886 while(T_e>0) { T_F_conv=pMult(T_F_conv,pCopy(p)); T_e; } 887 pDelete(&p); 888 } 889 number n_T=pGetCoeff(T_F_conv); 890 number n_f=pGetCoeff(f); 891 poly n_f_m=pMult_nn(pCopy(f),n_T); 892 T_F_conv=pMult_nn(T_F_conv,n_f); 893 T_F_conv=pSub(T_F_conv,n_f_m); 894 if ((T_F_conv!=NULL) && (singclap_factorize_retry<1)) 895 { 896 singclap_factorize_retry++; 897 if( si_factor_reminder) Print("problem with factorize, retrying\n"); 898 #ifdef FEHLER_FACTORIZE 899 Print("Problem....:");pWrite(f); 900 J=L; 901 for ( ; J.hasItem(); J++ ) 902 { 903 if (rField_is_Zp()  rField_is_Q()) /* Q, Fp */ 904 pWrite0( convClapPSingP( J.getItem().factor() )); 905 else if (rField_is_Extension()) /* Q(a), Fp(a) */ 906 { 907 if (currRing>minpoly==NULL) 908 pWrite0( convClapPSingTrP( J.getItem().factor() )); 909 else 910 pWrite0( convClapAPSingAP( J.getItem().factor() )); 911 } 912 Print(" exp: %d\n", J.getItem().exp()); 913 } 914 Print("mult:"); 915 if (rField_is_Zp()  rField_is_Q()) /* Q, Fp */ 916 pWrite( convClapPSingP( T )); 917 else if (rField_is_Extension()) /* Q(a), Fp(a) */ 918 { 919 if (currRing>minpoly==NULL) 920 pWrite( convClapPSingTrP( T )); 921 else 922 pWrite( convClapAPSingAP( T )); 923 } 924 Print("diff: sing:"); pWrite(T_F_conv); 925 Print("diff: factory:"); 926 if (rField_is_Zp()  rField_is_Q()) /* Q, Fp */ 927 pWrite( convClapPSingP( T_F )); 928 else if (rField_is_Extension()) /* Q(a), Fp(a) */ 929 { 930 if (currRing>minpoly==NULL) 931 pWrite( convClapPSingTrP( T_F )); 932 else 933 pWrite( convClapAPSingAP( T_F )); 934 } 935 #endif 936 ideal T_i=singclap_factorize ( f, v , with_exps); 937 if (N!=NULL) nDelete(&N); 938 pDelete(&T_F_conv); 939 return T_i; 940 } 941 } 942 J=L; 863 943 int j=0; 864 944 if (with_exps!=1) … … 892 972 { 893 973 pMult_nn(res>m[0],N); 894 nDelete(&N);895 N=NULL;896 974 } 897 975 // delete constants … … 968 1046 if (res==NULL) 969 1047 WerrorS( feNotImplemented ); 970 if (NN!=NULL) 971 { 1048 if (N!=NULL) 1049 { 1050 number NN=nInvers(N); 972 1051 pMult_nn(f,NN); 973 1052 nDelete(&NN); 974 }975 if (N!=NULL)976 {977 1053 nDelete(&N); 978 1054 }
Note: See TracChangeset
for help on using the changeset viewer.