Changeset 1ba856 in git


Ignore:
Timestamp:
Aug 5, 2019, 1:54:09 PM (4 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
621203ad7373159254c97525b77e9edda2f36c37
Parents:
31212ff491b316ea34617fe1509cfbc676781d4b
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2019-08-05 13:54:09+02:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2019-08-06 17:17:17+02:00
Message:
allow "real" and "complex" in create_ring()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/standard.lib

    r31212ff r1ba856  
    25172517static proc parse_L1(string l1)
    25182518{
     2519  list tokens;
    25192520  if (find(l1, "(", 1) == 0)   // no parentheses
    25202521  {
    2521       return(int(l1));
    2522   }
    2523   list tokens = tuple_to_tokens(l1);
     2522    tokens[1] = l1;
     2523  }
     2524  else
     2525  {
     2526    tokens = tuple_to_tokens(l1);
     2527  }
     2528  if (tokens[1] == "real")
     2529  {
     2530    int p1 = 6;
     2531    int p2 = 6;
     2532    if (size(tokens) > 1)
     2533    {
     2534      p1 = int(tokens[2]);
     2535      p2 = p1;
     2536    }
     2537    if (size(tokens) > 2)
     2538    {
     2539      p2 = int(tokens[3]);
     2540    }
     2541    return(list(0, list(p1, p2)));
     2542  }
     2543  if (tokens[1] == "complex")
     2544  {
     2545    int p1 = 6;
     2546    int p2 = 6;
     2547    string imag_unit = "i";
     2548    if (int(tokens[size(tokens)]) == 0)   // not an integer
     2549    {
     2550      imag_unit = tokens[size(tokens)];
     2551      tokens = delete(tokens, size(tokens));
     2552    }
     2553    if (size(tokens) > 1)
     2554    {
     2555      p1 = int(tokens[2]);
     2556      p2 = p1;
     2557    }
     2558    if (size(tokens) > 2)
     2559    {
     2560      p2 = int(tokens[3]);
     2561    }
     2562    return(list(0, list(p1, p2), imag_unit));
     2563  }
    25242564  if (size(tokens) == 1)
    25252565  {
    2526       return(int(tokens[1]));
     2566    return(int(tokens[1]));
    25272567  }
    25282568  list L = int(tokens[1]);
     
    25372577  if (v[1, 4] == "var(" && defined(basering))
    25382578  {
    2539       int i = int(v[5,size(v)-5]);
    2540       v = ringlist(basering)[2][i];
     2579    int i = int(v[5,size(v)-5]);
     2580    v = ringlist(basering)[2][i];
    25412581  }
    25422582  return(v);
     
    25522592  if (find(l2, "(", 1) == 0)   // no parentheses
    25532593  {
    2554       return(list(parse_var(l2)));
     2594    return(list(parse_var(l2)));
    25552595  }
    25562596  list V = tuple_to_tokens(l2);
    25572597  for (int i = size(V); i > 0; i--)
    25582598  {
    2559       V[i] = parse_var(V[i]);
     2599    V[i] = parse_var(V[i]);
    25602600  }
    25612601  return(V);
Note: See TracChangeset for help on using the changeset viewer.