Changeset d8db70 in git
- Timestamp:
- Oct 9, 2009, 11:05:18 AM (14 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 6094f40a4b25fd0a3a901bd854053d0df6b84df3
- Parents:
- b85e375dee0ef1d2f9b2272975f133610b000b0a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
rb85e37 rd8db70 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.32 3 2009-10-08 14:39:52seelisch Exp $ */4 /* $Id: extra.cc,v 1.324 2009-10-09 09:05:18 seelisch Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 2200 2200 { 2201 2201 /* 2202 The following code creates a ring with characteristic fc, order dp and 2203 varN variables with the following names: var(j) is j written to the 2204 base of 26 with the digit '0' written as 'a', '1' as 'b', ..., and '25' 2205 as 'z'. 2206 I.e., var(1) has the name 'b', ..., var(25) the name 'z', 2207 var(26) the name 'ba', etc. 2208 Afterwards, the new ring will become the current ring. 2202 The following code creates and returns a ring with characteristic fc, 2203 order dp and varN variables with the names "x1", "x2", ..., "x4711" 2204 (in the case varN = 4711). 2209 2205 The purpose of this rewriting is to eliminate indexed variables, 2210 2206 as they may cause problems when generating scripts for Magma, … … 2214 2210 newRing->ch = fc; 2215 2211 newRing->N = varN; 2212 char h[10]; 2216 2213 newRing->names = (char **) omAlloc0(varN * sizeof(char_ptr)); 2217 char* alphabet = "abcdefghijklmnopqrstuvwxyz";2218 char theName[10];2219 char tempChars[10];2220 int j; int k; int l;2221 2214 for (int i = 1; i <= varN; i++) 2222 2215 { 2223 k = i; 2224 l = 9; 2225 j = k % 26; 2226 tempChars[l--] = alphabet[j]; 2227 k = (k - j) / 26; 2228 while (k != 0) 2229 { 2230 j = k % 26; 2231 tempChars[l--] = alphabet[j]; 2232 k = (k - j) / 26; 2233 } 2234 l++; 2235 for (j = l; j < 10; j++) theName[j - l] = tempChars[j]; 2236 theName[10 - l] = '\0'; 2237 newRing->names[i - 1] = omStrDup(theName); 2216 sprintf(h, "x%d", i); 2217 newRing->names[i - 1] = omStrDup(h); 2238 2218 } 2239 2219 newRing->wvhdl = (int **)omAlloc0(2 * sizeof(int_ptr));
Note: See TracChangeset
for help on using the changeset viewer.