/usr/share/axiom-20170501/src/algebra/FCPAK1.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 | )abbrev package FCPAK1 FortranCodePackage1
++ Author: Grant Keady and Godfrey Nolan
++ Date Created: April 1993
++ Description:
++ \spadtype{FortranCodePackage1} provides some utilities for
++ producing useful objects in FortranCode domain.
++ The Package may be used with the FortranCode domain and its
++ \spad{printCode} or possibly via an outputAsFortran.
++ (The package provides items of use in connection with ASPs
++ in the AXIOM-NAG link and, where appropriate, naming accords
++ with that in IRENA.)
++ The easy-to-use functions use Fortran loop variables I1, I2,
++ and it is users' responsibility to check that this is sensible.
++ The advanced functions use SegmentBinding to allow users control
++ over Fortran loop variable names.
-- Later might add functions to build
-- diagonalMatrix from List, the FC version of the corresponding
-- AXIOM function from MatrixCategory;
-- bandedMatrix, the full-matrix-FC version of the corresponding
-- AXIOM function in BandedMatrix Domain
-- bandedSymmetricMatrix, the full-matrix-FC version of the corresponding
-- AXIOM function in BandedSymmetricMatrix Domain
FortranCodePackage1() : SIG == CODE where
NNI ==> NonNegativeInteger
PI ==> PositiveInteger
PIN ==> Polynomial(Integer)
SBINT ==> SegmentBinding(Integer)
SEGINT ==> Segment(Integer)
LSBINT ==> List(SegmentBinding(Integer))
SBPIN ==> SegmentBinding(Polynomial(Integer))
SEGPIN ==> Segment(Polynomial(Integer))
LSBPIN ==> List(SegmentBinding(Polynomial(Integer)))
FC ==> FortranCode
EXPRESSION ==> Union(Expression Integer,Expression Float,Expression Complex Integer,Expression Complex Float)
SIG ==> with
zeroVector : (Symbol,PIN) -> FC
++ zeroVector(s,p) \undocumented{}
zeroMatrix : (Symbol,PIN,PIN) -> FC
++ zeroMatrix(s,p,q) uses loop variables in the Fortran, I1 and I2
zeroMatrix : (Symbol,SBPIN,SBPIN) -> FC
++ zeroMatrix(s,b,d) in this version gives the user control
++ over names of Fortran variables used in loops.
zeroSquareMatrix : (Symbol,PIN) -> FC
++ zeroSquareMatrix(s,p) \undocumented{}
identitySquareMatrix : (Symbol,PIN) -> FC
++ identitySquareMatrix(s,p) \undocumented{}
CODE ==> add
import FC
zeroVector(fname:Symbol,n:PIN):FC ==
ue:Expression(Integer) := 0
i1:Symbol := "I1"::Symbol
lp1:PIN := 1::PIN
hp1:PIN := n
segp1:SEGPIN:= segment(lp1,hp1)$SEGPIN
segbp1:SBPIN := equation(i1,segp1)$SBPIN
ip1:PIN := i1::PIN
indices:List(PIN) := [ip1]
fa:FC := forLoop(segbp1,assign(fname,indices,ue)$FC)$FC
fa
zeroMatrix(fname:Symbol,m:PIN,n:PIN):FC ==
ue:Expression(Integer) := 0
i1:Symbol := "I1"::Symbol
lp1:PIN := 1::PIN
hp1:PIN := m
segp1:SEGPIN:= segment(lp1,hp1)$SEGPIN
segbp1:SBPIN := equation(i1,segp1)$SBPIN
i2:Symbol := "I2"::Symbol
hp2:PIN := n
segp2:SEGPIN:= segment(lp1,hp2)$SEGPIN
segbp2:SBPIN := equation(i2,segp2)$SBPIN
ip1:PIN := i1::PIN
ip2:PIN := i2::PIN
indices:List(PIN) := [ip1,ip2]
fa:FC :=forLoop(segbp1,forLoop(segbp2,assign(fname,indices,ue)$FC)$FC)$FC
fa
zeroMatrix(fname:Symbol,segbp1:SBPIN,segbp2:SBPIN):FC ==
ue:Expression(Integer) := 0
i1:Symbol := variable(segbp1)$SBPIN
i2:Symbol := variable(segbp2)$SBPIN
ip1:PIN := i1::PIN
ip2:PIN := i2::PIN
indices:List(PIN) := [ip1,ip2]
fa:FC :=forLoop(segbp1,forLoop(segbp2,assign(fname,indices,ue)$FC)$FC)$FC
fa
zeroSquareMatrix(fname:Symbol,n:PIN):FC ==
ue:Expression(Integer) := 0
i1:Symbol := "I1"::Symbol
lp1:PIN := 1::PIN
hp1:PIN := n
segp1:SEGPIN:= segment(lp1,hp1)$SEGPIN
segbp1:SBPIN := equation(i1,segp1)$SBPIN
i2:Symbol := "I2"::Symbol
segbp2:SBPIN := equation(i2,segp1)$SBPIN
ip1:PIN := i1::PIN
ip2:PIN := i2::PIN
indices:List(PIN) := [ip1,ip2]
fa:FC :=forLoop(segbp1,forLoop(segbp2,assign(fname,indices,ue)$FC)$FC)$FC
fa
identitySquareMatrix(fname:Symbol,n:PIN):FC ==
ue:Expression(Integer) := 0
u1:Expression(Integer) := 1
i1:Symbol := "I1"::Symbol
lp1:PIN := 1::PIN
hp1:PIN := n
segp1:SEGPIN:= segment(lp1,hp1)$SEGPIN
segbp1:SBPIN := equation(i1,segp1)$SBPIN
i2:Symbol := "I2"::Symbol
segbp2:SBPIN := equation(i2,segp1)$SBPIN
ip1:PIN := i1::PIN
ip2:PIN := i2::PIN
indice1:List(PIN) := [ip1,ip1]
indices:List(PIN) := [ip1,ip2]
fc:FC := forLoop(segbp2,assign(fname,indices,ue)$FC)$FC
f1:FC := assign(fname,indice1,u1)$FC
fl:List(FC) := [fc,f1]
fa:FC := forLoop(segbp1,block(fl)$FC)$FC
fa
|