File: interpretertester

package info (click to toggle)
singular 1%3A4.1.1-p2%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 35,856 kB
  • sloc: cpp: 288,280; ansic: 17,387; lisp: 4,242; yacc: 1,654; python: 1,608; makefile: 1,424; lex: 1,387; perl: 632; sh: 567; xml: 182
file content (143 lines) | stat: -rw-r--r-- 2,524 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
ring r=0,(x,y,z),lp;
int a=12345;
poly f=10;
ideal i=x,y;
module m=x*gen(1),y*gen(2);
list l=f,i;
intvec iv=1,2,3,45,5,6,7,8;
timer=1;
string s="sdgjgdksdgjs";
proc myprintmat(matrix m){
  print(m);
}
proc stringproc1(){
    return("blubber");
}
proc listproc1(list l){
    print(l);
    list erg=1,list(2,2784);
    return(erg);
}
proc testproc1(){
print("Hallo Welt");
return(1);
}
proc testproc2(poly p){
print("Hallo Welt");
print(p*p);
return(p*p+p*p*p);
}
proc testproc3(vector p){
print("Hallo Welt ihr Vektoren");
print(p);
return(p);
}
proc testproc4(number p){
print("Hallo Welt ihr Numbers");
print(p);
return(p);
}

proc testproc5(int p){
print("Hallo Welt ihr ints");
print(p);
return(p);
}
proc testproc6(poly p, poly q){
  matrix m[3][10];
  int i;
  int j;
  for(i=1;i<=3;i++){
    for(j=1;j<=10;j++){
	m[i,j]=p^i*q^j;
    }
  }

  return(m);
}

proc testproc7(module p){
print("Hallo Welt ihr Modules");
print(p);
return(p);
}
proc testproc8(intvec iv){
    print("Hallo Welt ihr Intvecs");
    print(iv);
    return(iv);
}

list mylist=1,2,3;
LIB("python_module.so");
Python_module::python("from Singular import *

from interpreter import *
functions=SingularGlobalsProxy()
functions.setring(functions.r)
print functions.mylist;
functions.mylist=[1,2,[5,6]]
print functions.mylist
print functions.s
functions.s='only a example'
print functions.s
functions.__getattr__('print')('Python ist fun und fun und fun')
print functions.f
print functions.i
firstl=functions.l
print firstl
print functions.listproc1([1,[3,6]])
print functions.stringproc1()
for i in firstl:
    print i

x=functions.var(1)
y=functions.var(2)
i=Ideal()
i.append(x)
i.append(x+y)
print i
print functions.groebner(i);
#print functions.std(i);
xy=x*y
functions.f=xy

xye1=xy*gen(1)

print functions.testproc2(xy)
print functions.testproc3(xye1)
print functions.testproc4(Number(3243287))
print functions.testproc5(325)
print functions.testproc6(x,y)
print functions.testproc7(functions.m)
print functions.testproc8(tuple(range(10)))
from Singular import foo2;
m=functions.testproc6(x,y)
functions.myprintmat(m)
print functions.a
print 'Read module:', functions.m

print i
print 'suc1'
print i
print functions.std(i)
print functions.random(1,10)
print 'hallo'
print functions.intersect(i,i,i,i)

v=IntVector()
v.append(12)
v.append(13)
print len(v)
print v

print 'calling print'
functions.__getattr__('print')(Ring());
print 'the end'
print functions.ringlist(Ring())
print functions.iv
functions.iv=v
print functions.iv
");
print(f);

$