scope.tst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. % Test SCOPE Package.
  2. % NOTE: The SCOPE, GHORNER, GSTRUCTR and GENTRAN packages must be loaded
  3. % to run these tests.
  4. on priall$
  5. optimize z:=a^2*b^2+10*a^2*m^6+a^2*m^2+2*a*b*m^4+2*b^2*m^6+b^2*m^2
  6. iname s;
  7. off priall$
  8. on primat,acinfo$
  9. optimize
  10. ghorner <<z:=a^2*b^2+10*a^2*m^6+a^2*m^2+2*a*b*m^4+2*b^2*m^6+b^2*m^2>>
  11. vorder m
  12. iname s;
  13. operator a$
  14. k:=j:=1$
  15. u:=c*x+d$
  16. v:=sin(u)$
  17. optimize {a(k,j):=v*(v^2*cos(u)^2+u),
  18. a(k,j)::=:v*(v^2*cos(u)^2+u)} iname s;
  19. off exp$
  20. optimize {a(k,j):=v*(v^2*cos(u)^2+u),
  21. a(k,j)::=:v*(v^2*cos(u)^2+u)} iname s;
  22. off primat,acinfo,period$
  23. on fort$
  24. optimize z:=(6*a+18*b+9*c+3*d+6*e+18*f+6*g+5*h+5*k+3)^13 iname s;
  25. optimize {x:=3*a*p,y:=3*a*q,z:=6*a*r+2*b*p,u:=6*a*d+2*b*q,
  26. v:=9*a*c+4*b*d,w:=4*b} iname s;
  27. off fort$
  28. clear a$
  29. matrix a(2,2)$
  30. a(1,1):=x+y+z$
  31. a(1,2):=x*y$
  32. a(2,1):=(x+y)*x*y$
  33. a(2,2):=(x+2*y+3)^3-x$
  34. on acinfo$
  35. optimize gstructr<<a;
  36. aa:=(x+y)^2;b:=(x+y)*(y+z);c:=(x+2*y)*(y+z)*(z+x)^2>>
  37. name v iname s;
  38. clear a$
  39. off fort;
  40. on priall$
  41. optimize z:=:for j:=2:6 sum a^(1/j) iname s;
  42. off acinfo,priall$
  43. on optdecs$
  44. optlang!*:='fortran$
  45. optimize {x(i+1,i-1):=a(i+1,i-1)+b(i),y(i-1):=a(i-1,i+1)-b(i)} iname s
  46. declare <<x(4),a(4,4),y(5):real;b(5):integer>>;
  47. optlang!*:='c$
  48. optimize {x(i+1,i-1):=a(i+1,i-1)+b(i),y(i-1):=a(i-1,i+1)-b(i)} iname s
  49. declare <<x(4),a(4,4),y(5):real;b(5):integer>>;
  50. optlang!*:= 'pascal$
  51. optimize {x(i+1,i-1):=a(i+1,i-1)+b(i),y(i-1):=a(i-1,i+1)-b(i)} iname s
  52. declare <<x(4),a(4,4),y(5):real;b(5):integer>>;
  53. optlang!*:='ratfor$
  54. optimize {x(i+1,i-1):=a(i+1,i-1)+b(i),y(i-1):=a(i-1,i+1)-b(i)} iname s
  55. declare <<x(4),a(4,4),y(5):real;b(5):integer>>;
  56. end;