anchor.diff:      
           if not ops.changed then printfn "Using default options.\n"
   
  +        let benchmarks = 
  +            match ops.benchmarks with 
  +            | [] -> ["bench1"; "bench2"] 
  +            | xss -> xss
  +
  +        let modes = 
  +            match ops.modes with 
  +            | [] -> [ "auto"; "numeric"] 
  +            | xss -> xss
  +
  +        let bench1 = List.contains "bench1" benchmarks 
  +        let bench2 = List.contains "bench2" benchmarks 
  +        let auto = List.contains "auto" modes
  +        let numeric = List.contains "numeric" modes
  +
           let n = ops.repetitions
           let nsymbolic = n / 1000
           let noriginal = n * 10
  
positive.code:         stream.WriteLine(sprintf "Total duration: %A\r\n" duration)
          stream.WriteLine(sprintf "Benchmark score: %A\r\n" score)
      
          stream.WriteLine("Benchmark matrix 1\r\n")
          stream.WriteLine("Column labels: {diff, diff2, diffn, grad, gradv, hessian, hessianv, gradhessian, gradhessianv, laplacian, jacobian, jacobianv, jacobianT, jacobianTv}")
          stream.WriteLine("Row labels: {DiffSharp.AD, Diffsharp.Numerical}")
          stream.WriteLine(sprintf "Values: %s" (bench.ToMathematicaString()))
  
          stream.WriteLine("\n\nBenchmark matrix 2\r\n")
          stream.WriteLine("Column labels: {diff', diff2', diffn', grad', gradv', hessian', hessianv', gradhessian', gradhessianv', laplacian', jacobian', jacobianv', jacobianT', jacobianTv'}")
          stream.WriteLine("Row labels: {DiffSharp.AD, Diffsharp.Numerical}")
          stream.WriteLine(sprintf "Values: %s" (bench'.ToMathematicaString()))
  
          stream.Flush()
          stream.Close()
  
negative.code:               x |> Array.sumBy (fun v -> exp (cos v))|]
          let fvvD (x:DV) =
              toDV [x * log (x / 2.); exp (sin x) |> DV.sum; exp (cos x) |> DV.sum]
  
          let run_fss =      duration "eval" noriginal (fun () -> fss x)
          let run_fssD =     duration "evalD" noriginal (fun () -> fssD xD)
          let run_fvs =      duration "eval" noriginal (fun () -> fvs xv)
          let run_fvsD =     duration "evalD" noriginal (fun () -> fvsD xvD)
          let run_fvv =      duration "eval" noriginal (fun () -> fvv xv)
          let run_fvvD =     duration "evalD" noriginal (fun () -> fvvD xvD)
  
          let run_diff_AD =  duration "diff (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.diff fssD xD)
          let run_diff_N =   duration "diff (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.diff fss x)
  
          let run_diff2_AD = duration "diff2 (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.diff2 fssD xD)
          let run_diff2_N =  duration "diff2 (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.diff2 fss x)
  
          let run_diffn_AD = duration "diffn (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.diffn 2 fssD xD)
          let run_diffn_N() =  0.
  
          let run_grad_AD =  duration "grad (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.grad fvsD xvD)
          let run_grad_N =   duration "grad (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.grad fvs xv)
          
          let run_gradv_AD = duration "gradv (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.gradv fvsD xvD vvD)
          let run_gradv_N =  duration "gradv (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.gradv fvs xv vv)
  
          let run_hessian_AD =  duration "hessian (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.hessian fvsD xvD)
          let run_hessian_N =   duration "hessian (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.hessian fvs xv)
          
          let run_hessianv_AD = duration "hessianv (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.hessianv fvsD xvD vvD)
          let run_hessianv_N =  duration "hessianv (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.hessianv fvs xv vv)
  
          let run_gradhessian_AD =  duration "gradhessian (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.gradhessian fvsD xvD)
          let run_gradhessian_N =   duration "gradhessian (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.gradhessian fvs xv)
          
          let run_gradhessianv_AD = duration "gradhessianv (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.gradhessianv fvsD xvD vvD)
          let run_gradhessianv_N =  duration "gradhessianv (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.gradhessianv fvs xv vv)
  
          let run_laplacian_AD =  duration "laplacian (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.laplacian fvsD xvD)
          let run_laplacian_N =   duration "laplacian (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.laplacian fvs xv)
  
          let run_jacobian_AD =  duration "jacobian (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobian fvvD xvD)
          let run_jacobian_N =   duration "jacobian (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.jacobian fvv xv)
  
          let run_jacobianv_AD =  duration "jacobianv (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobianv fvvD xvD vvD)
          let run_jacobianv_N =   duration "jacobianv (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.jacobianv fvv xv vv)
          
          let run_jacobianT_AD =  duration "jacobianT (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobianT fvvD xvD)
          let run_jacobianT_N =   duration "jacobianT (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.jacobianT fvv xv)
  
          let run_jacobianTv_AD =  duration "jacobianTv (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobianTv fvvD xvD zvD)
          let run_jacobianTv_N () =   0.
  
  
          let run_diff'_AD =  duration "diff' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.diff' fssD xD)
          let run_diff'_N =   duration "diff' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.diff' fss x)
  
          let run_diff2'_AD = duration "diff2' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.diff2' fssD xD)
          let run_diff2'_N =  duration "diff2' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.diff2' fss x)
  
          let run_diffn'_AD = duration "diffn' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.diffn' 2 fssD xD)
          let run_diffn'_N() =  0.
  
          let run_grad'_AD =  duration "grad' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.grad' fvsD xvD)
          let run_grad'_N =   duration "grad' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.grad' fvs xv)
          
          let run_gradv'_AD = duration "gradv' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.gradv' fvsD xvD vvD)
          let run_gradv'_N =  duration "gradv' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.gradv' fvs xv vv)
  
          let run_hessian'_AD =  duration "hessian' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.hessian' fvsD xvD)
          let run_hessian'_N =   duration "hessian' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.hessian' fvs xv)
          
          let run_hessianv'_AD = duration "hessianv' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.hessianv' fvsD xvD vvD)
          let run_hessianv'_N =  duration "hessianv' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.hessianv' fvs xv vv)
  
          let run_gradhessian'_AD =  duration "gradhessian' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.gradhessian' fvsD xvD)
          let run_gradhessian'_N =   duration "gradhessian' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.gradhessian' fvs xv)
          
          let run_gradhessianv'_AD = duration "gradhessianv' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.gradhessianv' fvsD xvD vvD)
          let run_gradhessianv'_N =  duration "gradhessianv' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.gradhessianv' fvs xv vv)
  
          let run_laplacian'_AD =  duration "laplacian' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.laplacian' fvsD xvD)
          let run_laplacian'_N =   duration "laplacian' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.laplacian' fvs xv)
  
          let run_jacobian'_AD =  duration "jacobian' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobian' fvvD xvD)
          let run_jacobian'_N =   duration "jacobian' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.jacobian' fvv xv)
  
          let run_jacobianv'_AD =  duration "jacobianv' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobianv' fvvD xvD vvD)
          let run_jacobianv'_N =   duration "jacobianv' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.jacobianv' fvv xv vv)
          
          let run_jacobianT'_AD =  duration "jacobianT' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobianT' fvvD xvD)
          let run_jacobianT'_N =   duration "jacobianT' (numeric)" n (fun () -> DiffSharp.Numerical.Float64.DiffOps.jacobianT' fvv xv)
  
          let run_jacobianTv'_AD =  duration "jacobianTv' (auto)" n (fun () -> DiffSharp.AD.Float64.DiffOps.jacobianTv' fvvD xvD zvD)
          let run_jacobianTv'_N () =   0.
  
          let finished = System.DateTime.Now
          let duration = finished - started
          printfn "Benchmarking finished: %A\n" finished
          printfn "Total duration: %A\n" duration
  
          let row_originals  = 
              let fss = run_fss()
              let fvs = run_fvs()
              toDV [fss;      fss;       fss;       fvs;      fvs;       fvs;         fvs;          fvs;             fvs;              fvs;           run_fvv();          run_fvv();           run_fvv();           run_fvv()]
          let row_originalsD = 
              let fssD = run_fssD()
              let fvsD = run_fvsD()
              toDV [fssD;     fssD;      fssD;      fvsD;     fvsD;      fvsD;        fvsD;         fvsD;            fvsD;             fvsD;          run_fvvD();         run_fvvD();          run_fvvD();          run_fvvD()]
          let row_AD()         = toDV [run_diff_AD();  run_diff2_AD();  run_diffn_AD();  run_grad_AD();  run_gradv_AD();  run_hessian_AD();  run_hessianv_AD();  run_gradhessian_AD();  run_gradhessianv_AD();  run_laplacian_AD();  run_jacobian_AD();  run_jacobianv_AD();  run_jacobianT_AD();  run_jacobianTv_AD()]
          let row_N()          = toDV [run_diff_N();   run_diff2_N();   run_diffn_N();   run_grad_N();   run_gradv_N();   run_hessian_N();   run_hessianv_N();   run_gradhessian_N();   run_gradhessianv_N();   run_laplacian_N();   run_jacobian_N();   run_jacobianv_N();   run_jacobianT_N();   run_jacobianTv_N()]
          let row'_AD()        = toDV [run_diff'_AD(); run_diff2'_AD(); run_diffn'_AD(); run_grad'_AD(); run_gradv'_AD(); run_hessian'_AD(); run_hessianv'_AD(); run_gradhessian'_AD(); run_gradhessianv'_AD(); run_laplacian'_AD(); run_jacobian'_AD(); run_jacobianv'_AD(); run_jacobianT'_AD(); run_jacobianTv'_AD()]
          let row'_N()         = toDV [run_diff'_N();  run_diff2'_N();  run_diffn'_N();  run_grad'_N();  run_gradv'_N();  run_hessian'_N();  run_hessianv'_N();  run_gradhessian'_N();  run_gradhessianv'_N();  run_laplacian'_N();  run_jacobian'_N();  run_jacobianv'_N();  run_jacobianT'_N();  run_jacobianTv'_N()]
  
                
          let bench = 
              [ if bench1  then 
                  if auto then  yield row_AD() ./ row_originalsD
                  if numeric then yield  row_N()  ./ row_originals 
                if bench2 then 
                  if auto then yield row'_AD() ./ row_originalsD
                  if numeric then yield row'_N()  ./ row_originals ]
              |> DM.ofRows 
  
          let score = float (DM.sum bench)
      
          let score = 1. / score
          let score = int (score * 100000000.)
  
          printfn "Benchmark score: %A\n" score
  
  