示例#1
0
            public void Visit(Compiled.Atan2 elem)
            {
                double left  = ValueOf(elem.Left);
                double right = ValueOf(elem.Right);

                elem.Value = Math.Atan2(left, right);
                double denom = left * left + right * right;

                elem.Inputs[0].Weight = -right / denom;
                elem.Inputs[1].Weight = left / denom;
            }
            public void Visit(Compiled.Atan2 elem)
            {
                double denom = ValueOf(elem.Left) * ValueOf(elem.Left) + ValueOf(elem.Right) * ValueOf(elem.Right);

                if (ArgumentIndex == 0)
                {
                    LocalDerivative = -ValueOf(elem.Right) * elem.Adjoint / denom;
                }
                else
                {
                    LocalDerivative = ValueOf(elem.Left) * elem.Adjoint / denom;
                }
            }
            public int Visit(Atan2 atan2)
            {
                return(Compile(atan2, () =>
                {
                    var lIndex = atan2.Left.Accept(this);
                    var rIndex = atan2.Right.Accept(this);

                    var element = new Compiled.Atan2
                    {
                        Left = lIndex,
                        Right = rIndex,
                        Inputs = new Compiled.InputEdge[]
                        {
                            new Compiled.InputEdge {
                                Index = lIndex
                            },
                            new Compiled.InputEdge {
                                Index = rIndex
                            },
                        }
                    };
                    return element;
                }));
            }
 public void Visit(Compiled.Atan2 elem)
 {
     elem.Value = Math.Atan2(ValueOf(elem.Left), ValueOf(elem.Right));
 }