Changeset 3fcc98e in git


Ignore:
Timestamp:
Jan 31, 2020, 10:23:58 AM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
ef6df21e3783870d5dd988a568b01c19e2ccbbb5
Parents:
a17747d8c42415aaf1eace9c5b94db3a73b73dd1
Message:
towards python3
Location:
Singular/dyn_modules/python
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/python/cart.py

    ra17747 r3fcc98e  
    2020def cartn(sequence, n):
    2121  tocombine=list(itertools.repeat(sequence,n))
    22   return itertools.imap(tuple,xcombine(*tocombine))
     22  return list(map(tuple,xcombine(*tocombine)))
    2323
    2424if __name__=='__main__':
    2525  for i in cartn([1,2,3],4):
    26     print i
     26    print(i)
  • Singular/dyn_modules/python/perf.py

    ra17747 r3fcc98e  
    22n=number(1);
    33s=number(0)
    4 for i in xrange(1000000):
     4for i in range(1000000):
    55        s=s+n
    6 print s
     6print(s)
  • Singular/dyn_modules/python/symm.py

    ra17747 r3fcc98e  
    11from probstat import Cartesian
    2 from itertools import repeat,imap, ifilter
     2from itertools import repeat
    33from util import EquivalenceRelation
    44from interpreter import *
     
    2828
    2929colors=3
    30 value_range=[modPNumber(i,colors) for i in xrange(colors)]
     30value_range=[modPNumber(i,colors) for i in range(colors)]
    3131
    3232wrel=EquivalenceRelation()
     
    3434  wrel[i]=-i
    3535weights_canonical_to_index=dict((weight,i+1) \
    36     for (i,weight) in enumerate(ifilter( \
     36    for (i,weight) in enumerate(filter( \
    3737        wrel.isCanonical,value_range)))
    3838wtrans=dict((weight,weights_canonical_to_index[wrel.canonical(weight)]) for weight in \
     
    4242
    4343def constr_variations():
    44   return imap(tuple,Cartesian(list(repeat(value_range,6))))
     44  return list(map(tuple,Cartesian(list(repeat(value_range,6)))))
    4545relation=EquivalenceRelation()
    4646for (a,b,c,d,e,f) in constr_variations():
     
    4848  relation[(a,b,c,d,e,f)]=(a,-d,-e,-b,-c,-f)
    4949canonical_to_index=dict((symbol,weights+i+1) for (i,symbol) in \
    50     enumerate(ifilter( \
     50    enumerate(filter( \
    5151       relation.isCanonical,constr_variations())))
    5252vartrans=dict((symbol,canonical_to_index[relation.canonical(symbol)]) for symbol in \
     
    6363r=create_ring(char=0,nvars=weights+symbols)
    6464r.set()
    65 print r
     65print(r)
    6666myideal=Ideal()
    6767def polysum(l):
     
    9090back_table_joint=dict(back_table_v)
    9191back_table_joint.update(back_table_w)
    92 print "back", back_table_joint
    93 print "original length",len(myideal)
    94 print "now calculating"
     92print(("back", back_table_joint))
     93print(("original length",len(myideal)))
     94print("now calculating")
    9595myideal=singular.simplify(myideal,4)
    96 print "simplified", len(myideal)
     96print(("simplified", len(myideal)))
    9797gb=singular.slimgb(myideal)
    98 print gb
    99 print len(gb), "GB elements"
     98print(gb)
     99print((len(gb), "GB elements"))
  • Singular/dyn_modules/python/util.py

    ra17747 r3fcc98e  
    55def create_ring(char=0, nvars=1, varNames=None, ordering="dp", degvec=None, register=None):
    66  if not varNames:
    7     varNames=["x("+str(i)+")" for i in xrange(1,nvars+1)]
     7    varNames=["x("+str(i)+")" for i in range(1,nvars+1)]
    88  else:
    99    nvars=len(varNames)
    1010  if not degvec:
    1111    degvec=IntVector()
    12     for i in xrange(0,nvars):
     12    for i in range(0,nvars):
    1313      degvec.append(1)
    1414  modulweights=IntVector()
Note: See TracChangeset for help on using the changeset viewer.