Changeset 8952 for trunk/sources/HeuristicLab.ExtLibs
- Timestamp:
- 11/27/12 13:35:51 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.AutoDiff/1.0/AutoDiff-1.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.AutoDiff/1.0/AutoDiff-1.0/CompiledDifferentiator.cs
r8703 r8952 54 54 ReverseSweep(); 55 55 56 var gradient = tape.Take(Dimension).Select(elem => elem.Adjoint).ToArray(); 57 var value = tape.Last().Value; 56 var gradient = new double[Dimension]; 57 for (int i = 0; i < Dimension; i++) 58 gradient[i] = tape[i].Adjoint; 59 var value = tape.Last().Value; 58 60 59 61 return Tuple.Create(gradient, value); -
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.AutoDiff/1.0/AutoDiff-1.0/ParametricCompiledTerm.cs
r8703 r8952 20 20 public double Evaluate(double[] arg, double[] parameters) 21 21 { 22 var combinedArg = arg.Concat(parameters).ToArray(); 22 var combinedArg = new double[arg.Length + parameters.Length]; 23 arg.CopyTo(combinedArg, 0); 24 parameters.CopyTo(combinedArg, arg.Length); 23 25 return compiledTerm.Evaluate(combinedArg); 24 26 } … … 26 28 public Tuple<double[], double> Differentiate(double[] arg, double[] parameters) 27 29 { 28 var combinedArg = arg.Concat(parameters).ToArray(); 30 var combinedArg = new double[arg.Length + parameters.Length]; 31 arg.CopyTo(combinedArg, 0); 32 parameters.CopyTo(combinedArg, arg.Length); 29 33 var diffResult = compiledTerm.Differentiate(combinedArg); 30 34
Note: See TracChangeset
for help on using the changeset viewer.