/usr/share/axiom-20170501/src/algebra/ASP73.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 144 145 146 147 148 149 150 151 152 153 | )abbrev domain ASP73 Asp73
++ Author: Mike Dewar, Grant Keady and Godfrey Nolan
++ Date Created: Mar 1993
++ Date Last Updated: 30 March 1994, 6 October 1994
++ References:
++ Hawk95 Two more links to NAG numerics involving CA systems
++ Kead93 Production of Argument SubPrograms in the AXIOM -- NAG link
++ Description:
++ \spadtype{Asp73} produces Fortran for Type 73 ASPs, needed for NAG routine
++ d03eef, for example:
++
++ \tab{5}SUBROUTINE PDEF(X,Y,ALPHA,BETA,GAMMA,DELTA,EPSOLN,PHI,PSI)\br
++ \tab{5}DOUBLE PRECISION ALPHA,EPSOLN,PHI,X,Y,BETA,DELTA,GAMMA,PSI\br
++ \tab{5}ALPHA=DSIN(X)\br
++ \tab{5}BETA=Y\br
++ \tab{5}GAMMA=X*Y\br
++ \tab{5}DELTA=DCOS(X)*DSIN(Y)\br
++ \tab{5}EPSOLN=Y+X\br
++ \tab{5}PHI=X\br
++ \tab{5}PSI=Y\br
++ \tab{5}RETURN\br
++ \tab{5}END
Asp73(name) : SIG == CODE where
name : Symbol
FST ==> FortranScalarType
FSTU ==> Union(fst:FST,void:"void")
FEXPR ==> FortranExpression(['X,'Y],[],MachineFloat)
FT ==> FortranType
SYMTAB ==> SymbolTable
RSFC ==> Record(localSymbols:SymbolTable,code:List(FortranCode))
FRAC ==> Fraction
POLY ==> Polynomial
EXPR ==> Expression
INT ==> Integer
FLOAT ==> Float
VEC ==> Vector
VF2 ==> VectorFunctions2
SIG ==> FortranVectorFunctionCategory with
coerce : VEC FEXPR -> $
++coerce(f) takes objects from the appropriate instantiation of
++\spadtype{FortranExpression} and turns them into an ASP.
CODE ==> add
syms : SYMTAB := empty()$SYMTAB
declare!(X,fortranReal(),syms) $SYMTAB
declare!(Y,fortranReal(),syms) $SYMTAB
declare!(ALPHA,fortranReal(),syms)$SYMTAB
declare!(BETA,fortranReal(),syms) $SYMTAB
declare!(GAMMA,fortranReal(),syms) $SYMTAB
declare!(DELTA,fortranReal(),syms) $SYMTAB
declare!(EPSOLN,fortranReal(),syms) $SYMTAB
declare!(PHI,fortranReal(),syms) $SYMTAB
declare!(PSI,fortranReal(),syms) $SYMTAB
Rep := FortranProgram(name,["void"]$FSTU,
[X,Y,ALPHA,BETA,GAMMA,DELTA,EPSOLN,PHI,PSI],syms)
-- To help the poor compiler!
localAssign(u:Symbol,v:FEXPR):FortranCode ==
assign(u,(v::EXPR MachineFloat)$FEXPR)$FortranCode
coerce(u:VEC FEXPR):$ ==
maxIndex(u) ^= 7 => error "Vector is not of dimension 7"
[localAssign(ALPHA@Symbol,elt(u,1)),_
localAssign(BETA@Symbol,elt(u,2)),_
localAssign(GAMMA@Symbol,elt(u,3)),_
localAssign(DELTA@Symbol,elt(u,4)),_
localAssign(EPSOLN@Symbol,elt(u,5)),_
localAssign(PHI@Symbol,elt(u,6)),_
localAssign(PSI@Symbol,elt(u,7)),_
returns()$FortranCode]$List(FortranCode)::$
coerce(c:FortranCode):$ == coerce(c)$Rep
coerce(r:RSFC):$ == coerce(r)$Rep
coerce(c:List FortranCode):$ == coerce(c)$Rep
coerce(u:$):OutputForm == coerce(u)$Rep
outputAsFortran(u):Void ==
p := checkPrecision()$NAGLinkSupportPackage
outputAsFortran(u)$Rep
p => restorePrecision()$NAGLinkSupportPackage
retract(u:VEC FRAC POLY INT):$ ==
v : VEC FEXPR := map(retract,u)$VF2(FRAC POLY INT,FEXPR)
v::$
retractIfCan(u:VEC FRAC POLY INT):Union($,"failed") ==
v:Union(VEC FEXPR,"failed"):=map(retractIfCan,u)$VF2(FRAC POLY INT,FEXPR)
v case "failed" => "failed"
(v::VEC FEXPR)::$
retract(u:VEC FRAC POLY FLOAT):$ ==
v : VEC FEXPR := map(retract,u)$VF2(FRAC POLY FLOAT,FEXPR)
v::$
retractIfCan(u:VEC FRAC POLY FLOAT):Union($,"failed") ==
v:Union(VEC FEXPR,"failed"):=_
map(retractIfCan,u)$VF2(FRAC POLY FLOAT,FEXPR)
v case "failed" => "failed"
(v::VEC FEXPR)::$
retract(u:VEC EXPR INT):$ ==
v : VEC FEXPR := map(retract,u)$VF2(EXPR INT,FEXPR)
v::$
retractIfCan(u:VEC EXPR INT):Union($,"failed") ==
v:Union(VEC FEXPR,"failed"):=map(retractIfCan,u)$VF2(EXPR INT,FEXPR)
v case "failed" => "failed"
(v::VEC FEXPR)::$
retract(u:VEC EXPR FLOAT):$ ==
v : VEC FEXPR := map(retract,u)$VF2(EXPR FLOAT,FEXPR)
v::$
retractIfCan(u:VEC EXPR FLOAT):Union($,"failed") ==
v:Union(VEC FEXPR,"failed"):=map(retractIfCan,u)$VF2(EXPR FLOAT,FEXPR)
v case "failed" => "failed"
(v::VEC FEXPR)::$
retract(u:VEC POLY INT):$ ==
v : VEC FEXPR := map(retract,u)$VF2(POLY INT,FEXPR)
v::$
retractIfCan(u:VEC POLY INT):Union($,"failed") ==
v:Union(VEC FEXPR,"failed"):=map(retractIfCan,u)$VF2(POLY INT,FEXPR)
v case "failed" => "failed"
(v::VEC FEXPR)::$
retract(u:VEC POLY FLOAT):$ ==
v : VEC FEXPR := map(retract,u)$VF2(POLY FLOAT,FEXPR)
v::$
retractIfCan(u:VEC POLY FLOAT):Union($,"failed") ==
v:Union(VEC FEXPR,"failed"):=map(retractIfCan,u)$VF2(POLY FLOAT,FEXPR)
v case "failed" => "failed"
(v::VEC FEXPR)::$
|