Changeset 96f136 in git
- Timestamp:
- Feb 8, 2011, 2:57:14 PM (13 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 771339b035d62cf81e4a3ef0a2b6c35ea5273147
- Parents:
- 06fdbe869e26dea8a81df51c687bbbf427761929
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
r06fdbe r96f136 7864 7864 }; 7865 7865 #endif 7866 7866 static BOOLEAN jjFactModD_M(leftv res, leftv v) 7867 { 7868 /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y], 7869 see doc in /kernel/linearAlgebra.h 7870 7871 valid argument lists: 7872 - (poly h, int d), 7873 - (poly h, int d, poly f0, poly g0), optional: factors of h(0,y), 7874 - (poly h, int d, int xIndex, int yIndex), optional: indices of vars x & y 7875 in list of ring vars, 7876 - (poly h, int d, poly f0, poly g0, int xIndex, int yIndec), 7877 optional: all 4 optional args 7878 result: 7879 - list with the two factors f and g such that 7880 h(x,y) = f(x,y)*g(x,y) mod x^(d+1) */ 7881 7882 poly h = NULL; 7883 int d = 1; 7884 poly f0 = NULL; 7885 poly g0 = NULL; 7886 int xIndex = 1; /* default index if none provided */ 7887 int yIndex = 2; /* default index if none provided */ 7888 7889 leftv u = v; int factorsGiven = 0; 7890 if ((u == NULL) || (u->Typ() != POLY_CMD)) 7891 { 7892 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])"); 7893 return TRUE; 7894 } 7895 else h = (poly)u->Data(); 7896 u = u->next; 7897 if ((u == NULL) || (u->Typ() != INT_CMD)) 7898 { 7899 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])"); 7900 return TRUE; 7901 } 7902 else d = (int)(long)u->Data(); 7903 u = u->next; 7904 if ((u != NULL) && (u->Typ() == POLY_CMD)) 7905 { 7906 if ((u->next == NULL) || (u->next->Typ() != POLY_CMD)) 7907 { 7908 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])"); 7909 return TRUE; 7910 } 7911 else 7912 { 7913 f0 = (poly)u->Data(); 7914 g0 = (poly)u->next->Data(); 7915 factorsGiven = 1; 7916 u = u->next->next; 7917 } 7918 } 7919 if ((u != NULL) && (u->Typ() == INT_CMD)) 7920 { 7921 if ((u->next == NULL) || (u->next->Typ() != INT_CMD)) 7922 { 7923 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])"); 7924 return TRUE; 7925 } 7926 else 7927 { 7928 xIndex = (int)(long)u->Data(); 7929 yIndex = (int)(long)u->next->Data(); 7930 u = u->next->next; 7931 } 7932 } 7933 if (u != NULL) 7934 { 7935 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])"); 7936 return TRUE; 7937 } 7938 7939 /* checks for provided arguments */ 7940 if (pIsConstant(h) || (factorsGiven && (pIsConstant(f0) || pIsConstant(g0)))) 7941 { 7942 WerrorS("expected non-constant polynomial argument(s)"); 7943 return TRUE; 7944 } 7945 int n = rVar(currRing); 7946 if ((xIndex < 1) || (n < xIndex)) 7947 { 7948 Werror("index for variable x (%d) out of range [1..%d]", xIndex, n); 7949 return TRUE; 7950 } 7951 if ((yIndex < 1) || (n < yIndex)) 7952 { 7953 Werror("index for variable y (%d) out of range [1..%d]", yIndex, n); 7954 return TRUE; 7955 } 7956 if (xIndex == yIndex) 7957 { 7958 WerrorS("expected distinct indices for variables x and y"); 7959 return TRUE; 7960 } 7961 7962 /* computation of f0 and g0 if missing */ 7963 if (factorsGiven == 0) 7964 { 7965 #ifdef HAVE_FACTORY 7966 poly h0 = pSubst(pCopy(h), xIndex, NULL); 7967 intvec* v = NULL; 7968 ideal i = singclap_factorize(h0, &v, 0); 7969 if (i == NULL) return TRUE; 7970 ivTest(i); 7971 if ((v->rows() != 3) || ((*v)[0] =! 1) || (!nIsOne(pGetCoeff(i->m[0])))) 7972 { 7973 WerrorS("expected h(0,y) to have exactly two distinct monic factors"); 7974 return TRUE; 7975 } 7976 f0 = pPower(pCopy(i->m[1]), (*v)[1]); 7977 g0 = pPower(pCopy(i->m[2]), (*v)[2]); 7978 idDelete(&i); 7979 #else 7980 WerrorS("cannot factorize h(0,y) due to missing module 'factory'"); 7981 return TRUE; 7982 #endif 7983 } 7984 7985 poly f; poly g; 7986 henselFactors(xIndex, yIndex, h, f0, g0, d, f, g); 7987 lists L = (lists)omAllocBin(slists_bin); 7988 L->Init(2); 7989 L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f; 7990 L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g; 7991 res->rtyp = LIST_CMD; 7992 res->data = (char*)L; 7993 return FALSE; 7994 } 7867 7995 static BOOLEAN jjSTATUS_M(leftv res, leftv v) 7868 7996 { -
Singular/table.h
r06fdbe r96f136 858 858 ,{D(jjSTD_HILB_WP), STD_CMD, IDEAL_CMD, 4 , NO_PLURAL |ALLOW_RING} 859 859 ,{D(jjQRDS), QRDS_CMD, LIST_CMD, 4 , ALLOW_PLURAL |ALLOW_RING} 860 ,{D(jjFactModD_M),FMD_CMD, LIST_CMD, -2 , ALLOW_PLURAL |ALLOW_RING} 860 861 #ifdef HAVE_FANS 861 862 //,{D(jjADDADJ), ADDADJ_CMD, NONE, -2 , NO_PLURAL |NO_RING} … … 937 938 { "export", 0, EXPORT_CMD , EXPORT_CMD}, 938 939 { "exportto", 0, EXPORTTO_CMD , CMD_2}, 940 { "factmodd", 0, FMD_CMD , CMD_M}, 939 941 { "factorize", 0, FAC_CMD , CMD_12}, 940 942 { "farey", 0, FAREY_CMD , CMD_2}, -
Singular/tok.h
r06fdbe r96f136 84 84 FIND_CMD, 85 85 FACSTD_CMD, 86 FMD_CMD, 86 87 FWALK_CMD, 87 88 FGLM_CMD,
Note: See TracChangeset
for help on using the changeset viewer.