Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17630


Ignore:
Timestamp:
06/23/20 16:11:21 (4 years ago)
Author:
pfleck
Message:

#3040

  • Added aggregation symbols to latex formatter.
  • Use boldsymbol for vector-variables.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs

    r17180 r17630  
    2828using HeuristicLab.Core;
    2929using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     30
     31using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>;
    3032
    3133namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    239241          constIndex++;
    240242        }
     243
     244        if (varNode.DataType == typeof(DoubleVector)) strBuilder.Append("\\boldsymbol{");
    241245        strBuilder.Append(EscapeLatexString(varNode.VariableName));
     246        if (varNode.DataType == typeof(DoubleVector)) strBuilder.Append("}"); // boldsymbol end
    242247        strBuilder.Append(LagToString(currentLag));
    243248      } else if (node.Symbol is ProgramRootSymbol) {
     
    280285        constIndex++;
    281286        strBuilder.Append(@" \left( " + p + @"\cdot ");
     287      } else if (node.Symbol is Sum) {
     288        strBuilder.Append(@"\operatorname{sum}\left(");
     289      } else if (node.Symbol is Mean) {
     290        strBuilder.Append(@"\operatorname{mean}\left(");
     291      } else if (node.Symbol is Length) {
     292        strBuilder.Append(@"\operatorname{length}\left(");
     293      } else if (node.Symbol is StandardDeviation) {
     294        strBuilder.Append(@"\operatorname{stdev}\left(");
     295      } else if (node.Symbol is Variance) {
     296        strBuilder.Append(@"\operatorname{var}\left(");
    282297      } else {
    283298        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
     
    511526      } else if (node.Symbol is VariableCondition) {
    512527        strBuilder.Append(@"\right) ");
     528      } else if (node.Symbol is Sum) {
     529        strBuilder.Append(@"\right) ");
     530      } else if (node.Symbol is Mean) {
     531        strBuilder.Append(@"\right) ");
     532      } else if (node.Symbol is Length) {
     533        strBuilder.Append(@"\right) ");
     534      } else if (node.Symbol is StandardDeviation) {
     535        strBuilder.Append(@"\right) ");
     536      } else if (node.Symbol is Variance) {
     537        strBuilder.Append(@"\right) ");
    513538      } else {
    514539        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
     
    532557
    533558    private string EscapeLatexString(string s) {
    534       return "\\text{" +
     559      return "\\mathrm{" +
    535560        s
    536561         .Replace("\\", "\\\\")
Note: See TracChangeset for help on using the changeset viewer.