This file is indexed.

/usr/share/axiom-20170501/src/algebra/ATTRBUT.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
)abbrev domain ATTRBUT AttributeButtons
++ Author: Brian Dupee
++ Date Created: April 1996
++ Date Last Updated: December 1997
++ Description:
++ \axiomType{AttributeButtons} implements a database and associated
++ adjustment mechanisms for a set of attributes.
++
++ For ODEs these attributes are "stiffness", "stability" (how much
++ affect the cosine or sine component of the solution has on the stability of
++ the result), "accuracy" and "expense" (how expensive is the evaluation
++ of the ODE).  All these have bearing on the cost of calculating the 
++ solution given that reducing the step-length to achieve greater accuracy 
++ requires considerable number of evaluations and calculations.
++
++ The effect of each of these attributes can be altered by increasing or
++ decreasing the button value.
++
++ For Integration there is a button for increasing and decreasing the preset
++ number of function evaluations for each method.  This is automatically used
++ by ANNA when a method fails due to insufficient workspace or where the
++ limit of function evaluations has been reached before the required
++ accuracy is achieved. 

AttributeButtons() : SIG == CODE where

  F     ==> Float
  ST    ==> String
  LST   ==> List String
  Rec   ==> Record(key:Symbol,entry:Any)
  RList ==> List(Record(key:Symbol,entry:Any))
  IFL   ==> List(Record(ifail:Integer,instruction:ST))
  Entry ==> Record(chapter:ST, type:ST, domainName: ST, 
                     defaultMin:F, measure:F, failList:IFL, explList:LST)

  SIG ==> SetCategory with

    increase : (ST,ST) -> F
      ++ \axiom{increase(routineName,attributeName)} increases the value
      ++ for the effect of the attribute \axiom{attributeName} with routine 
      ++ \axiom{routineName}.
      ++
      ++ \axiom{attributeName} should be one of the values
      ++ "stiffness", "stability", "accuracy", "expense" or
      ++ "functionEvaluations".

    increase : (ST) -> F
      ++ \axiom{increase(attributeName)} increases the value for the
      ++ effect of the attribute \axiom{attributeName} with all routines.
      ++
      ++ \axiom{attributeName} should be one of the values
      ++ "stiffness", "stability", "accuracy", "expense" or
      ++ "functionEvaluations".

    decrease : (ST,ST) -> F
      ++ \axiom{decrease(routineName,attributeName)} decreases the value
      ++ for the effect of the attribute \axiom{attributeName} with routine
      ++ \axiom{routineName}.
      ++
      ++ \axiom{attributeName} should be one of the values
      ++ "stiffness", "stability", "accuracy", "expense" or
      ++ "functionEvaluations".

    decrease : (ST) -> F
      ++ \axiom{decrease(attributeName)} decreases the value for the
      ++ effect of the attribute \axiom{attributeName} with all routines.
      ++
      ++ \axiom{attributeName} should be one of the values
      ++ "stiffness", "stability", "accuracy", "expense" or
      ++ "functionEvaluations".

    getButtonValue : (ST,ST) -> F
      ++ \axiom{getButtonValue(routineName,attributeName)} returns the 
      ++ current value for the effect of the attribute \axiom{attributeName}  
      ++ with routine \axiom{routineName}.
      ++
      ++ \axiom{attributeName} should be one of the values
      ++ "stiffness", "stability", "accuracy", "expense" or
      ++ "functionEvaluations".

    resetAttributeButtons : () -> Void 
      ++ \axiom{resetAttributeButtons()} resets the Attribute buttons to a 
      ++ neutral level.

    setAttributeButtonStep : (F) -> F
      ++ \axiom{setAttributeButtonStep(n)} sets the value of the steps for 
      ++ increasing and decreasing the button values. \axiom{n} must be 
      ++ greater than 0 and less than 1.  The preset value is 0.5.

    setButtonValue : (ST,F) -> F
      ++ \axiom{setButtonValue(attributeName,n)} sets the
      ++ value of all buttons of attribute \spad{attributeName}
      ++ to \spad{n}. \spad{n} must be in the range [0..1].
      ++
      ++ \axiom{attributeName} should be one of the values
      ++ "stiffness", "stability", "accuracy", "expense" or
      ++ "functionEvaluations".

    setButtonValue : (ST,ST,F) -> F
      ++ \axiom{setButtonValue(attributeName,routineName,n)} sets the
      ++ value of the button of attribute \spad{attributeName} to routine
      ++ \spad{routineName} to \spad{n}. \spad{n} must be in the range [0..1].
      ++
      ++ \axiom{attributeName} should be one of the values
      ++ "stiffness", "stability", "accuracy", "expense" or
      ++ "functionEvaluations".

    finiteAggregate

  CODE ==> add

    Rep := StringTable(F)
    import Rep

    buttons:() -> $

    buttons():$ == 
      eList := empty()$List(Record(key:ST,entry:F))
      l1:List String := ["stability","stiffness","accuracy","expense"]
      l2:List String := ["functionEvaluations"]
      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
      ro2 := selectIntegrationRoutines(r)$RoutinesTable
      k1:List String := [string(i)$Symbol for i in keys(ro1)$RoutinesTable]
      k2:List String := [string(i)$Symbol for i in keys(ro2)$RoutinesTable]
      for i in k1 repeat
        for j in l1 repeat
          e:Record(key:ST,entry:F) := [i j,0.5]
          eList := cons(e,eList)$List(Record(key:ST,entry:F))
      for i in k2 repeat
        for j in l2 repeat
          e:Record(key:ST,entry:F) := [i j,0.5]
          eList := cons(e,eList)$List(Record(key:ST,entry:F))
      construct(eList)$Rep

    attributeButtons:$ := buttons()

    attributeStep:F := 0.5

    setAttributeButtonStep(n:F):F ==
      positive?(n)$F and (n<1$F) => attributeStep:F := n
      error("setAttributeButtonStep",_
            "New value must be in (0..1)")$ErrorFunctions

    resetAttributeButtons():Void ==
      attributeButtons := buttons()
      void()$Void

    setButtonValue(routineName:ST,attributeName:ST,n:F):F ==
      f := search(routineName attributeName,attributeButtons)$Rep
      f case Float => 
        n>=0$F and n<=1$F => 
          setelt(attributeButtons,routineName attributeName,n)$Rep
        error("setAttributeButtonStep",_
              "New value must be in [0..1]")$ErrorFunctions
      error("setButtonValue","attribute name " attributeName 
             " not found for routine " routineName)$ErrorFunctions

    setButtonValue(attributeName:ST,n:F):F ==
      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
      ro2 := selectIntegrationRoutines(r)$RoutinesTable
      l1:List String := ["stability","stiffness","accuracy","expense"]
      l2:List String := ["functionEvaluations"]
      if attributeName="functionEvaluations" then
        for i in keys(ro2)$RoutinesTable repeat
          setButtonValue(string(i)$Symbol,attributeName,n)
      else
        for i in keys(ro1)$RoutinesTable repeat
          setButtonValue(string(i)$Symbol,attributeName,n)
      n

    increase(routineName:ST,attributeName:ST):F ==
      f := search(routineName attributeName,attributeButtons)$Rep
      f case Float => 
        newValue:F := (1$F-attributeStep)*f+attributeStep
        setButtonValue(routineName,attributeName,newValue)
      error("increase","attribute name " attributeName 
             " not found for routine " routineName)$ErrorFunctions

    increase(attributeName:ST):F ==
      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
      ro2 := selectIntegrationRoutines(r)$RoutinesTable
      l1:List String := ["stability","stiffness","accuracy","expense"]
      l2:List String := ["functionEvaluations"]
      if attributeName="functionEvaluations" then
        for i in keys(ro2)$RoutinesTable repeat
          increase(string(i)$Symbol,attributeName)
      else
        for i in keys(ro1)$RoutinesTable repeat
          increase(string(i)$Symbol,attributeName)
      getButtonValue(string(i)$Symbol,attributeName)

    decrease(routineName:ST,attributeName:ST):F ==
      f := search(routineName attributeName,attributeButtons)$Rep
      f case Float => 
        newValue:F := (1$F-attributeStep)*f
        setButtonValue(routineName,attributeName,newValue)
      error("increase","attribute name " attributeName 
             " not found for routine " routineName)$ErrorFunctions

    decrease(attributeName:ST):F ==
      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
      ro2 := selectIntegrationRoutines(r)$RoutinesTable
      l1:List String := ["stability","stiffness","accuracy","expense"]
      l2:List String := ["functionEvaluations"]
      if attributeName="functionEvaluations" then
        for i in keys(ro2)$RoutinesTable repeat
          decrease(string(i)$Symbol,attributeName)
      else
        for i in keys(ro1)$RoutinesTable repeat
          decrease(string(i)$Symbol,attributeName)
      getButtonValue(string(i)$Symbol,attributeName)


    getButtonValue(routineName:ST,attributeName:ST):F == 
      f := search(routineName attributeName,attributeButtons)$Rep
      f case Float => f
      error("getButtonValue","attribute name " attributeName 
              " not found for routine " routineName)$ErrorFunctions