- Timestamp:
- 10/18/18 16:16:31 (6 years ago)
- Location:
- branches/2915-AbsoluteSymbol
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2915-AbsoluteSymbol
- Property svn:mergeinfo changed
-
branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs
r15583 r16240 37 37 string[] variableNames, double[] coefficients, 38 38 double @const = 0) { 39 39 40 if (factorCoefficients.Length == 0 && coefficients.Length == 0) throw new ArgumentException(); 40 ISymbolicExpressionTree p1 = null; 41 42 // Create tree for double variables 43 ISymbolicExpressionTree tree = null; 41 44 if (coefficients.Length > 0) { 42 p1 = CreateTree(variableNames, new int[variableNames.Length], coefficients, @const); 43 if (factorCoefficients.Length == 0) 44 return p1; 45 tree = CreateTree(variableNames, new int[variableNames.Length], coefficients, @const); 46 if (factorCoefficients.Length == 0) return tree; 45 47 } 48 49 // Create tree for string variables 50 ISymbolicExpressionTree factorTree = null; 46 51 if (factorCoefficients.Length > 0) { 47 var p2 = CreateTree(factors, factorCoefficients); 48 if (p1 == null) return p2; 52 factorTree = CreateTree(factors, factorCoefficients, @const); 53 if (tree == null) return factorTree; 54 } 49 55 50 // combine51 ISymbolicExpressionTreeNode add = p1.Root.GetSubtree(0).GetSubtree(0);52 foreach (var binFactorNode in p2.IterateNodesPrefix().OfType<BinaryFactorVariableTreeNode>())53 add.AddSubtree(binFactorNode);54 return p1;55 } 56 // Combine both trees 57 ISymbolicExpressionTreeNode add = tree.Root.GetSubtree(0).GetSubtree(0); 58 foreach (var binFactorNode in factorTree.IterateNodesPrefix().OfType<BinaryFactorVariableTreeNode>()) 59 add.InsertSubtree(add.SubtreeCount - 1, binFactorNode); 60 return tree; 61 56 62 throw new ArgumentException(); 57 63 } -
branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeSimplifier.cs
r16239 r16240 1236 1236 // $ * 1.0 => $ 1237 1237 return a; 1238 } else if (IsConstant(b) && ((ConstantTreeNode)b).Value.IsAlmost(0.0)) { 1239 return MakeConstant(0); 1238 1240 } else if (IsConstant(b) && IsVariableBase(a)) { 1239 1241 // multiply constants into variables weights -
branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r16238 r16240 139 139 <Compile Include="Converters\LinearModelToTreeConverter.cs" /> 140 140 <Compile Include="Converters\TreeSimplifier.cs" /> 141 <Compile Include="Converters\DerivativeCalculator.cs" /> 141 142 <Compile Include="Converters\TreeToAutoDiffTermConverter.cs" /> 142 143 <Compile Include="Formatters\InfixExpressionFormatter.cs" /> … … 144 145 <Compile Include="Formatters\SymbolicDataAnalysisExpressionMathematicaFormatter.cs" /> 145 146 <Compile Include="Formatters\SymbolicDataAnalysisExpressionCSharpFormatter.cs" /> 147 <Compile Include="Hashing\HashExtensions.cs" /> 148 <Compile Include="Hashing\HashUtil.cs" /> 149 <Compile Include="Hashing\SymbolicExpressionTreeHash.cs" /> 146 150 <Compile Include="Importer\InfixExpressionParser.cs" /> 147 151 <Compile Include="Importer\SymbolicExpressionImporter.cs" />
Note: See TracChangeset
for help on using the changeset viewer.