本文整理汇总了C#中Signal.IsDrivenByPortEntity方法的典型用法代码示例。如果您正苦于以下问题:C# Signal.IsDrivenByPortEntity方法的具体用法?C# Signal.IsDrivenByPortEntity怎么用?C# Signal.IsDrivenByPortEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal.IsDrivenByPortEntity方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MonomialDegree
public static IValueStructure MonomialDegree(Signal signal, Signal[] generalizedVariables)
{
if(Std.IsConstantAdditiveIdentity(signal))
return NegativeInfinitySymbol.Instance;
if(Array.Exists<Signal>(generalizedVariables, signal.Equals))
return IntegerValue.One;
if(!Array.Exists<Signal>(generalizedVariables, signal.DependsOn))
return IntegerValue.Zero;
ISignalSet factors;
long deg = 0;
if(signal.IsDrivenByPortEntity("Multiply", "Std"))
factors = signal.DrivenByPort.InputSignals;
else
factors = new SignalSet(signal);
for(int i = 0; i < factors.Count; i++)
{
if(Array.Exists<Signal>(generalizedVariables, factors[i].Equals))
deg++;
else if(factors[i].IsDrivenByPortEntity("Power", "Std"))
{
Signal b = signal.DrivenByPort.InputSignals[0];
Signal e = signal.DrivenByPort.InputSignals[1];
IntegerValue v;
if(Array.Exists<Signal>(generalizedVariables, b.Equals) && (v = e.Value as IntegerValue) != null && v.Value > 0)
deg += v.Value;
}
}
return new IntegerValue(deg);
}
示例2: IsMonomial
public static bool IsMonomial(Signal signal, Signal[] generalizedVariables)
{
if(signal.IsDrivenByPortEntity("Multiply", "Std"))
return signal.DrivenByPort.InputSignals.TrueForAll(delegate(Signal s) { return IsMonomialFactor(s, generalizedVariables); });
else
return IsMonomialFactor(signal, generalizedVariables);
}
示例3: IsPolynomial
public static bool IsPolynomial(Signal signal, Signal[] generalizedVariables)
{
if(!signal.IsDrivenByPortEntity("Add", "Std"))
return IsMonomial(signal, generalizedVariables);
if(Array.Exists<Signal>(generalizedVariables, signal.Equals))
return true;
return signal.DrivenByPort.InputSignals.TrueForAll(delegate(Signal s) { return IsMonomial(s, generalizedVariables); });
}
示例4: SeparateFactors
/// <summary>
/// Separates factors in a product that depend on x from those that do not.
/// </summary>
/// <returns>
/// A signal array [a,b], where a is the product of the factors not
/// depending on x, and b the product of those depending on x.
/// </returns>
/// <remarks><see cref="product"/> is assumed to be automatic simplified</remarks>
public static Signal[] SeparateFactors(Signal product, Signal x)
{
SignalSet freePart = new SignalSet();
SignalSet dependentPart = new SignalSet();
if(product.IsDrivenByPortEntity("Multiply", "Std"))
{
ISignalSet factors = product.DrivenByPort.InputSignals;
foreach(Signal s in factors)
{
if(s.DependsOn(x))
dependentPart.Add(s);
else
freePart.Add(s);
}
}
else if(product.DependsOn(x))
dependentPart.Add(product);
else
freePart.Add(product);
Signal freeSignal = Multiply(freePart);
Signal dependentSignal = Multiply(dependentPart);
return new Signal[] { freeSignal, dependentSignal };
}
示例5: Numerator
public static Signal Numerator(Signal signal)
{
if(signal == null)
throw new ArgumentNullException("signal");
if(signal.IsDrivenByPortEntity("Divide", "Std"))
return signal.DrivenByPort.InputSignals[0];
return signal;
}
示例6: Denominator
public static Signal Denominator(Signal signal)
{
if(signal.IsDrivenByPortEntity("Divide", "Std") && signal.DrivenByPort.InputSignalCount > 1)
{
if(signal.DrivenByPort.InputSignals.Count == 2)
return signal.DrivenByPort.InputSignals[1];
List<Signal> factors = new List<Signal>();
ISignalSet inputs = signal.DrivenByPort.InputSignals;
for(int i = 1; i < inputs.Count; i++) //all but first element
factors.Add(inputs[i]);
return Multiply(factors);
}
return IntegerValue.ConstantOne;
}
示例7: PolynomialDegree
public static IValueStructure PolynomialDegree(Signal signal, Signal[] generalizedVariables)
{
if(signal == null)
throw new ArgumentNullException("signal");
if(signal.IsDrivenByPortEntity("Add", "Std"))
{
IntegerValue d = IntegerValue.Zero;
ISignalSet inputs = signal.DrivenByPort.InputSignals;
for(int i = 0; i < inputs.Count; i++)
{
IValueStructure f = MonomialDegree(inputs[i], generalizedVariables);
if(f is UndefinedSymbol)
return f;
else if(!(f is NegativeInfinitySymbol))
d = d.Max((IntegerValue)f);
}
return d;
}
else return MonomialDegree(signal, generalizedVariables);
}
示例8: IsMonomialFactor
private static bool IsMonomialFactor(Signal signal, Signal[] generalizedVariables)
{
if(Array.Exists<Signal>(generalizedVariables, signal.Equals))
return true;
if(!Array.Exists<Signal>(generalizedVariables, signal.DependsOn))
return true;
if(signal.IsDrivenByPortEntity("Power", "Std"))
{
Signal b = signal.DrivenByPort.InputSignals[0];
Signal e = signal.DrivenByPort.InputSignals[1];
if(Array.Exists<Signal>(generalizedVariables, b.Equals) && Std.IsAlwaysPositiveInteger(e))
return true;
}
return false;
}
示例9: PolynomialVariables
public static Signal[] PolynomialVariables(Signal signal)
{
List<Signal> variables = new List<Signal>();
ISignalSet monomials;
if(signal.IsDrivenByPortEntity("Add", "Std"))
monomials = signal.DrivenByPort.InputSignals;
else
monomials = new SignalSet(signal);
for(int i = 0; i < monomials.Count; i++)
{
ISignalSet factors;
if(monomials[i].IsDrivenByPortEntity("Multiply", "Std"))
factors = monomials[i].DrivenByPort.InputSignals;
else
factors = new SignalSet(monomials[i]);
for(int j = 0; j < factors.Count; j++)
{
if(Std.IsAlwaysRational(factors[j]))
continue;
if(factors[j].IsDrivenByPortEntity("Power", "Std"))
{
Signal b = factors[j].DrivenByPort.InputSignals[0];
if(Std.IsAlwaysPositiveInteger(factors[j].DrivenByPort.InputSignals[1]))
{
if(!variables.Contains(b))
variables.Add(b);
}
else
{
if(!variables.Contains(signal))
variables.Add(signal);
}
}
else
if(!variables.Contains(factors[j]))
variables.Add(factors[j]);
}
}
return variables.ToArray();
}