本文整理汇总了C#中MathNet.Symbolics.Core.Signal类的典型用法代码示例。如果您正苦于以下问题:C# Signal类的具体用法?C# Signal怎么用?C# Signal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Signal类属于MathNet.Symbolics.Core命名空间,在下文中一共展示了Signal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenericFunctionProcess
protected GenericFunctionProcess(bool[] inInput, bool[] inInternal, bool[] outOutput, bool[] outInternal)
{
if(inInput == null)
throw new ArgumentNullException("inInput");
if(inInternal == null)
throw new ArgumentNullException("inInternal");
if(outOutput == null)
throw new ArgumentNullException("outOutput");
if(outInternal == null)
throw new ArgumentNullException("outInternal");
this.inInput = inInput;
this.inInternal = inInternal;
this.outOutput = outOutput;
this.outInternal = outInternal;
//count mapped signals
for(int i = 0; i < inInput.Length; i++)
if(inInput[i]) inCount++;
for(int i = 0; i < inInternal.Length; i++)
if(inInternal[i]) inCount++;
for(int i = 0; i < outOutput.Length; i++)
if(outOutput[i]) outCount++;
for(int i = 0; i < outInternal.Length; i++)
if(outInternal[i]) outCount++;
inputs = new Signal[inCount];
outputs = new Signal[outCount];
}
示例2: TraverseSignal
private bool TraverseSignal(List<Guid> signals, List<Guid> ports, List<Guid> buses, Signal signal, Port target, bool ignoreHold, IScanVisitor visitor)
{
if(signal == null)
return true;
bool again = true;
if(!signals.Contains(signal.InstanceId))
{
again = false;
signals.Add(signal.InstanceId);
}
if(visitor.EnterSignal(signal, target, again, target == null))
{
// LEAF SIGNAL?
if(!signal.BehavesAsBeingDriven(ignoreHold))
{
if(!visitor.VisitLeaf(signal, again))
return false; // finished
}
else // HANDLE PORT
{
TraversePort(signals, ports, buses, signal.DrivenByPort, signal, ignoreHold, visitor);
}
}
return visitor.LeaveSignal(signal, target, again, target == null);
}
示例3: Cotangent
public static Signal Cotangent(Context context, Signal op)
{
if(context == null)
throw new ArgumentNullException("context");
return context.Builder.Function(new MathIdentifier("Cotangent", "Std"), op);
}
示例4: EnterSignal
public override bool EnterSignal(Signal signal, Port parent, bool again, bool root)
{
if(again)
return false;
_signals.Add(signal);
return true;
}
示例5: EnterPort
public override bool EnterPort(Port port, Signal parent, bool again, bool root)
{
if(again)
return false;
_ports.Add(port);
return true;
}
示例6: DoTraverse
protected override void DoTraverse(Signal rootSignal, IScanVisitor visitor, bool ignoreHold)
{
List<Guid> signals = new List<Guid>();
List<Guid> ports = new List<Guid>();
List<Guid> buses = new List<Guid>();
TraverseSignal(signals, ports, buses, rootSignal, null, ignoreHold, visitor);
}
示例7: BuildTheorems
public static ITheorem[] BuildTheorems(Context context)
{
ITheorem[] theorems = new ITheorem[2];
theorems[0] = new Analysis.DerivativeTransformation(context.Library.LookupEntity(_entityId),
delegate(Port port, SignalSet manipulatedInputs, Signal variable, bool hasManipulatedInputs)
{
Builder b = context.Builder;
Signal[] outputs = new Signal[manipulatedInputs.Count];
ReadOnlySignalSet squares = b.Square(port.OutputSignals);
Signal one = IntegerValue.ConstantOne(context);
for(int i = 0; i < outputs.Length; i++)
outputs[i] = (one + squares[i]) * manipulatedInputs[i];
return b.Negate(outputs);
});
theorems[1] = new BasicTransformation("CotangentTrigonometricSusbtitute", "Std", "TrigonometricSubstitute", "Std",
delegate(Port port) { return port.Entity.EntityId.Equals("Cotangent", "Std"); },
delegate(Port port) { return ManipulationPlan.DoAlter; },
delegate(Port port, SignalSet transformedInputs, bool hasTransformedInputs)
{
Signal[] ret = new Signal[transformedInputs.Count];
for(int i = 0; i < ret.Length; i++)
ret[i] = Std.Cosine(port.Context, transformedInputs[i]) / Std.Sine(port.Context, transformedInputs[i]);
return ret;
});
return theorems;
}
示例8: FulfillsCondition
public override bool FulfillsCondition(Signal output, Port port)
{
if(port == null)
return false;
return port.HasArchitectureLink && _match(port.CurrentArchitecture);
}
示例9: BuildTheorems
public static ITheorem[] BuildTheorems(Context context)
{
ITheorem[] theorems = new ITheorem[2];
theorems[0] = new Analysis.DerivativeTransformation(_entityId,
delegate(Port port, SignalSet manipulatedInputs, Signal variable, bool hasManipulatedInputs)
{
Builder b = context.Builder;
Signal[] outputs = new Signal[manipulatedInputs.Count];
ReadOnlySignalSet cotangents = Std.Cotangent(context, port.InputSignals);
for(int i = 0; i < outputs.Length; i++)
outputs[i] = b.MultiplySimplified(port.OutputSignals[i], cotangents[i], manipulatedInputs[i]);
return b.Negate(outputs);
});
theorems[1] = new BasicTransformation(_entityId.DerivePostfix("TrigonometricSubstitute"), new MathIdentifier("TrigonometricSubstitute", "Std"),
delegate() { return new Pattern(new EntityCondition(_entityId)); },
delegate(Port port) { return ManipulationPlan.DoAlter; },
delegate(Port port, SignalSet transformedInputs, bool hasTransformedInputs)
{
return port.Context.Builder.Invert(Std.Sine(port.Context, transformedInputs));
//Signal[] ret = new Signal[transformedInputs.Count];
//for(int i = 0; i < ret.Length; i++)
// ret[i] = port.Context.Builder.Invert(Std.Sine(port.Context, transformedInputs[i]));
//return ret;
});
return theorems;
}
示例10: FulfillsCondition
public override bool FulfillsCondition(Signal output, Port port)
{
foreach(Condition c in _conditions)
if(!c.FulfillsCondition(output, port))
return false;
return true;
}
示例11: PropagatePropertyIfApplicable
public bool PropagatePropertyIfApplicable(Signal target)
{
if(target == null) throw new ArgumentNullException("target");
if(!target.HasProperty(providedPropertyId) && WouldBePropagatedTo(target))
buildProperty(target);
return target.HasProperty(providedPropertyId);
}
示例12: Action
protected override CommandReference Action()
{
int idx = System.SignalCount;
Signal s = new Signal(System.Context);
Guid iid = s.InstanceId;
System.AddSignal(s);
return new CommandReference(iid, idx);
}
示例13: Traverse
public void Traverse(Signal rootSignal, IScanVisitor visitor, bool ignoreHold)
{
//lock(??) {
ScanStrategy strat = ProvideExecutableInstance();
strat._activeScans++; //}
try { strat.DoTraverse(rootSignal, visitor, ignoreHold); }
finally { strat._activeScans--; }
}
示例14: EnterPort
public override bool EnterPort(Port port, Signal parent, bool again, bool root)
{
// ## DIVE DEEPER ONLY ON UNCERTAIN PORTS
if(_plans[port.InstanceId] != ManipulationPlan.AlterIfChildsAltered
&& _plans[port.InstanceId] != ManipulationPlan.CloneIfChildsAltered)
return false;
return base.EnterPort(port, parent, again, root);
}
示例15: IsMember
public override ECategoryMembership IsMember(Signal signal, bool ignoreCache)
{
if(signal.Value == null)
return ECategoryMembership.Unknown;
if(signal.Value is ComplexValue || signal.Value is RealValue || signal.Value is RationalValue || signal.Value is IntegerValue)
return ECategoryMembership.Member;
return ECategoryMembership.NotMember;
}