Changeset 17465
- Timestamp:
- 03/02/20 16:35:29 (5 years ago)
- Location:
- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentVectorExpressionGrammar.cs
r17463 r17465 185 185 AddAllowedChildSymbol(vectorroot, constant, 1); 186 186 #endregion 187 188 #region default enabled/disabled 189 var disabledByDefault = new[] { 190 TrigonometricFunctionsName, ExponentialFunctionsName, PowerFunctionsName, 191 VectorTrigonometricFunctionsName, VectorExponentialFunctionsName, VectorPowerFunctionsName 192 }; 193 foreach (var grp in Symbols.Where(sym => disabledByDefault.Contains(sym.Name))) 194 grp.Enabled = false; 195 #endregion 187 196 } 188 197 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeVectorInterpreter.cs
r17463 r17465 152 152 153 153 public DoubleVector Vector { get; } 154 public bool IsVector => Vector != null; 155 //public bool IsVector => !(Vector.Count == 1 && double.IsNaN(Vector[0])); 154 public bool IsVector => !(Vector.Count == 1 && double.IsNaN(Vector[0])); 156 155 157 156 public bool IsNaN => !IsScalar && !IsVector; … … 159 158 public EvaluationResult(double scalar) { 160 159 Scalar = scalar; 161 //Vector = NaNVector; 162 Vector = null; 160 Vector = NaNVector; 163 161 } 164 162 public EvaluationResult(DoubleVector vector) { … … 174 172 } 175 173 174 private static readonly DoubleVector NaNVector = DoubleVector.Build.Dense(1, double.NaN); 176 175 public static readonly EvaluationResult NaN = new EvaluationResult(double.NaN); 177 //private static readonly DoubleVector NaNVector = DoubleVector.Build.Dense(1, double.NaN);178 176 } 179 177 … … 188 186 if (lhs.IsVector && rhs.IsVector && vvFunc != null) return new EvaluationResult(vvFunc(lhs.Vector, rhs.Vector)); 189 187 return EvaluationResult.NaN; 190 //throw new NotSupportedException($"Unsupported combination of argument types: ({lhs}) / ({rhs})");191 188 } 192 189 … … 197 194 if (val.IsVector && vFunc != null) return new EvaluationResult(vFunc(val.Vector)); 198 195 return EvaluationResult.NaN; 199 //throw new NotSupportedException($"Unsupported argument type ({val})");200 196 } 201 197 private static EvaluationResult AggregateApply(EvaluationResult val, … … 205 201 if (val.IsVector && vFunc != null) return new EvaluationResult(vFunc(val.Vector)); 206 202 return EvaluationResult.NaN; 207 //throw new NotSupportedException($"Unsupported argument type ({val})");208 203 } 209 204
Note: See TracChangeset
for help on using the changeset viewer.