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


C# Signal.IsDrivenByPortEntity方法代码示例

本文整理汇总了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);
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:29,代码来源:GeneralizedPolynomial.cs

示例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);
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:7,代码来源:GeneralizedPolynomial.cs

示例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); });
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:8,代码来源:GeneralizedPolynomial.cs

示例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 };
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:31,代码来源:Std.cs

示例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;
        }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:9,代码来源:Std.cs

示例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;
        }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:15,代码来源:Std.cs

示例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);
        }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:21,代码来源:GeneralizedPolynomial.cs

示例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;
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:15,代码来源:GeneralizedPolynomial.cs

示例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();
 }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:40,代码来源:GeneralizedPolynomial.cs


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