Changeset 17307
- Timestamp:
- 10/03/19 14:56:46 (5 years ago)
- Location:
- branches/2994-AutoDiffForIntervals
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/Dual.cs
r17303 r17307 25 25 public Dual<V> Sub(Dual<V> a) { v.Sub(a.v); dv.Sub(a.dv); return this; } 26 26 public Dual<V> AssignNeg(Dual<V> a) { v.AssignNeg(a.v); dv.AssignNeg(a.dv); return this; } 27 public Dual<V> AssignInv(Dual<V> a) { v.AssignInv(a.v); dv.AssignNeg(a.dv).Mul(v ).Mul(v); return this; } // (1/f(x))' = - f(x)' / f(x)^227 public Dual<V> AssignInv(Dual<V> a) { v.AssignInv(a.v); dv.AssignNeg(a.dv).Mul(v.IntPower(2).Inv()); return this; } // (1/f(x))' = - f(x)' / f(x)^2 28 28 29 29 // (a(x) * b(x))' = b(x)*a(x)' + b(x)'*a(x); … … 36 36 return this; 37 37 } 38 public Dual<V> Div(Dual<V> a) { Mul(a.Inv()); return this; } 38 public Dual<V> Div(Dual<V> a) { Mul(a.Inv()); return this; } // f(x) / g(x) = f(x) * 1/g(x) 39 39 40 40 public Dual<V> AssignExp(Dual<V> a) { v.AssignExp(a.v); dv.Assign(a.dv).Mul(v); return this; } // exp(f(x)) = exp(f(x))*f(x)' … … 42 42 43 43 public Dual<V> AssignIntPower(Dual<V> a, int p) { v.AssignIntPower(a.v, p); dv.Assign(a.dv).Scale(p).Mul(a.v.Clone().IntPower(p - 1)); return this; } 44 public Dual<V> AssignIntRoot(Dual<V> a, int r) { v.AssignIntRoot(a.v, r); dv.Assign(a.dv).Scale(1.0 / r). Mul(a.v.IntRoot(r -1)); return this; }44 public Dual<V> AssignIntRoot(Dual<V> a, int r) { v.AssignIntRoot(a.v, r); dv.Assign(a.dv).Scale(1.0 / r).Div(a.v.IntRoot(r).IntPower(r-1)); return this; } 45 45 46 46 public Dual<V> AssignSin(Dual<V> a) { v.AssignSin(a.v); dv.Assign(a.dv).Mul(a.v.Clone().Cos()); return this; } -
branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/MultivariateDual.cs
r17303 r17307 76 76 return this; 77 77 } 78 public MultivariateDual<V> Div(MultivariateDual<V> a) { v.Div(a.v); dv.Mul(a.dv.Inv()); return this; }78 public MultivariateDual<V> Div(MultivariateDual<V> a) { Mul(a.Inv()); return this; } // f(x) / g(x) 79 79 public MultivariateDual<V> AssignNeg(MultivariateDual<V> a) { v.AssignNeg(a.v); dv.AssignNeg(a.dv); return this; } 80 public MultivariateDual<V> AssignInv(MultivariateDual<V> a) { v.AssignInv(a.v); dv.AssignNeg(a.dv).Scale( v).Scale(v); return this; } // (1/f(x))' = - f(x)' / f(x)^280 public MultivariateDual<V> AssignInv(MultivariateDual<V> a) { v.AssignInv(a.v); dv.AssignNeg(a.dv).Scale(a.v.IntPower(2).Inv()); return this; } // (1/f(x))' = - f(x)' / f(x)^2 81 81 82 82 public MultivariateDual<V> AssignSin(MultivariateDual<V> a) { v.AssignSin(a.v); dv.Assign(a.dv).Scale(a.v.Clone().Cos()); return this; } … … 85 85 86 86 public MultivariateDual<V> AssignIntPower(MultivariateDual<V> a, int p) { v.AssignIntPower(a.v, p); dv.Assign(a.dv).Scale(p).Scale(a.v.Clone().IntPower(p - 1)); return this; } 87 public MultivariateDual<V> AssignIntRoot(MultivariateDual<V> a, int r) { v.AssignIntRoot(a.v, r); dv.Assign(a.dv).Scale(1.0 / r).Scale(a.v.IntRoot(r - 1)); return this; }87 public MultivariateDual<V> AssignIntRoot(MultivariateDual<V> a, int r) { v.AssignIntRoot(a.v, r); dv.Assign(a.dv).Scale(1.0 / r).Scale(a.v.IntRoot(r).IntPower(r - 1).Inv()); return this; } 88 88 89 89 public MultivariateDual<V> AssignExp(MultivariateDual<V> a) { v.AssignExp(a.v); dv.Assign(a.dv).Scale(v); return this; } // exp(f(x)) = exp(f(x))*f(x)' -
branches/2994-AutoDiffForIntervals/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r17289 r17307 599 599 <Compile Include="HeuristicLab.Persistence.Attic\UseCases.cs" /> 600 600 <Compile Include="HeuristicLab.PluginInfraStructure-3.3\TypeExtensionsTest.cs" /> 601 <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\AutoDiffInterpreterTest.cs" /> 601 602 <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\ClassificationVariableImpactCalculationTest.cs" /> 602 603 <Compile Include="HeuristicLab.Problems.DataAnalysis-3.4\DatasetTest.cs" />
Note: See TracChangeset
for help on using the changeset viewer.