This file is indexed.

/usr/share/axiom-20170501/src/algebra/E04NAFA.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
)abbrev domain E04NAFA e04nafAnnaType
++ Author: Brian Dupee
++ Date Created: February 1996
++ Date Last Updated: February 1996
++ References:
++ Dupe95 Using Computer Algebra to Choose and Apply Numerical Routines
++ Dewa92 Using Computer Algebra to Select Numerical Algorithms
++ Description:
++ \axiomType{e04nafAnnaType} is a domain of \axiomType{NumericalOptimization}
++ for the NAG routine E04NAF, an optimization routine for Quadratic functions.
++ The function
++ \axiomFun{measure} measures the usefulness of the routine E04NAF
++ for the given problem.  The function \axiomFun{numericalOptimization}
++ performs the optimization by using \axiomType{NagOptimisationPackage}.

e04nafAnnaType() : SIG == CODE where

  DF  ==> DoubleFloat
  EF  ==> Expression Float
  EDF  ==> Expression DoubleFloat
  PDF  ==> Polynomial DoubleFloat
  VPDF  ==> Vector Polynomial DoubleFloat
  LDF  ==> List DoubleFloat
  LOCDF  ==> List OrderedCompletion DoubleFloat
  MDF  ==> Matrix DoubleFloat
  MPDF  ==> Matrix Polynomial DoubleFloat
  MF  ==> Matrix Float
  MEF  ==> Matrix Expression Float
  LEDF  ==> List Expression DoubleFloat
  VEF  ==> Vector Expression Float
  NOA  ==> Record(fn:EDF, init:LDF, lb:LOCDF, cf:LEDF, ub:LOCDF)
  LSA  ==> Record(lfn:LEDF, init:LDF)
  EF2  ==> ExpressionFunctions2
  MI  ==> Matrix Integer
  INT  ==> Integer
  F  ==> Float
  NNI  ==> NonNegativeInteger
  S  ==> Symbol
  LS  ==> List Symbol
  MVCF  ==> MultiVariableCalculusFunctions
  ESTOOLS2 ==> ExpertSystemToolsPackage2
  SDF  ==> Stream DoubleFloat
  LSDF  ==> List Stream DoubleFloat
  SOCDF  ==> Segment OrderedCompletion DoubleFloat
  OCDF  ==> OrderedCompletion DoubleFloat

  SIG ==> NumericalOptimizationCategory 

  CODE ==> Result add

    Rep:=Result
    import Rep, NagOptimisationPackage
    import e04AgentsPackage,ExpertSystemToolsPackage

    measure(R:RoutinesTable,args:NOA) ==
      string:String := "e04naf is "
      argsFn:EDF := args.fn
      if not (quadratic?(argsFn) and linear?(args.cf)) then
       string :=
        concat(string,"for a quadratic function with linear constraints only.")
      (# string) < 20 => 
        string := concat(string,"recommended")
        [getMeasure(R,e04naf@Symbol)$RoutinesTable, string]
      [0.0,string]

    numericalOptimization(args:NOA) ==
      argsFn:EDF := args.fn
      c := args.cf
      listVars:List LS := _
         concat(variables(argsFn)$EDF,[variables(z)$EDF for z in c])
      n:NNI := #(v := sort(removeDuplicates(concat(listVars)$LS)$LS)$LS)
      A:MDF := linearMatrix(c,n)
      nclin:NNI := # linearPart(c)
      nrowa:NNI := max(1,nclin)
      big:DF := float(1,10,10)$DF
      fea:MDF := new(1,n+nclin,float(1053,-11,10)$DF)$MDF
      bl:MDF := mat(finiteBound(args.lb,float(1,21,10)$DF),n)
      bu:MDF := mat(finiteBound(args.ub,float(1,21,10)$DF),n)
      alin:EDF := splitLinear(argsFn)
      p:PDF := retract(alin)@PDF
      pl:List PDF := [coefficient(p,i,1)$PDF for i in v]
      cvec:MDF := mat([pdf2df j for j in pl],n)
      h1:MPDF := hessian(p,v)$MVCF(S,PDF,VPDF,LS)
      hess:MDF := map(pdf2df,h1)$ESTOOLS2(PDF,DF)
      h2:MEF := map(df2ef,hess)$ESTOOLS2(DF,EF)
      x := mat(args.init,n)
      istate:MI := zero(1,n+nclin)$MI
      lwork:INT := 2*n*(n+2*nclin)+nrowa
      qphess:Union(fn:FileName,fp:Asp20(QPHESS)):=[retract(h2)$Asp20(QPHESS)]
      out:Result:=e04naf(20,1,n,nclin,n+nclin,nrowa,n,n,big,A,bl,bu,cvec,fea,
                             hess,true,false,true,2*n,lwork,x,istate,-1,qphess)
      changeNameToObjf(obj@Symbol,out)