- Timestamp:
- Jun 18, 2013, 6:24:27 PM (11 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 593701c3d9a3d7851247b1e1603c209005e89f8e
- Parents:
- b7f609648177988c64be717b8badbaf38f56ff8a
- Location:
- libpolys/polys
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/clapsing.cc
rb7f609 r3426545 8 8 9 9 //#define FACTORIZE2_DEBUG 10 10 11 #ifdef HAVE_CONFIG_H 11 12 #include "config.h" 12 13 #endif /* HAVE_CONFIG_H */ 14 13 15 #include <misc/auxiliary.h> 14 16 15 17 #ifdef HAVE_FACTORY 18 16 19 #define SI_DONT_HAVE_GLOBAL_VARS 17 20 21 #include <misc/auxiliary.h> 22 #include "clapsing.h" 23 18 24 #include <factory/factory.h> 19 25 20 26 #ifdef HAVE_LIBFAC 21 # include <factory/libfac/libfac.h>27 # include <factory/libfac/libfac.h> 22 28 #endif 23 29 … … 36 42 //#include "polys.h" 37 43 #define TRANSEXT_PRIVATES 44 38 45 #include "ext_fields/transext.h" 39 46 40 47 41 #include "clapsing.h"42 48 #include "clapconv.h" 43 49 // #include <kernel/clapconv.h> 50 51 #include <polys/monomials/p_polys.h> 52 #include <polys/monomials/ring.h> 53 #include <polys/simpleideals.h> 54 #include <misc/intvec.h> 55 #include <polys/matpol.h> 56 #include <coeffs/bigintmat.h> 44 57 45 58 … … 455 468 } 456 469 } 457 470 #if 0 // not yet working 458 471 else if (rField_is_GF()) 459 472 { … … 463 476 res = convFactoryGFSingGF( F / G ); 464 477 } 465 478 #endif 466 479 else 467 480 WerrorS( feNotImplemented ); … … 701 714 // no break 702 715 case 1: ; 703 716 #ifdef TEST 704 717 default: ; 705 718 #endif 706 719 } 707 720 if (n==0) … … 733 746 Off(SW_RATIONAL); 734 747 On(SW_SYMMETRIC_FF); 735 748 #ifdef HAVE_NTL 736 749 extern int prime_number; 737 750 if(rField_is_Q(r)) prime_number=0; 738 751 #endif 739 752 CFFList L; 740 753 number N=NULL; … … 845 858 res->m[j] = convFactoryPSingP( J.getItem().factor(),r ); 846 859 } 847 860 #if 0 848 861 else if (rField_is_GF()) 849 862 res->m[j] = convFactoryGFSingGF( J.getItem().factor() ); 850 863 #endif 851 864 else if (rField_is_Extension(r)) /* Q(a), Fp(a) */ 852 865 { … … 890 903 { 891 904 int jj; 892 905 #ifdef FACTORIZE2_DEBUG 893 906 printf("factorize_retry\n"); 894 907 #endif 895 908 intvec *ww=NULL; 896 909 id_Test(res,r); … … 922 935 { 923 936 WarnS("problem with factorize"); 924 937 #if 0 925 938 pWrite(ff); 926 939 idShow(res); 927 940 #endif 928 941 id_Delete(&res,r); 929 942 res=idInit(2,1); … … 1027 1040 return res; 1028 1041 } 1029 #ifdef HAVE_NTL 1030 ideal singclap_absBiFactorize ( poly f, ideal & mipos, intvec ** exps, int & numFactors, const ring r) 1031 { 1032 p_Test(f, r); 1033 1034 ideal res=NULL; 1035 1036 int offs = rPar(r); 1037 if (f==NULL) 1038 { 1039 res= idInit (1, 1); 1040 mipos= idInit (1, 1); 1041 mipos->m[0]= convFactoryPSingTrP (Variable (offs), r); //overkill 1042 (*exps)=new intvec (1); 1043 (**exps)[0]= 1; 1044 numFactors= 0; 1045 return res; 1046 } 1047 CanonicalForm F( convSingTrPFactoryP( f, r) ); 1048 1049 if (getNumVars (F) > 2) 1050 { 1051 WerrorS( feNotImplemented ); 1052 return res; 1053 } 1054 CFAFList absFactors= absFactorize (F); 1055 1056 int n= absFactors.length(); 1057 *exps=new intvec (n); 1058 1059 res= idInit (n, 1); 1060 1061 mipos= idInit (n, 1); 1062 1063 Variable x= Variable (offs); 1064 Variable alpha; 1065 int i= 0; 1066 numFactors= 0; 1067 int count; 1068 CFAFListIterator iter= absFactors; 1069 CanonicalForm lead= iter.getItem().factor(); 1070 if (iter.getItem().factor().inCoeffDomain()) 1071 { 1072 i++; 1073 iter++; 1074 } 1075 bool isRat= isOn (SW_RATIONAL); 1076 if (!isRat) 1077 On (SW_RATIONAL); 1078 for (; iter.hasItem(); iter++, i++) 1079 { 1080 (**exps)[i]= iter.getItem().exp(); 1081 alpha= iter.getItem().minpoly().mvar(); 1082 if (iter.getItem().minpoly().isOne()) 1083 lead /= power (bCommonDen (iter.getItem().factor()), iter.getItem().exp()); 1084 else 1085 lead /= power (power (bCommonDen (iter.getItem().factor()), degree (iter.getItem().minpoly())), iter.getItem().exp()); 1086 res->m[i]= convFactoryPSingTrP (replacevar (iter.getItem().factor()*bCommonDen (iter.getItem().factor()), alpha, x), r); 1087 if (iter.getItem().minpoly().isOne()) 1088 { 1089 count= iter.getItem().exp(); 1090 mipos->m[i]= convFactoryPSingTrP (x,r); 1091 } 1092 else 1093 { 1094 count= iter.getItem().exp()*degree (iter.getItem().minpoly()); 1095 mipos->m[i]= convFactoryPSingTrP (replacevar (iter.getItem().minpoly(), alpha, x), r); 1096 } 1097 numFactors += count; 1098 } 1099 if (!isRat) 1100 Off (SW_RATIONAL); 1101 1102 (**exps)[0]= 1; 1103 res->m[0]= convFactoryPSingTrP (lead, r); 1104 mipos->m[0]= convFactoryPSingTrP (x, r); 1105 return res; 1106 } 1107 #endif 1042 1108 1043 ideal singclap_sqrfree ( poly f, intvec ** v , int with_exps, const ring r) 1109 1044 { … … 1723 1658 return mm; 1724 1659 } 1660 1661 ideal singclap_absBiFactorize ( poly f, ideal & mipos, intvec ** exps, int & numFactors, const ring r) 1662 { 1663 p_Test(f, r); 1664 1665 ideal res=NULL; 1666 1667 int offs = rPar(r); 1668 if (f==NULL) 1669 { 1670 res= idInit (1, 1); 1671 mipos= idInit (1, 1); 1672 mipos->m[0]= convFactoryPSingTrP (Variable (offs), r); //overkill 1673 (*exps)=new intvec (1); 1674 (**exps)[0]= 1; 1675 numFactors= 0; 1676 return res; 1677 } 1678 CanonicalForm F( convSingTrPFactoryP( f, r) ); 1679 1680 if (getNumVars (F) > 2) 1681 { 1682 WerrorS( feNotImplemented ); 1683 return res; 1684 } 1685 CFAFList absFactors= absFactorize (F); 1686 1687 int n= absFactors.length(); 1688 *exps=new intvec (n); 1689 1690 res= idInit (n, 1); 1691 1692 mipos= idInit (n, 1); 1693 1694 Variable x= Variable (offs); 1695 Variable alpha; 1696 int i= 0; 1697 numFactors= 0; 1698 int count; 1699 CFAFListIterator iter= absFactors; 1700 CanonicalForm lead= iter.getItem().factor(); 1701 if (iter.getItem().factor().inCoeffDomain()) 1702 { 1703 i++; 1704 iter++; 1705 } 1706 bool isRat= isOn (SW_RATIONAL); 1707 if (!isRat) 1708 On (SW_RATIONAL); 1709 for (; iter.hasItem(); iter++, i++) 1710 { 1711 (**exps)[i]= iter.getItem().exp(); 1712 alpha= iter.getItem().minpoly().mvar(); 1713 if (iter.getItem().minpoly().isOne()) 1714 lead /= power (bCommonDen (iter.getItem().factor()), iter.getItem().exp()); 1715 else 1716 lead /= power (power (bCommonDen (iter.getItem().factor()), degree (iter.getItem().minpoly())), iter.getItem().exp()); 1717 res->m[i]= convFactoryPSingTrP (replacevar (iter.getItem().factor()*bCommonDen (iter.getItem().factor()), alpha, x), r); 1718 if (iter.getItem().minpoly().isOne()) 1719 { 1720 count= iter.getItem().exp(); 1721 mipos->m[i]= convFactoryPSingTrP (x,r); 1722 } 1723 else 1724 { 1725 count= iter.getItem().exp()*degree (iter.getItem().minpoly()); 1726 mipos->m[i]= convFactoryPSingTrP (replacevar (iter.getItem().minpoly(), alpha, x), r); 1727 } 1728 numFactors += count; 1729 } 1730 if (!isRat) 1731 Off (SW_RATIONAL); 1732 1733 (**exps)[0]= 1; 1734 res->m[0]= convFactoryPSingTrP (lead, r); 1735 mipos->m[0]= convFactoryPSingTrP (x, r); 1736 return res; 1737 } 1738 1725 1739 #endif 1726 #endif 1740 #endif /* HAVE_NTL */ 1727 1741 1728 1742 -
libpolys/polys/clapsing.h
rb7f609 r3426545 7 7 */ 8 8 9 10 9 #ifndef INCL_FACTORYSING_H 11 10 #define INCL_FACTORYSING_H 12 11 13 14 12 #ifdef HAVE_FACTORY 15 13 16 #include <polys/monomials/p_polys.h> 17 #include <polys/monomials/ring.h> 18 #include <polys/simpleideals.h> 19 #include <misc/intvec.h> 20 #include <polys/matpol.h> 21 #include <coeffs/bigintmat.h> 14 class bigintmat; 15 class intvec; 16 17 struct snumber; typedef struct snumber * number; 18 struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec * poly; 19 struct ip_sring; typedef struct ip_sring * ring; 20 struct sip_sideal; typedef struct sip_sideal * ideal; 21 22 class ip_smatrix; typedef ip_smatrix * matrix; 23 24 struct n_Procs_s; typedef struct n_Procs_s *coeffs; 25 22 26 //#include <polys/clapconv.h> 23 27 //#include <kernel/longtrans.h> … … 45 49 ideal singclap_sqrfree ( poly f, intvec ** v , int with_exps, const ring r ); 46 50 47 # ifdef HAVE_NTL48 # if 149 matrix singntl_HNF(matrix A, const ring r);51 # ifdef HAVE_NTL 52 # if 1 53 matrix singntl_HNF(matrix A, const ring r); 50 54 intvec* singntl_HNF(intvec* A, const ring r); 51 matrix singntl_LLL(matrix A, const ring r);55 matrix singntl_LLL(matrix A, const ring r); 52 56 intvec* singntl_LLL(intvec* A, const ring r); 57 53 58 ideal singclap_absBiFactorize ( poly f, ideal & mipos, intvec ** exps, int & n, const ring r); 54 # endif55 # endif59 # endif 60 # endif 56 61 57 62 BOOLEAN singclap_isSqrFree(poly f, const ring r); 58 63 59 # ifdef HAVE_LIBFAC64 # ifdef HAVE_LIBFAC 60 65 matrix singclap_irrCharSeries ( ideal I, const ring r); 61 66 char* singclap_neworder ( ideal I, const ring r); 62 # endif67 # endif 63 68 64 69 poly singclap_det( const matrix m, const ring r ); … … 71 76 #endif /* HAVE_FACTORY */ 72 77 73 74 78 #endif /* INCL_FACTORYSING_H */ 75 79
Note: See TracChangeset
for help on using the changeset viewer.