MCPcopy Create free account
hub / github.com/Singular/Singular / pp_Divide

Function pp_Divide

kernel/polys.cc:174–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174poly pp_Divide(poly p, poly q, const ring r)
175{
176 if (q==NULL)
177 {
178 WerrorS("div. by 0");
179 return NULL;
180 }
181 if (p==NULL)
182 {
183 return NULL;
184 }
185 if ((pNext(q)!=NULL)||rIsPluralRing(r))
186 { /* This means that q != 0 consists of at least two terms*/
187 if(p_GetComp(p,r)==0)
188 {
189 if((rFieldType(r)==n_transExt)
190 &&(convSingTrP(p,r))
191 &&(convSingTrP(q,r))
192 &&(!rIsNCRing(r)))
193 {
194 poly res=singclap_pdivide(p, q, r);
195 return res;
196 }
197 else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
198 &&(!rField_is_Ring(r))
199 &&(!rIsNCRing(r)))
200 {
201 poly res=singclap_pdivide(p, q, r);
202 return res;
203 }
204 else
205 {
206 ideal vi=idInit(1,1); vi->m[0]=p_Copy(q,r);
207 ideal ui=idInit(1,1); ui->m[0]=p_Copy(p,r);
208 ideal R; matrix U;
209 ring save_ring=currRing;
210 if (r!=currRing) rChangeCurrRing(r);
211 int save_opt;
212 SI_SAVE_OPT1(save_opt);
213 si_opt_1 &= ~(Sy_bit(OPT_PROT));
214 ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
215 SI_RESTORE_OPT1(save_opt);
216 if (r!=save_ring) rChangeCurrRing(save_ring);
217 matrix T = id_Module2formatedMatrix(m,1,1,r);
218 p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
219 id_Delete((ideal *)&T,r);
220 id_Delete((ideal *)&U,r);
221 id_Delete(&R,r);
222 //vi->m[0]=NULL; ui->m[0]=NULL;
223 id_Delete(&vi,r);
224 id_Delete(&ui,r);
225 return p;
226 }
227 }
228 else
229 {
230 p=p_Copy(p,r);
231 int comps=p_MaxComp(p,r);

Callers 1

jjDIV_PFunction · 0.85

Calls 15

WerrorSFunction · 0.85
rIsPluralRingFunction · 0.85
rFieldTypeFunction · 0.85
convSingTrPFunction · 0.85
rIsNCRingFunction · 0.85
singclap_pdivideFunction · 0.85
idInitFunction · 0.85
p_CopyFunction · 0.85
rChangeCurrRingFunction · 0.85
idLiftFunction · 0.85
id_Module2formatedMatrixFunction · 0.85
id_DeleteFunction · 0.85

Tested by

no test coverage detected