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

Function rCompose

Singular/ipshell.cc:2780–3057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2778}
2779
2780ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask,const int isLetterplace)
2781{
2782 if ((L->nr!=3)
2783#ifdef HAVE_PLURAL
2784 &&(L->nr!=5)
2785#endif
2786 )
2787 return NULL;
2788 int is_gf_char=0;
2789 // 0: char/ cf - ring
2790 // 1: list (var)
2791 // 2: list (ord)
2792 // 3: qideal
2793 // possibly:
2794 // 4: C
2795 // 5: D
2796
2797 ring R = (ring) omAlloc0Bin(sip_sring_bin);
2798
2799 // ------------------------------------------------------------------
2800 // 0: char:
2801 if (L->m[0].Typ()==CRING_CMD)
2802 {
2803 R->cf=(coeffs)L->m[0].Data();
2804 R->cf->ref++;
2805 }
2806 else if (L->m[0].Typ()==INT_CMD)
2807 {
2808 int ch = (int)(long)L->m[0].Data();
2809 assume( ch >= 0 );
2810
2811 if (ch == 0) // Q?
2812 R->cf = nInitChar(n_Q, NULL);
2813 else
2814 {
2815 int l = IsPrime(ch); // Zp?
2816 if( l != ch )
2817 {
2818 Warn("%d is invalid characteristic of ground field. %d is used.", ch, l);
2819 ch = l;
2820 }
2821 #ifndef TEST_ZN_AS_ZP
2822 R->cf = nInitChar(n_Zp, (void*)(long)ch);
2823 #else
2824 mpz_t modBase;
2825 mpz_init_set_ui(modBase,(long) ch);
2826 ZnmInfo info;
2827 info.base= modBase;
2828 info.exp= 1;
2829 R->cf=nInitChar(n_Zn,(void*) &info); //exponent is missing
2830 R->cf->is_field=1;
2831 R->cf->is_domain=1;
2832 R->cf->has_simple_Inverse=1;
2833 #endif
2834 }
2835 }
2836 else if (L->m[0].Typ()==LIST_CMD) // something complicated...
2837 {

Callers 1

jjLISTRINGFunction · 0.85

Calls 15

omAlloc0BinFunction · 0.85
nInitCharFunction · 0.85
IsPrimeFunction · 0.85
WarnFunction · 0.85
rComposeRingFunction · 0.85
rComposeCFunction · 0.85
WerrorSFunction · 0.85
rComposeVarFunction · 0.85
rComposeOrderFunction · 0.85
rRenameVarsFunction · 0.85
rCompleteFunction · 0.85
rChangeCurrRingFunction · 0.85

Tested by

no test coverage detected