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

Function rComposeC

Singular/ipshell.cc:2250–2299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2248}
2249
2250void rComposeC(lists L, ring R)
2251/* field is R or C */
2252{
2253 // ----------------------------------------
2254 // 0: char/ cf - ring
2255 if ((L->m[0].rtyp!=INT_CMD) || (L->m[0].data!=(char *)0))
2256 {
2257 WerrorS("invalid coeff. field description, expecting 0");
2258 return;
2259 }
2260// R->cf->ch=0;
2261 // ----------------------------------------
2262 // 0, (r1,r2) [, "i" ]
2263 if (L->m[1].rtyp!=LIST_CMD)
2264 {
2265 WerrorS("invalid coeff. field description, expecting precision list");
2266 return;
2267 }
2268 lists LL=(lists)L->m[1].data;
2269 if ((LL->nr!=1)
2270 || (LL->m[0].rtyp!=INT_CMD)
2271 || (LL->m[1].rtyp!=INT_CMD))
2272 {
2273 WerrorS("invalid coeff. field description list, expected list(`int`,`int`)");
2274 return;
2275 }
2276 int r1=(int)(long)LL->m[0].data;
2277 int r2=(int)(long)LL->m[1].data;
2278 r1=si_min(r1,32767);
2279 r2=si_min(r2,32767);
2280 LongComplexInfo par; memset(&par, 0, sizeof(par));
2281 par.float_len=r1;
2282 par.float_len2=r2;
2283 if (L->nr==2) // complex
2284 {
2285 if (L->m[2].rtyp!=STRING_CMD)
2286 {
2287 WerrorS("invalid coeff. field description, expecting parameter name");
2288 return;
2289 }
2290 par.par_name=(char*)L->m[2].data;
2291 R->cf = nInitChar(n_long_C, &par);
2292 }
2293 else if ((r1<=SHORT_REAL_LENGTH) && (r2<=SHORT_REAL_LENGTH)) /* && L->nr==1*/
2294 R->cf = nInitChar(n_R, NULL);
2295 else /* && L->nr==1*/
2296 {
2297 R->cf = nInitChar(n_long_R, &par);
2298 }
2299}
2300
2301void rComposeRing(lists L, ring R)
2302/* field is R or C */

Callers 1

rComposeFunction · 0.85

Calls 3

WerrorSFunction · 0.85
si_minFunction · 0.85
nInitCharFunction · 0.85

Tested by

no test coverage detected