public void Visit(Compiled.Product elem)
            {
                double left  = ValueOf(elem.Left);
                double right = ValueOf(elem.Right);

                elem.Value            = left * right;
                elem.Inputs[0].Weight = right;
                elem.Inputs[1].Weight = left;
            }
 public void Visit(Compiled.Product elem)
 {
     Debug.Assert(ArgumentIndex == 0 || ArgumentIndex == 1);
     if (ArgumentIndex == 0)
     {
         LocalDerivative = elem.Adjoint * ValueOf(elem.Right);
     }
     else
     {
         LocalDerivative = elem.Adjoint * ValueOf(elem.Left);
     }
 }
            public TapeElement Visit(Product product)
            {
                return(Compile(product, () =>
                {
                    var leftElement = product.Left.Accept(this);
                    var rightElement = product.Right.Accept(this);
                    var element = new Compiled.Product
                    {
                        Inputs = MakeInputEdges(() =>
                        {
                            edges.Add(new InputEdge {
                                Element = leftElement
                            });
                            edges.Add(new InputEdge {
                                Element = rightElement
                            });
                        })
                    };

                    return element;
                }));
            }
            public int Visit(Product product)
            {
                return(Compile(product, () =>
                {
                    var leftIndex = product.Left.Accept(this);
                    var rightIndex = product.Right.Accept(this);
                    var element = new Compiled.Product
                    {
                        Left = leftIndex,
                        Right = rightIndex,
                        Inputs = new Compiled.InputEdge[]
                        {
                            new Compiled.InputEdge {
                                Index = leftIndex
                            },
                            new Compiled.InputEdge {
                                Index = rightIndex
                            },
                        }
                    };

                    return element;
                }));
            }
 public void Visit(Compiled.Product elem)
 {
     elem.Value = ValueOf(elem.Left) * ValueOf(elem.Right);
 }