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


C# Signal.IsDrivenByPortEntity方法代码示例

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


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

示例1: 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(Context context, Signal product, Signal x)
 {
     SignalSet freePart = new SignalSet();
     SignalSet dependentPart = new SignalSet();
     if(product.IsDrivenByPortEntity("Multiply", "Std"))
     {
         ReadOnlySignalSet 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 = context.Builder.MultiplySimplified(freePart);
     Signal dependentSignal = context.Builder.MultiplySimplified(dependentPart);
     return new Signal[] { freeSignal, dependentSignal };
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:31,代码来源:Std.cs

示例2: MonomialDegree

 public static ValueStructure MonomialDegree(Signal signal, Signal[] generalizedVariables)
 {
     if(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:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:Std.cs

示例3: 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(IsAlwaysRational(factors[j]))
                 continue;
             if(factors[j].IsDrivenByPortEntity("Power", "Std"))
             {
                 Signal b = factors[j].DrivenByPort.InputSignals[0];
                 if(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:xuchuansheng,项目名称:GenXSource,代码行数:40,代码来源:Std.cs

示例4: 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:xuchuansheng,项目名称:GenXSource,代码行数:8,代码来源:Std.cs

示例5: 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:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:Std.cs

示例6: 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:xuchuansheng,项目名称:GenXSource,代码行数:15,代码来源:Std.cs

示例7: 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

示例8: Numerator

 public static Signal Numerator(Signal signal)
 {
     if(signal.IsDrivenByPortEntity("Divide", "Std"))
         return signal.DrivenByPort.InputSignals[0];
     return signal;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:6,代码来源:Std.cs

示例9: MonomialCoefficient

 /// <summary>
 /// Returns the coefficient factor in the monomial <see cref="signal"/>
 /// </summary>
 /// <returns>
 /// Constant UndefinedSymbol if <see cref="signal"/> is not a single-variable monomial.
 /// Otherwise the coefficient factor of the term.
 /// </returns>
 /// </returns>
 /// <remarks><see cref="signal"/> is assumed to be automatic simplified.</remarks>
 public static Signal MonomialCoefficient(Signal signal, Signal variable, out ValueStructure degree)
 {
     if(IsConstantAdditiveIdentity(signal))
     {
         degree = NegativeInfinitySymbol.Instance;
         return signal;
     }
     if(IsAlwaysRational(signal))
     {
         degree = IntegerValue.Zero;
         return signal;
     }
     Signal coeff = IntegerValue.ConstantOne(signal.Context);
     if(signal.IsDrivenByPortEntity("Multiply", "Std") && signal.DrivenByPort.InputSignalCount == 2 && IsAlwaysRational(signal.DrivenByPort.InputSignals[0]))
     {
         coeff = signal.DrivenByPort.InputSignals[0];
         signal = signal.DrivenByPort.InputSignals[1];
     }
     if(signal.Equals(variable))
     {
         degree = IntegerValue.One;
         return coeff;
     }
     if(signal.IsDrivenByPortEntity("Power", "Std"))
     {
         Signal b = signal.DrivenByPort.InputSignals[0];
         Signal e = signal.DrivenByPort.InputSignals[1];
         if(b.Equals(variable) && Std.IsAlwaysPositiveInteger(e))
         {
             degree = e.Value;
             return coeff;
         }
     }
     degree = UndefinedSymbol.Instance;
     return UndefinedSymbol.Constant(signal.Context);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:45,代码来源:Std.cs

示例10: IsRational

 /// <summary>
 /// Checks whether a signal is a signle variable rational, a fraction of polynomials.
 /// </summary>
 /// <remarks><see cref="signal"/> is assumed to be automatic simplified.</remarks>
 public static bool IsRational(Signal signal, Signal variable)
 {
     if(signal.IsDrivenByPortEntity("Divide", "Std"))
         return IsPolynomial(Numerator(signal), variable) && IsPolynomial(Denominator(signal), variable);
     else
         return IsPolynomial(signal, variable);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:Std.cs

示例11: PolynomialDegree

        /// <summary>
        /// Evaluates the degree of the single-variable polynomial <see cref="signal"/>.
        /// </summary>
        /// <returns>
        /// <see cref="UndefinedSymbol"/> if <see cref="signal"/> is not a single-variable polynomial.
        /// <see cref="NegativeInfinitySymbol"/> if <see cref="signal"/> is zero.
        /// Otherwise an <see cref="IntegerValue"/> representing the asked degree.
        /// </returns>
        /// <remarks><see cref="signal"/> is assumed to be automatic simplified.</remarks>
        public static ValueStructure PolynomialDegree(Signal signal, Signal variable)
        {
            if(signal == null)
                throw new ArgumentNullException("signal");

            if(signal.IsDrivenByPortEntity("Add", "Std"))
            {
                IntegerValue d = IntegerValue.Zero;
                ReadOnlySignalSet inputs = signal.DrivenByPort.InputSignals;
                for(int i = 0; i < inputs.Count; i++)
                {
                    ValueStructure f = MonomialDegree(inputs[i],variable);
                    if(f is UndefinedSymbol)
                        return f;
                    else if(!(f is NegativeInfinitySymbol))
                        d = d.Max((IntegerValue)f);
                }
                return d;
            }
            else
                return MonomialDegree(signal, variable);
        }
开发者ID:JackWangCUMT,项目名称:mathnet-yttrium,代码行数:31,代码来源:Std.cs

示例12: PolynomialDegree

 public static ValueStructure PolynomialDegree(Signal signal, Signal[] generalizedVariables)
 {
     if(signal.IsDrivenByPortEntity("Add", "Std"))
     {
         IntegerValue d = IntegerValue.Zero;
         ReadOnlySignalSet inputs = signal.DrivenByPort.InputSignals;
         for(int i = 0; i < inputs.Count; i++)
         {
             ValueStructure 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:xuchuansheng,项目名称:GenXSource,代码行数:18,代码来源:Std.cs

示例13: PolynomialCoefficient

 /// <summary>
 /// Returns the coefficient u[exponent] of x^exponent in the polynomial <see cref="signal"/>
 /// </summary>
 /// <returns>
 /// Constant UndefinedSymbol if <see cref="signal"/> is not a single-variable polynomial.
 /// Constant <see cref="IntegerValue.Zero"/> if there's no summand with the given exponent.
 /// Otherwise the sum of all coefficient factors of the term with the given exponent.
 /// </returns>
 /// <remarks><see cref="signal"/> is assumed to be automatic simplified.</remarks>
 public static Signal PolynomialCoefficient(Signal signal, Signal variable, int exponent)
 {
     ValueStructure vs;
     Signal c = MonomialCoefficient(signal, variable, out vs);
     if(!(vs is UndefinedSymbol))
     {
         IntegerValue iv = vs as IntegerValue;
         if(iv == null || iv.Value == exponent)
             return c;
         else
             return IntegerValue.ConstantZero(signal.Context);
     }
     if(signal.IsDrivenByPortEntity("Add", "Std"))
     {
         ReadOnlySignalSet inputs = signal.DrivenByPort.InputSignals;
         List<Signal> coeffs = new List<Signal>(4);
         for(int i = 0; i < inputs.Count; i++)
         {
             c = MonomialCoefficient(inputs[i], variable, out vs);
             IntegerValue iv = vs as IntegerValue;
             if(iv != null && iv.Value == exponent)
                 coeffs.Add(c);
         }
         return signal.Context.Builder.AddSimplified(coeffs);
     }
     return UndefinedSymbol.Constant(signal.Context);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:36,代码来源:Std.cs

示例14: PolynomialCoefficients

        /// <summary>
        /// Extracts all coefficients of the polynomial <see cref="signal"/>.
        /// </summary>
        /// <returns>A signal array [c0,c1,c2,..] where ci ist the coefficient of x^i.</returns>
        public static Signal[] PolynomialCoefficients(Signal signal, Signal variable)
        {
            ValueStructure vs;
            SortedList<long, Signal> polynom = new SortedList<long, Signal>();

            Signal c = MonomialCoefficient(signal, variable, out vs);
            if(!(vs is UndefinedSymbol))
            {
                IntegerValue iv = vs as IntegerValue;
                if(iv != null)
                    polynom.Add(iv.Value, c);
                else
                    return new Signal[] { IntegerValue.ConstantZero(signal.Context) };
            }
            else if(signal.IsDrivenByPortEntity("Add", "Std"))
            {
                ReadOnlySignalSet inputs = signal.DrivenByPort.InputSignals;
                for(int i = 0; i < inputs.Count; i++)
                {
                    c = MonomialCoefficient(inputs[i], variable, out vs);
                    IntegerValue iv = vs as IntegerValue;
                    if(iv != null)
                        if(!polynom.ContainsKey(iv.Value))
                            polynom.Add(iv.Value, c);
                        else
                            polynom[iv.Value] = signal.Context.Builder.AddSimplified(polynom[iv.Value], c);
                }
            }
            if(polynom.Keys.Count == 0)
                return new Signal[] { };
            long deg = polynom.Keys[polynom.Keys.Count - 1];
            Signal[] ret = new Signal[deg];
            Signal zero = IntegerValue.ConstantZero(signal.Context);
            for(int i = 0; i < ret.Length; i++)
                if(polynom.ContainsKey(i))
                    ret[i] = polynom[i];
                else
                    ret[i] = zero;
            return ret;
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:44,代码来源:Std.cs

示例15: 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>();
                ReadOnlySignalSet inputs = signal.DrivenByPort.InputSignals;
                for(int i = 1; i < inputs.Count; i++) //all but first element
                    factors.Add(inputs[i]);
                return signal.Context.Builder.MultiplySimplified(factors);
            }
            return IntegerValue.ConstantOne(signal.Context);
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:15,代码来源:Std.cs


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