/// <inheritdoc/> public override ExpNode Execute(VectorProjOperNode node) { if (node.LeftChild.AreEqualSizeVectors(node.RightChild, out TensorNode a, out TensorNode b)) { VectorProductOperNode adotb = QuickOpers.DotProduct(a, (TensorNode)b.Clone()); BOperNode bdotb = QuickOpers.DotProduct((TensorNode)b.Clone(), (TensorNode)b.Clone()); return(QuickOpers.Multiply(b, adotb, QuickOpers.Reciprical(bdotb)).Execute(this)); } return(HandleError(new CannotVectorProject(this, node))); }
/// <summary> /// Executes operation on a <see cref="VectorProjOperNode"/>. /// </summary> /// <param name="node">The <see cref="VectorProjOperNode"/> to execute operation on.</param> /// <returns>The result of the operation on a <see cref="VectorProjOperNode"/>.</returns> public virtual ExpNode Execute(VectorProjOperNode node) => Execute((BOperNode)node);
/// <summary> /// Initializes a new instance of the <see cref="CannotVectorProject"/> class. /// </summary> /// <param name="simplifier">The simplified that threw.</param> /// <param name="context">The <see cref="VectorProjOperNode"/> that it threw simplifying.</param> /// <param name="message">The <see cref="Exception"/> message.</param> public CannotVectorProject(Simplifier simplifier, VectorProjOperNode context, string message = "") : base(simplifier, context, message) { }