本文整理汇总了C#中Equus.Calabrese.FNode.CloneOfMe方法的典型用法代码示例。如果您正苦于以下问题:C# FNode.CloneOfMe方法的具体用法?C# FNode.CloneOfMe怎么用?C# FNode.CloneOfMe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Equus.Calabrese.FNode
的用法示例。
在下文中一共展示了FNode.CloneOfMe方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bind
/// <summary>
/// Binds a leaf node to another node
/// </summary>
/// <param name="MainNode">The node containing a pointer node that will be bound</param>
/// <param name="ParameterNode">The node that will be bound to the MainNode</param>
/// <param name="PointerNodeName">The name of the pointer the ParameterNode will be replacing</param>
/// <returns></returns>
public static FNode Bind(FNode MainNode, FNode ParameterNode, string PointerNodeName)
{
// Clone the main node //
FNode t = MainNode.CloneOfMe();
// Decompile t //
List<FNodePointer> refs = FNodeAnalysis.AllPointers(t);
// Replace the pointer node with the parameter node //
foreach (FNodePointer x in refs)
{
if (x.PointerName == PointerNodeName)
FNodeAnalysis.ReplaceNode(x, ParameterNode);
}
return t;
}
示例2: GradientOfPowerUpper
// F(X) = power(Y, G(X)), F'(X) = LOG(Y) * power(Y, G(X)) * G'(X)
private static FNode GradientOfPowerUpper(FNode Node, FNodePointer X)
{
// Throw an exception if X is decendant of Y, in otherwords F(X) = Power(G(X), H(X))
if (FNodeAnalysis.IsDecendent(X, Node.Children[1]))
throw new Exception(string.Format("Cannot differentiate the power function with the form: Power(G(X), H(X)); G(X) cannot have a relation to X"));
// LOG(Y) //
FNode log_y = new FNodeResult(null, new CellFuncFVLog());
log_y.AddChildNode(Node.Children[0]);
// Get Power(Y, G(X)) * LOG(Y) //
FNode pow_f_dx = new FNodeResult(Node.ParentNode, new CellBinMult());
pow_f_dx.AddChildNode(Node.CloneOfMe());
pow_f_dx.AddChildNode(log_y);
// Get Power(G(X), N-1) * G'(X) //
FNode t = new FNodeResult(Node.ParentNode, new CellBinMult());
t.AddChildNode(pow_f_dx);
t.AddChildNode(Gradient(Node.Children[1], X));
return t;
}
示例3: BindNode
public static FNode BindNode(FNode Equation, CellVector Bindings, Dictionary<string, int> Map)
{
FNode t = Equation.CloneOfMe();
foreach(KeyValuePair<string,int> kv in Map)
{
string name = kv.Key;
int idx = kv.Value;
FNode b = new FNodeValue(null, Bindings[idx]);
t = FNodeCompacter.Bind(t, b, name);
}
return t;
}
示例4: GradientOfExp
// F(X) = exp(G(X)), F'(X) = exp(G(X)) * G'(X), or simplified F(X) * G'(X)
private static FNode GradientOfExp(FNode Node, FNodePointer X)
{
// F(X) * G'(X) //
FNodeResult t = new FNodeResult(Node.ParentNode, new CellBinMult());
t.AddChildNode(Node.CloneOfMe());
t.AddChildNode(Gradient(Node.Children[0], X));
return t;
}