- Timestamp:
- 04/03/12 00:32:03 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r7462 r7695 112 112 } else if (node.Symbol is Exponential) { 113 113 strBuilder.Append(@"\exp \left( "); 114 } else if (node.Symbol is Square) { 115 strBuilder.Append(@"\left("); 116 } else if (node.Symbol is SquareRoot) { 117 strBuilder.Append(@"\sqrt{"); 114 118 } else if (node.Symbol is Sine) { 115 119 strBuilder.Append(@"\sin \left( "); … … 209 213 } else if (node.Symbol is Exponential) { 210 214 throw new InvalidOperationException(); 215 } else if (node.Symbol is Square) { 216 throw new InvalidOperationException(); 217 } else if (node.Symbol is SquareRoot) { 218 throw new InvalidOperationException(); 211 219 } else if (node.Symbol is Sine) { 212 220 throw new InvalidOperationException(); … … 266 274 } else if (node.Symbol is Exponential) { 267 275 strBuilder.Append(@" \right) "); 276 } else if (node.Symbol is Square) { 277 strBuilder.Append(@"\right)^2"); 278 } else if (node.Symbol is SquareRoot) { 279 strBuilder.Append(@"}"); 268 280 } else if (node.Symbol is Sine) { 269 281 strBuilder.Append(@" \right) "); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
r7653 r7695 20 20 #endregion 21 21 22 using System.Globalization; 22 23 using System.Text; 23 using System.Linq;24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HeuristicLab. Common;26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Problems.DataAnalysis;28 using System.Collections.Generic;29 using System;30 using System.Globalization;31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;32 28 33 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 84 80 } 85 81 86 public string FormatOnlyExpression(ISymbolicExpressionTreeNode expressionNode) 87 { 82 public string FormatOnlyExpression(ISymbolicExpressionTreeNode expressionNode) { 88 83 var stringBuilder = new StringBuilder(); 89 84 stringBuilder.AppendLine(" for " + CurrentIndexVariable + " = 1:1:rows"); … … 151 146 } else if (symbol is Exponential) { 152 147 stringBuilder.Append("exp("); 148 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 149 stringBuilder.Append(")"); 150 } else if (symbol is Square) { 151 stringBuilder.Append("("); 152 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 153 stringBuilder.Append(").^2"); 154 } else if (symbol is SquareRoot) { 155 stringBuilder.Append("sqrt("); 153 156 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 154 157 stringBuilder.Append(")"); … … 283 286 284 287 285 private string LagToString(int lag) 286 { 288 private string LagToString(int lag) { 287 289 if (lag < 0) { 288 290 return "(" + CurrentIndexVariable + "" + lag + ")";
Note: See TracChangeset
for help on using the changeset viewer.