/usr/share/axiom-20170501/src/algebra/ASP24.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 | )abbrev domain ASP24 Asp24
++ 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{Asp24} produces Fortran for Type 24 ASPs which evaluate a
++multivariate function at a point (needed for NAG routine e04jaf),
++for example:
++
++\tab{5}SUBROUTINE FUNCT1(N,XC,FC)\br
++\tab{5}DOUBLE PRECISION FC,XC(N)\br
++\tab{5}INTEGER N\br
++\tab{5}FC=10.0D0*XC(4)**4+(-40.0D0*XC(1)*XC(4)**3)+(60.0D0*XC(1)**2+5\br
++\tab{4}&.0D0)*XC(4)**2+((-10.0D0*XC(3))+(-40.0D0*XC(1)**3))*XC(4)+16.0D0*X\br
++\tab{4}&C(3)**4+(-32.0D0*XC(2)*XC(3)**3)+(24.0D0*XC(2)**2+5.0D0)*XC(3)**2+\br
++\tab{4}&(-8.0D0*XC(2)**3*XC(3))+XC(2)**4+100.0D0*XC(2)**2+20.0D0*XC(1)*XC(\br
++\tab{4}&2)+10.0D0*XC(1)**4+XC(1)**2\br
++\tab{5}RETURN\br
++\tab{5}END\br
Asp24(name) : SIG == CODE where
name : Symbol
FST ==> FortranScalarType
FT ==> FortranType
SYMTAB ==> SymbolTable
RSFC ==> Record(localSymbols:SymbolTable,code:List(FortranCode))
FSTU ==> Union(fst:FST,void:"void")
FEXPR ==> FortranExpression([],['XC],MachineFloat)
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 : FSTU := ["real"::FST]$FSTU
syms : SYMTAB := empty()
declare!(N,fortranInteger(),syms)$SYMTAB
xcType : FT := construct(real,[N::Symbol],false)$FT
declare!(XC,xcType,syms)$SYMTAB
declare!(FC,fortranReal(),syms)$SYMTAB
Rep := FortranProgram(name,["void"]$FSTU,[N,XC,FC],syms)
coerce(c:List FortranCode):$ == coerce(c)$Rep
coerce(r:RSFC):$ == coerce(r)$Rep
coerce(c:FortranCode):$ == coerce(c)$Rep
coerce(u:FEXPR):$ ==
coerce(assign(FC,u::Expression(MachineFloat))$FortranCode)$Rep
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:$):OutputForm == coerce(u)$Rep
outputAsFortran(u):Void ==
p := checkPrecision()$NAGLinkSupportPackage
outputAsFortran(u)$Rep
p => restorePrecision()$NAGLinkSupportPackage
|