/usr/share/axiom-20170501/src/algebra/ASP9.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 | )abbrev domain ASP9 Asp9
++ Author: Mike Dewar, Grant Keady and Godfrey Nolan
++ Date Created: Mar 1993
++ Date Last Updated: 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{Asp9} produces Fortran for Type 9 ASPs, needed for NAG routines
++ d02bhf, d02cjf, d02ejf.
++ These ASPs represent a function of a scalar X and a vector Y, for example:
++
++ \tab{5}DOUBLE PRECISION FUNCTION G(X,Y)\br
++ \tab{5}DOUBLE PRECISION X,Y(*)\br
++ \tab{5}G=X+Y(1)\br
++ \tab{5}RETURN\br
++ \tab{5}END
++
++ If the user provides a constant value for G, then extra information is added
++ via COMMON blocks used by certain routines. This specifies that the value
++ returned by G in this case is to be ignored.
Asp9(name) : SIG == CODE where
name : Symbol
FEXPR ==> FortranExpression(['X],['Y],MFLOAT)
MFLOAT ==> MachineFloat
FC ==> FortranCode
FST ==> FortranScalarType
FT ==> FortranType
SYMTAB ==> SymbolTable
RSFC ==> Record(localSymbols:SymbolTable,code:List(FortranCode))
UFST ==> Union(fst:FST,void:"void")
FRAC ==> Fraction
POLY ==> Polynomial
EXPR ==> Expression
INT ==> Integer
FLOAT ==> Float
SIG ==> FortranFunctionCategory with
coerce : FEXPR -> %
++coerce(f) takes an object from the appropriate instantiation of
++\spadtype{FortranExpression} and turns it into an ASP.
CODE ==> add
real : FST := "real"::FST
syms : SYMTAB := empty()$SYMTAB
declare!(X,fortranReal()$FT,syms)$SYMTAB
yType : FT := construct([real]$UFST,["*"::Symbol],false)$FT
declare!(Y,yType,syms)$SYMTAB
Rep := FortranProgram(name,[real]$UFST,[X,Y],syms)
retract(u:FRAC POLY INT):$ == (retract(u)@FEXPR)::$
retractIfCan(u:FRAC POLY INT):Union($,"failed") ==
foo : Union(FEXPR,"failed")
foo := retractIfCan(u)$FEXPR
foo case "failed" => "failed"
(foo::FEXPR)::$
retract(u:FRAC POLY FLOAT):$ == (retract(u)@FEXPR)::$
retractIfCan(u:FRAC POLY FLOAT):Union($,"failed") ==
foo : Union(FEXPR,"failed")
foo := retractIfCan(u)$FEXPR
foo case "failed" => "failed"
(foo::FEXPR)::$
retract(u:EXPR FLOAT):$ == (retract(u)@FEXPR)::$
retractIfCan(u:EXPR FLOAT):Union($,"failed") ==
foo : Union(FEXPR,"failed")
foo := retractIfCan(u)$FEXPR
foo case "failed" => "failed"
(foo::FEXPR)::$
retract(u:EXPR INT):$ == (retract(u)@FEXPR)::$
retractIfCan(u:EXPR INT):Union($,"failed") ==
foo : Union(FEXPR,"failed")
foo := retractIfCan(u)$FEXPR
foo case "failed" => "failed"
(foo::FEXPR)::$
retract(u:POLY FLOAT):$ == (retract(u)@FEXPR)::$
retractIfCan(u:POLY FLOAT):Union($,"failed") ==
foo : Union(FEXPR,"failed")
foo := retractIfCan(u)$FEXPR
foo case "failed" => "failed"
(foo::FEXPR)::$
retract(u:POLY INT):$ == (retract(u)@FEXPR)::$
retractIfCan(u:POLY INT):Union($,"failed") ==
foo : Union(FEXPR,"failed")
foo := retractIfCan(u)$FEXPR
foo case "failed" => "failed"
(foo::FEXPR)::$
coerce(u:FEXPR):% ==
expr : Expression MachineFloat := (u::Expression(MachineFloat))$FEXPR
(retractIfCan(u)@Union(MFLOAT,"failed"))$FEXPR case "failed" =>
coerce(expr)$Rep
locals : SYMTAB := empty()
charType : FT := _
construct(["character"::FST]$UFST,[6::POLY(INT)],false)$FT
declare!([CHDUM1,CHDUM2,GOPT1,CHDUM,GOPT2],charType,locals)$SYMTAB
common1 := common(CD02EJ,[CHDUM1,CHDUM2,GOPT1] )$FC
common2 := common(AD02CJ,[CHDUM,GOPT2] )$FC
assign1 := assign(GOPT1,"NOGOPT")$FC
assign2 := assign(GOPT2,"NOGOPT")$FC
result := assign(name,expr)$FC
code : List FC := [common1,common2,assign1,assign2,result]
([locals,code]$RSFC)::Rep
coerce(c:List FortranCode):% == coerce(c)$Rep
coerce(r:RSFC):% == coerce(r)$Rep
coerce(c:FortranCode):% == coerce(c)$Rep
coerce(u:%):OutputForm == coerce(u)$Rep
outputAsFortran(u):Void ==
p := checkPrecision()$NAGLinkSupportPackage
outputAsFortran(u)$Rep
p => restorePrecision()$NAGLinkSupportPackage
|