当前位置: 首页>>代码示例>>C#>>正文


C# FNode.ReturnAffinity方法代码示例

本文整理汇总了C#中Equus.Calabrese.FNode.ReturnAffinity方法的典型用法代码示例。如果您正苦于以下问题:C# FNode.ReturnAffinity方法的具体用法?C# FNode.ReturnAffinity怎么用?C# FNode.ReturnAffinity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Equus.Calabrese.FNode的用法示例。


在下文中一共展示了FNode.ReturnAffinity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AggregateMin

 public AggregateMin(FNode M, Predicate F)
     : base(M.ReturnAffinity())
 {
     this._Map = M;
     this._F = F;
     this._Sig = 1;
 }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:7,代码来源:AggregateMin.cs

示例2: AggregateStat

 public AggregateStat(FNode X, FNode W, Predicate F)
     : base(X.ReturnAffinity())
 {
     this._MapX = X;
     this._MapW = W;
     this._F = F;
     this._Sig = 3;
 }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:8,代码来源:AggregateStat.cs

示例3: IsStaticMinusOne

 public static bool IsStaticMinusOne(FNode Node)
 {
     if (Node.Affinity == FNodeAffinity.ValueNode)
         return (Node as FNodeValue).InnerValue == -Cell.OneValue(Node.ReturnAffinity());
     if (Node.Affinity == FNodeAffinity.ResultNode)
     {
         FNodeResult x = (Node as FNodeResult);
         if (x.InnerFunction.NameSig == FunctionNames.UNI_MINUS && IsStaticOne(x.Children[0]))
             return true;
     }
     return false;
 }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:12,代码来源:FNodeCompactor.cs

示例4: IsStaticOne

 public static bool IsStaticOne(FNode Node)
 {
     if (Node.Affinity == FNodeAffinity.ValueNode)
         return (Node as FNodeValue).InnerValue == Cell.OneValue(Node.ReturnAffinity());
     return false;
 }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:6,代码来源:FNodeCompactor.cs

示例5: Predicate

 public Predicate(FNode Node)
 {
     if (Node.ReturnAffinity() != CellAffinity.BOOL)
         throw new Exception(string.Format("Node passed does not return boolean : {0}", Node.ReturnAffinity()));
     this._Node = Node;
 }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:6,代码来源:Predicate.cs

示例6: Gradient

        /// <summary>
        /// Calculates the gradient (first derivative) of a node with respect to a parameter node passed (pointer node).
        /// This method calls FNodeCompacter.CompactNode if the class level static variable 'Compact' is true (by default it is set to true).
        /// The gradient calculation leaves a lot of un-needed expressions that could be cancled out.
        /// </summary>
        /// <param name="Node">The node to calculate the gradient over</param>
        /// <param name="X">The parameter we are differentiating with respect to</param>
        /// <returns>A node representing a gradient</returns>
        internal static FNode Gradient(FNode Node, FNodePointer X)
        {

            // The node is a pointer node //
            if (Node.Affinity == FNodeAffinity.PointerNode)
            {
                if ((Node as FNodePointer).PointerName == X.PointerName)
                    return new FNodeValue(Node.ParentNode, Cell.OneValue(X.ReturnAffinity()));
                else
                    return new FNodeValue(Node.ParentNode, Cell.ZeroValue(X.ReturnAffinity()));
            }

            // The node is not a function node //
            if (Node.Affinity != FNodeAffinity.ResultNode)
                return new FNodeValue(Node.ParentNode, Cell.ZeroValue(Node.ReturnAffinity()));

            // Check if the node, which we now know is a function, has X as a decendant //
            if (!FNodeAnalysis.IsDecendent(X, Node))
                return new FNodeValue(Node.ParentNode, Cell.ZeroValue(X.ReturnAffinity()));

            // Otherwise we have to do work :( //

            // Get the name signiture //
            string name_sig = (Node as FNodeResult).InnerFunction.NameSig;

            // Go through each differentiable function //
            FNode t = null;
            switch (name_sig)
            {

                case FunctionNames.UNI_PLUS:
                    t = GradientOfUniPlus(Node, X);
                    break;
                case FunctionNames.UNI_MINUS:
                    t = GradientOfUniMinus(Node, X);
                    break;

                case FunctionNames.OP_ADD:
                    t = GradientOfAdd(Node, X);
                    break;
                case FunctionNames.OP_SUB:
                    t = GradientOfSubtract(Node, X);
                    break;
                case FunctionNames.OP_MUL:
                    t = GradientOfMultiply(Node, X);
                    break;
                case FunctionNames.OP_DIV:
                    t = GradientOfDivide(Node, X);
                    break;

                case FunctionNames.FUNC_LOG:
                    t = GradientOfLog(Node, X);
                    break;
                case FunctionNames.FUNC_EXP:
                    t = GradientOfExp(Node, X);
                    break;
                case FunctionNames.FUNC_POWER:
                    t = GradientOfPowerLower(Node, X);
                    break;

                case FunctionNames.FUNC_SIN:
                    t = GradientOfSin(Node, X);
                    break;
                case FunctionNames.FUNC_COS:
                    t = GradientOfCos(Node, X);
                    break;
                case FunctionNames.FUNC_TAN:
                    t = GradientOfTan(Node, X);
                    break;

                case FunctionNames.FUNC_SINH:
                    t = GradientOfSinh(Node, X);
                    break;
                case FunctionNames.FUNC_COSH:
                    t = GradientOfCosh(Node, X);
                    break;
                case FunctionNames.FUNC_TANH:
                    t = GradientOfTanh(Node, X);
                    break;

                case FunctionNames.FUNC_LOGIT:
                    t = GradientOfLogit(Node, X);
                    break;

                case FunctionNames.FUNC_NDIST:
                    t = GradientOfNDIST(Node, X);
                    break;
                
                default:
                    throw new Exception(string.Format("Function is not differentiable : {0}", name_sig));
            }

//.........这里部分代码省略.........
开发者ID:pwdlugosz,项目名称:Horse,代码行数:101,代码来源:FNodeGradient.cs

示例7: AggregateStatCo

 public AggregateStatCo(FNode X, FNode Y)
     : this(X, Y, new FNodeValue(null, Cell.OneValue(X.ReturnAffinity())), PredicateFactory.IsNotNull(X))
 {
 }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:4,代码来源:AggregateStatCo.cs


注:本文中的Equus.Calabrese.FNode.ReturnAffinity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。