5903 Intro Scientific Prog:
Optimization Function B: Specification

There are many algorithms to optimize a function f(x) given by .  Their run time is assessed by counting the number of times they evaluate f, the gradient of f, and the second gradient of f.  Your task is to make a function that computes (and counts the number and type of function calls) for the function defined by
   function definition
for a given value of n.  Extend your function from part A to also compute the gradient and hessian when requested.  The modification should follow relevant portions of part A.  In addition
  1. The driver should read a sequence from standard in (as always redirectable from a file)
  2. The integers (i1 i2 i3 - which are either 0 or 1)  indicate to compute f, and/or Df, and/or DDf respectively with 0 indicating compute and 1 indicating do not compute.  
  3. Modify your procedure from part A to take three additional integer arguments (stored and passed as a typedef array of three integers) which computes and stores the requested values.  For {1,1,1} the function should return the current counts of f, Df, and DDf evaluations in the typedef intgre structure.
  4. The output from the driver in main should be a list of the requested values (in the standard vector/matrix format we defined in class) printed to standard out followed by the total number of times each of f, Df, and DDf are called followed by a runtime in milli seconds.
  5. The function should be implemented in a separate file.
  6. You are not allowed to use global variables
  7. The code should be able to be run as "MyProg < in > out"
  8. You need to use either implicit rules or automatic variables in your makefile.
  9. Main should be brief and well documented.  
  10.  We will be exchanging this code.  
  11. As always ask in class if you do not understand what the specifications say.
  12. There was a request for some test values for the input vector x.vec I get f=0.113663 and the gradient and hessian are in the files GradF.vec, and HessianF.mat respectively