Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SubtractElementWise.cs
5
7{
12 {
22 : base(Left, Right, Start, Length, Expression)
23 {
24 }
25
34 {
35 if (Left.AssociatedObjectValue is double DL && Right.AssociatedObjectValue is double DR)
36 return new DoubleNumber(DL - DR);
37 else
38 return Subtract.EvaluateSubtraction(Left, Right, this);
39 }
40
47 public ScriptNode Differentiate(string VariableName, Variables Variables)
48 {
49 if (this.left is IDifferentiable Left &&
50 this.right is IDifferentiable Right)
51 {
52 return new SubtractElementWise(
53 Left.Differentiate(VariableName, Variables),
54 Right.Differentiate(VariableName, Variables),
55 this.Start, this.Length, this.Expression);
56 }
57 else
58 throw new ScriptRuntimeException("Terms not differentiable.", this);
59 }
60
61 }
62}
Class managing a script expression.
Definition: Expression.cs:41
Base class for binary element-wise operators.
ScriptNode right
Right operand.
ScriptNode left
Left operand.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
ScriptNode Differentiate(string VariableName, Variables Variables)
Differentiates a script node, if possible.
override IElement EvaluateScalar(IElement Left, IElement Right, Variables Variables)
Evaluates the operator on scalar operands.
SubtractElementWise(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Element-wise Subtraction operator.
static IElement EvaluateSubtraction(IElement Left, IElement Right, ScriptNode Node)
Subtracts the right operand from the left one.
Definition: Subtract.cs:65
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:21
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:34
Base interface for lambda expressions.