public void Visit(Compiled.ConstPower elem)
            {
                double baseVal = ValueOf(elem.Base);

                elem.Value            = Math.Pow(baseVal, elem.Exponent);
                elem.Inputs[0].Weight = elem.Exponent * Math.Pow(baseVal, elem.Exponent - 1);
            }
Esempio n. 2
0
            public void Visit(Compiled.ConstPower elem)
            {
                double baseVal = ValueOf(elem.Base);
                //modified to remove one Math.Pow -- HS
                double r = Math.Pow(baseVal, elem.Exponent - 1);

                elem.Value            = r * baseVal;
                elem.Inputs[0].Weight = elem.Exponent * r;
                //elem.Value = Math.Pow(baseVal, elem.Exponent);
                //elem.Inputs[0].Weight = elem.Exponent * Math.Pow(baseVal, elem.Exponent - 1);
            }
            public TapeElement Visit(ConstPower intPower)
            {
                return(Compile(intPower, () =>
                {
                    var baseElement = intPower.Base.Accept(this);
                    var element = new Compiled.ConstPower
                    {
                        Exponent = intPower.Exponent,
                        Inputs = MakeInputEdges(() =>
                        {
                            edges.Add(new InputEdge {
                                Element = baseElement
                            });
                        }),
                    };

                    return element;
                }));
            }
            public int Visit(ConstPower intPower)
            {
                return(Compile(intPower, () =>
                {
                    var baseIndex = intPower.Base.Accept(this);
                    var element = new Compiled.ConstPower
                    {
                        Base = baseIndex,
                        Exponent = intPower.Exponent,
                        Inputs = new Compiled.InputEdge[]
                        {
                            new Compiled.InputEdge {
                                Index = baseIndex
                            },
                        },
                    };

                    return element;
                }));
            }
 public void Visit(Compiled.ConstPower elem)
 {
     LocalDerivative = elem.Adjoint * elem.Exponent * Math.Pow(ValueOf(elem.Base), elem.Exponent - 1);
 }
 public void Visit(Compiled.ConstPower elem)
 {
     elem.Value = Math.Pow(ValueOf(elem.Base), elem.Exponent);
 }