Changeset d8db70 in git


Ignore:
Timestamp:
Oct 9, 2009, 11:05:18 AM (14 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
6094f40a4b25fd0a3a901bd854053d0df6b84df3
Parents:
b85e375dee0ef1d2f9b2272975f133610b000b0a
Message:
changes of extra system command 'changeRing' to ease generation of Maple, M2, and Magma scripts


git-svn-id: file:///usr/local/Singular/svn/trunk@12178 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    rb85e37 rd8db70  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: extra.cc,v 1.323 2009-10-08 14:39:52 seelisch Exp $ */
     4/* $Id: extra.cc,v 1.324 2009-10-09 09:05:18 seelisch Exp $ */
    55/*
    66* ABSTRACT: general interface to internals of Singular ("system" command)
     
    22002200          {
    22012201            /*
    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).
    22092205            The purpose of this rewriting is to eliminate indexed variables,
    22102206            as they may cause problems when generating scripts for Magma,
     
    22142210            newRing->ch = fc;
    22152211            newRing->N = varN;
     2212            char h[10];
    22162213            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;
    22212214            for (int i = 1; i <= varN; i++)
    22222215            {
    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);
    22382218            }
    22392219            newRing->wvhdl = (int **)omAlloc0(2 * sizeof(int_ptr));
Note: See TracChangeset for help on using the changeset viewer.