Changeset 6bb9d9 in git
- Timestamp:
- Dec 14, 2012, 4:52:05 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'cdfcdb8287f66bc6070028082cbbc6eff10e609b')
- Children:
- 8c6bd4d4de4c46d6d974085a44f6e1530d956d5a
- Parents:
- 2e85a17b690d4918b676bac33fbbe5a019e58dad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipshell.cc
r2e85a1 r6bb9d9 2018 2018 // 0: string: integer 2019 2019 // no further entries --> Z 2020 R->cf->modBase = (int_number) omAlloc(sizeof(mpz_t)); 2020 int_number modBase = NULL; 2021 unsigned int modExponent = 1; 2022 2023 modBase = (int_number) omAlloc(sizeof(mpz_t)); 2021 2024 if (L->nr == 0) 2022 2025 { 2023 mpz_init_set_ui( R->cf->modBase,0);2024 R->cf->modExponent = 1;2026 mpz_init_set_ui(modBase,0); 2027 modExponent = 1; 2025 2028 } 2026 2029 // ---------------------------------------- … … 2030 2033 if (L->m[1].rtyp!=LIST_CMD) Werror("invald data, expecting list of numbers"); 2031 2034 lists LL=(lists)L->m[1].data; 2032 mpz_init(R->cf->modBase);2033 2035 if ((LL->nr >= 0) && LL->m[0].rtyp == BIGINT_CMD) 2034 2036 { 2035 number modBase = (number) LL->m[0].data; 2036 nlGMP(modBase, (number) R->cf->modBase, R->cf); 2037 LL->m[0].data = (void *)modBase; 2038 } 2039 else if ((LL->nr >= 0) && LL->m[0].rtyp == INT_CMD) 2040 { 2041 mpz_set_ui(R->cf->modBase,(unsigned long) LL->m[0].data); 2037 number tmp= (number) LL->m[0].data; 2038 n_MPZ (modBase, tmp, coeffs_BIGINT); 2039 } 2040 else if (LL->nr >= 0 && LL->m[0].rtyp == INT_CMD) 2041 { 2042 mpz_init_set_ui(modBase,(unsigned long) LL->m[0].data); 2042 2043 } 2043 2044 else 2044 2045 { 2045 mpz_ set_ui(R->cf->modBase,0);2046 mpz_init_set_ui(modBase,0); 2046 2047 } 2047 2048 if (LL->nr >= 1) 2048 2049 { 2049 R->cf->modExponent = (unsigned long) LL->m[1].data;2050 modExponent = (unsigned long) LL->m[1].data; 2050 2051 } 2051 2052 else 2052 2053 { 2053 R->cf->modExponent = 1;2054 modExponent = 1; 2054 2055 } 2055 2056 } 2056 2057 // ---------------------------------------- 2057 if ((mpz_cmp_ui( R->cf->modBase, 1) == 0) && (mpz_cmp_ui(R->cf->modBase, 0) < 0))2058 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0)) 2058 2059 { 2059 2060 Werror("Wrong ground ring specification (module is 1)"); 2060 2061 return; 2061 2062 } 2062 if ( R->cf->modExponent < 1)2063 if (modExponent < 1) 2063 2064 { 2064 2065 Werror("Wrong ground ring specification (exponent smaller than 1"); … … 2066 2067 } 2067 2068 // module is 0 ---> integers 2068 if (mpz_cmp_ui(R->cf->modBase, 0) == 0) 2069 { 2070 R->cf->ch = 0; 2071 R->cf->ringtype = 4; 2069 if (mpz_cmp_ui(modBase, 0) == 0) 2070 { 2071 R->cf=nInitChar(n_Z,NULL); 2072 2072 } 2073 2073 // we have an exponent 2074 else if ( R->cf->modExponent > 1)2075 { 2076 R->cf->ch = R->cf->modExponent;2077 if ((mpz_cmp_ui( R->cf->modBase, 2) == 0) && (R->cf->modExponent <= 8*sizeof(NATNUMBER)))2074 else if (modExponent > 1) 2075 { 2076 //R->cf->ch = R->cf->modExponent; 2077 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(NATNUMBER))) 2078 2078 { 2079 2079 /* this branch should be active for modExponent = 2..32 resp. 2..64, 2080 2080 depending on the size of a long on the respective platform */ 2081 R->cf ->ringtype = 1; // Use Z/2^ch2081 R->cf=nInitChar(n_Z2m,(void*)(long)modExponent); // Use Z/2^ch 2082 2082 } 2083 2083 else 2084 2084 { 2085 R->cf->ringtype = 3; 2085 //ringtype 3 2086 ZnmInfo info; 2087 info.base= modBase; 2088 info.exp= modExponent; 2089 R->cf=nInitChar(n_Znm,(void*) &info); 2086 2090 } 2087 2091 } … … 2089 2093 else 2090 2094 { 2091 R->cf->ringtype = 2; 2092 R->cf->ch = mpz_get_ui(R->cf->modBase); 2095 //ringtype = 2; 2096 //const int ch = mpz_get_ui(modBase); 2097 ZnmInfo info; 2098 info.base= modBase; 2099 info.exp= modExponent; 2100 R->cf=nInitChar(n_Zn,(void*) &info); 2093 2101 } 2094 2102 }
Note: See TracChangeset
for help on using the changeset viewer.