Sequence
A piecewise affine function with a limited support, defined between DefinedFrom and DefinedUntil. Both ends can be either inclusive or exclusive.
public sealed class Sequence : System.IEquatable<Sequence>, IToCodeString, Unipi.Nancy.Utility.IStableHashCode
Inheritance Object → Sequence
Implements IEquatable<Sequence>, IToCodeString, IStableHashCode
Properties
Elements
Set of elements composing the sequence.
public IReadOnlyList<Element> Elements { get; }
Property Value
DefinedFrom
Left endpoint of the support of the sequence. Can be either inclusive or exclusive, see IsLeftClosed or IsLeftOpen.
public Rational DefinedFrom { get; }
Property Value
DefinedUntil
Right endpoint of the support of the sequence. Can be either inclusive or exclusive, see IsRightClosed or IsRightOpen.
public Rational DefinedUntil { get; }
Property Value
Length
Length of the support of the sequence.
public Rational Length { get; }
Property Value
Count
Number of points and segments composing the sequence.
public int Count { get; }
Property Value
IsFinite
True if all elements of the sequence are finite.
public bool IsFinite { get; }
Property Value
IsInfinite
True if all elements of the sequence are infinite.
public bool IsInfinite { get; }
Property Value
IsPlusInfinite
True if all elements of the sequence are plus infinite.
public bool IsPlusInfinite { get; }
Property Value
IsMinusInfinite
True if all elements of the sequence are minus infinite.
public bool IsMinusInfinite { get; }
Property Value
FirstFiniteTime
The first instant around which the sequence is not infinite. Does not specify whether it's inclusive or not, i.e. if is finite.
public Rational FirstFiniteTime { get; }
Property Value
FirstInfiniteTime
The first instant around which the sequence is not finite. Does not specify whether it's inclusive or not, i.e. if is infinite.
public Rational FirstInfiniteTime { get; }
Property Value
FirstNonZeroTime
The first instant around which the curve is not 0. Does not specify whether it's inclusive or not, i.e. if is 0.
public Rational FirstNonZeroTime { get; }
Property Value
IsZero
True if the sequence is 0 for all .
public bool IsZero { get; }
Property Value
IsContinuous
True if there is no discontinuity within the sequence.
public bool IsContinuous { get; }
Property Value
IsLeftContinuous
True if there is left-discontinuity within the sequence.
public bool IsLeftContinuous { get; }
Property Value
IsRightContinuous
True if there is right-discontinuity within the sequence.
public bool IsRightContinuous { get; }
Property Value
IsNonNegative
True if the sequence is non-negative, i.e. for any .
public bool IsNonNegative { get; }
Property Value
IsNonDecreasing
True if for any , .
public bool IsNonDecreasing { get; }
Property Value
IsLeftOpen
True if DefinedFrom is exclusive.
public bool IsLeftOpen { get; }
Property Value
IsLeftClosed
True if DefinedFrom is inclusive.
public bool IsLeftClosed { get; }
Property Value
IsRightOpen
True if DefinedUntil is exclusive.
public bool IsRightOpen { get; }
Property Value
IsRightClosed
True if DefinedUntil is inclusive.
public bool IsRightClosed { get; }
Property Value
IsPoint
True if the sequence consists of only a Point, meaning it is has 0 time length.
public bool IsPoint { get; }
Property Value
StartsWithPlateau
True if the the sequence starts with a plateau.
public bool StartsWithPlateau { get; }
Property Value
EndsWithPlateau
True if the sequence ends with a plateau.
public bool EndsWithPlateau { get; }
Property Value
FirstPlateauEnd
Returns the end time of the plateau at the start of the sequence, or the sequence start if there is no such plateau.
public Rational FirstPlateauEnd { get; }
Property Value
LastPlateauStart
Returns the start time of the plateau at the end of the sequence, or the sequence end if there is no such plateau.
public Rational LastPlateauStart { get; }
Property Value
Constructors
Sequence(IReadOnlyList<Element>)
Constructor.
public Sequence(IReadOnlyList<Element> elements)
Parameters
elements
IReadOnlyList<Element>
Set of elements composing the sequence. Must be in uninterrupted order.
Sequence(IEnumerable<Element>)
Constructor.
public Sequence(IEnumerable<Element> elements)
Parameters
elements
IEnumerable<Element>
Set of elements composing the sequence. Must be in uninterrupted order.
Sequence(IEnumerable<Element>, Rational, Rational, Nullable<Rational>)
Constructor. Fills the gaps within [fillFrom, fillTo[ with the given value, defaults to .
public Sequence(IEnumerable<Element> elements, Rational fillFrom, Rational fillTo, Nullable<Rational> fillWith)
Parameters
elements
IEnumerable<Element>
Partial set of elements composing the sequence. Must be ordered, but can have gaps.
fillFrom
Rational
Left inclusive endpoint of the filling interval.
fillTo
Rational
Right exclusive endpoint of the filling interval.
fillWith
Nullable<Rational>
The value filled in. Defaults to
Methods
FirstFiniteTimeAfter(Rational)
The first instant after which the sequence is not infinite, starting from the right of time
.
public Rational FirstFiniteTimeAfter(Rational time)
Parameters
time
Rational
Returns
IsContinuousAt(Rational)
True if the sequence is continuous at time
.
public bool IsContinuousAt(Rational time)
Parameters
time
Rational
Returns
IsLeftContinuousAt(Rational)
True if the sequence is continuous at time
.
public bool IsLeftContinuousAt(Rational time)
Parameters
time
Rational
Returns
IsRightContinuousAt(Rational)
True if the sequence is continuous at time
.
public bool IsRightContinuousAt(Rational time)
Parameters
time
Rational
Returns
Zero(Rational, Rational, Boolean, Boolean)
Constructs a sequence that is 0 between from
and to
.
public static Sequence Zero(Rational from, Rational to, bool isStartIncluded, bool isEndIncluded)
Parameters
from
Rational
Left endpoint of the sequence
to
Rational
Right endpoint of the sequence
isStartIncluded
Boolean
isEndIncluded
Boolean
Returns
PlusInfinite(Rational, Rational, Boolean, Boolean)
Constructs a sequence that is between from
and to
.
public static Sequence PlusInfinite(Rational from, Rational to, bool isStartIncluded, bool isEndIncluded)
Parameters
from
Rational
Left endpoint of the sequence
to
Rational
Right endpoint of the sequence
isStartIncluded
Boolean
isEndIncluded
Boolean
Returns
MinusInfinite(Rational, Rational, Boolean, Boolean)
Constructs a sequence that is between from
and to
.
public static Sequence MinusInfinite(Rational from, Rational to, bool isStartIncluded, bool isEndIncluded)
Parameters
from
Rational
Left endpoint of the sequence
to
Rational
Right endpoint of the sequence
isStartIncluded
Boolean
isEndIncluded
Boolean
Returns
Constant(Rational, Rational, Rational, Boolean, Boolean)
Constructs a sequence that is value
> between from
and to
.
public static Sequence Constant(Rational value, Rational from, Rational to, bool isStartIncluded, bool isEndIncluded)
Parameters
value
Rational
Constant value of the sequence
from
Rational
Left endpoint of the sequence
to
Rational
Right endpoint of the sequence
isStartIncluded
Boolean
isEndIncluded
Boolean
Returns
Equals(Object)
public bool Equals(object obj)
Parameters
obj
Object
Returns
GetHashCode()
public int GetHashCode()
Returns
GetStableHashCode()
A stable hashcode.
public int GetStableHashCode()
Returns
GetHashString()
Returns the hash code as hex string .
public string GetHashString()
Returns
Equals(Sequence)
public bool Equals(Sequence other)
Parameters
other
Sequence
Returns
Equivalent(Sequence)
True if the sequences represent the same function.
public bool Equivalent(Sequence sequence)
Parameters
sequence
Sequence
Returns
Equivalent(Sequence, Sequence)
True if the sequences represent the same function.
public static bool Equivalent(Sequence a, Sequence b)
Parameters
a
Sequence
b
Sequence
Returns
Equivalent(IEnumerable<Element>, IEnumerable<Element>)
True if the a
and b
are ordered sequences of elements representing the same function, over the same interval.
Optimized for minimal allocations
public static bool Equivalent(IEnumerable<Element> a, IEnumerable<Element> b)
Parameters
Returns
FindFirstInequivalence(Sequence, Sequence)
Returns the first time around which the functions represented by the sequences differ. Returns null if the two sequences represent the same function. Mostly useful to debug sequences that should be equivalent.
public static Nullable<Rational> FindFirstInequivalence(Sequence a, Sequence b)
Parameters
a
Sequence
b
Sequence
Returns
LessOrEqual(Sequence, Sequence, ComputationSettings)
True if the first sequence is a lower bound for the second one, for their overlapping part.
public static bool LessOrEqual(Sequence a, Sequence b, ComputationSettings settings)
Parameters
a
Sequence
b
Sequence
settings
ComputationSettings
Returns
GreaterOrEqual(Sequence, Sequence, ComputationSettings)
True if the first sequence is an upper bound for the second one, for their overlapping part.
public static bool GreaterOrEqual(Sequence a, Sequence b, ComputationSettings settings)
Parameters
a
Sequence
b
Sequence
settings
ComputationSettings
Returns
Negate()
Returns the opposite function, .
public Sequence Negate()
Returns
IsDefinedAt(Rational)
True if the sequence is defined at the given time.
public bool IsDefinedAt(Rational time)
Parameters
time
Rational
Returns
IsDefinedBefore(Rational)
True if the sequence is defined before the given time.
public bool IsDefinedBefore(Rational time)
Parameters
time
Rational
Returns
IsDefinedAfter(Rational)
True if the sequence is defined after the given time.
public bool IsDefinedAfter(Rational time)
Parameters
time
Rational
Returns
ValueAt(Rational)
Computes the value of the sequence at the given time
.
public Rational ValueAt(Rational time)
Parameters
time
Rational
The time of sampling.
Returns
Rational
Value of the segment at the given time or 0 if outside definition bounds.
RightLimitAt(Rational)
Computes the right limit of the sequence at given time
public Rational RightLimitAt(Rational time)
Parameters
time
Rational
The target time of the limit
Returns
Rational
The value of
LeftLimitAt(Rational)
Computes the left limit of the sequence at given time
.
public Rational LeftLimitAt(Rational time)
Parameters
time
Rational
The target time of the limit.
Returns
Rational
The value of
GetElementAt(Rational)
Returns the Element that describes the sequence in time
.
This method is implemented using a binary search,
public Element GetElementAt(Rational time)
Parameters
time
Rational
Time of the sample.
Returns
Element
The describing the sequence at .
Exceptions
ArgumentException
Thrown if the given is out of sequence support.
GetSegmentBefore(Rational)
Returns the Segment that describes the sequence before time
.
This method is implemented using a binary search,
public Segment GetSegmentBefore(Rational time)
Parameters
time
Rational
Time of the sample.
Returns
Segment
The describing the sequence before .
Exceptions
ArgumentException
Thrown if the given is out of sequence support.
GetSegmentAfter(Rational)
Returns the Segment that describes the sequence after time
.
This method is implemented using a binary search,
public Segment GetSegmentAfter(Rational time)
Parameters
time
Rational
Time of the sample.
Returns
Segment
The describing the sequence after .
Exceptions
ArgumentException
Thrown if the given time is out of sequence support.
GetElementAt_Linear(Rational, Int32)
Returns the Element that describes the sequence in time
, and its index in the sequence.
This method is implemented using a linear search, . It should be used in place of GetElementAt(Rational) only for consecutive queries which traverse the sequence linearly, caching the index between calls. Thus, the overall cost will be .
public ValueTuple<Element, int> GetElementAt_Linear(Rational time, int startingIndex)
Parameters
time
Rational
Time of the sample.
startingIndex
Int32
The index from which the search should start.
Returns
ValueTuple<Element, Int32>
The describing the sequence at .
Exceptions
ArgumentException
Thrown if the given time is out of sequence support.
GetOverlap(Sequence, Sequence)
Computes the overlap between two sequences.
public static Nullable<ValueTuple<Rational, Rational, bool, bool>> GetOverlap(Sequence a, Sequence b)
Parameters
a
Sequence
b
Sequence
Returns
Nullable<ValueTuple<Rational, Rational, Boolean, Boolean>>
The endpoints of the overlap interval, including whether its left/right closed, or null if there is none.
GetOverlap(Sequence)
Computes the overlap between two sequences.
public Nullable<ValueTuple<Rational, Rational, bool, bool>> GetOverlap(Sequence secondOperand)
Parameters
secondOperand
Sequence
Returns
Nullable<ValueTuple<Rational, Rational, Boolean, Boolean>>
The endpoints of the overlap interval, or null if there is none.
Cut(Rational, Rational, Boolean, Boolean)
Returns a cut of the sequence for a smaller support.
public Sequence Cut(Rational cutStart, Rational cutEnd, bool isStartIncluded, bool isEndIncluded)
Parameters
cutStart
Rational
Left endpoint of the new support.
cutEnd
Rational
Right endpoint of the new support.
isStartIncluded
Boolean
If true, the support is left-closed.
isEndIncluded
Boolean
If true, the support is right-closed.
Returns
Exceptions
ArgumentException
Thrown if the new support is not a subset of the current one.
CutAsEnumerable(Rational, Rational, Boolean, Boolean)
Returns a cut of the sequence for a smaller support.
Optimized for minimal allocations.
public IEnumerable<Element> CutAsEnumerable(Rational cutStart, Rational cutEnd, bool isStartIncluded, bool isEndIncluded)
Parameters
cutStart
Rational
Left endpoint of the new support.
cutEnd
Rational
Right endpoint of the new support.
isStartIncluded
Boolean
If true, the support is left-closed.
isEndIncluded
Boolean
If true, the support is right-closed.
Returns
Exceptions
ArgumentException
Thrown if the new support is not a subset of the current one.
FindFirstIndex(Predicate<Element>, Nullable<Int32>, Nullable<Int32>)
Runs a binary search for the first element of the sequence that satisfies the predicate, and returns its index.
As it is based on a binary search, the predicate must divide the sequence in (up to) two parts: the first in which it is false
, the second in which it is true
.
public int FindFirstIndex(Predicate<Element> predicate, Nullable<int> start, Nullable<int> end)
Parameters
predicate
Predicate<Element>
The predicate that the element is to be tested against.
start
Nullable<Int32>
Inclusive zero-based index of the start of the range of elements to search within. If not set, defaults to 0.
end
Nullable<Int32>
Non-inclusive zero-based index of the end of the range of elements to search within. If not set, defaults to Count.
Returns
Int32
The index of the first element that satisfies the predicate, or if not found.
Exceptions
ArgumentException
and do not denote a valid range of elements in the Sequence.
FindLastIndex(Predicate<Element>, Nullable<Int32>, Nullable<Int32>)
Runs a binary search for the last element of the sequence that satisfies the predicate, and returns its index.
As it is based on a binary search, the predicate must divide the sequence in (up to) two parts: the first in which it is true
, the second in which it is false
.
public int FindLastIndex(Predicate<Element> predicate, Nullable<int> start, Nullable<int> end)
Parameters
predicate
Predicate<Element>
The predicate that the element is to be tested against.
start
Nullable<Int32>
Inclusive zero-based index of the start of the range of elements to search within. If not set, defaults to 0.
end
Nullable<Int32>
Non-inclusive zero-based index of the end of the range of elements to search within. If not set, defaults to Count.
Returns
Int32
The index of the last element that satisfies the predicate, or -1 if not found
Exceptions
ArgumentException
and do not denote a valid range of elements in the Sequence.
GetRange(Int32, Int32)
Retrieves a range of elements from the sequence, via zero-based indexing.
public IEnumerable<Element> GetRange(int start, int end)
Parameters
start
Int32
Zero-based index at which the range starts.
end
Int32
Non-inclusive zero-based index at which the range ends.
Returns
IEnumerable<Element>
The range of elements
Exceptions
ArgumentException
and do not denote a valid range of elements in the Sequence.
Optimize()
Returns an equivalent sequence optimized to have the minimum amount of segments.
The result is a well-formed sequence [ZS23]
public Sequence Optimize()
Returns
EnforceSplitAt(Rational)
Returns an equivalent sequence guaranteed to have a Point at the given time.
public Sequence EnforceSplitAt(Rational time)
Parameters
time
Rational
Time of the split.
Returns
Sequence
A new sequence with the enforced split, or this if it's already enforced.
Exceptions
ArgumentException
Thrown if the time of split is outside the sequence support.
MaxValue()
If the sequence is upper-bounded, i.e. for any , returns . Otherwise, returns PlusInfinity
public Rational MaxValue()
Returns
MinValue()
If the sequence is lower-bounded, i.e. for any , returns . Otherwise, returns MinusInfinity
public Rational MinValue()
Returns
Fill(IEnumerable<Element>, Rational, Rational, Boolean, Boolean, Nullable<Rational>)
Fills the gaps of the set of elements within fillFrom
and fillTo
with the given value, defaults to .
public static IEnumerable<Element> Fill(IEnumerable<Element> elements, Rational fillFrom, Rational fillTo, bool isFromIncluded, bool isToIncluded, Nullable<Rational> fillWith)
Parameters
elements
IEnumerable<Element>
The set of elements. Must be in order.
fillFrom
Rational
Left endpoint of the filling interval.
fillTo
Rational
Right endpoint of the filling interval.
isFromIncluded
Boolean
If true, left endpoint is inclusive.
isToIncluded
Boolean
If true, right endpoint is inclusive.
fillWith
Nullable<Rational>
The value filled in. Defaults to
Returns
ToString()
Returns string serialization in Json format.
public string ToString()
Returns
FromJson(String)
Deserializes a Sequence.
public static Sequence FromJson(string json)
Parameters
json
String
Returns
ToCodeString(Boolean, Int32)
Returns a string containing C# code to create this Sequence. Useful to copy and paste from a debugger into another test or notebook for further investigation.
public string ToCodeString(bool formatted, int indentation)
Parameters
formatted
Boolean
indentation
Int32
Returns
Scale(Rational)
Scales the sequence by a multiplicative factor.
public Sequence Scale(Rational scaling)
Parameters
scaling
Rational
Returns
Delay(Rational, Boolean)
Translates forward the support by the given time quantity.
public Sequence Delay(Rational delay, bool prependWithZero)
Parameters
delay
Rational
prependWithZero
Boolean
Returns
Anticipate(Rational)
Translates backwards the support by the given time quantity.
public Sequence Anticipate(Rational time)
Parameters
time
Rational
Returns
VerticalShift(Rational, Boolean)
Shifts the sequence vertically by an additive factor.
public Sequence VerticalShift(Rational shift, bool exceptOrigin)
Parameters
shift
Rational
exceptOrigin
Boolean
Returns
Concat(Sequence, Sequence, Boolean, Boolean)
Concatenates two sequences.
public static Sequence Concat(Sequence a, Sequence b, bool preserveDelay, bool preserveShift)
Parameters
a
Sequence
The first sequence of the concatenation. It must be finite in its right end.
b
Sequence
The second sequence of the concatenation. It must be finite in its left end.
preserveDelay
Boolean
If starts later than , and this option is true
, this gap will be preserved in the concatenation with an infinite-valued segment.
Otherwise, the gap is removed as if started from .
preserveShift
Boolean
Let be starting value of , if is not and this option is true
, this shift will be preserved in the concatenation.
Otherwise, the shift is removed as if .
Returns
Sequence
The sequence obtained from concatenating sequence at the end of sequence .
Exceptions
ArgumentException
If either sequence is infinite at the end where concatenation happens.
Concat(Sequence, Sequence, Rational)
Concatenates two sequences.
Let be the right edge of a
and its value.
Then b
is concatenated at , starting from value addedShift
.
public static Sequence Concat(Sequence a, Sequence b, Rational addedShift)
Parameters
a
Sequence
The first sequence of the concatenation. It must be finite in its right end.
b
Sequence
The second sequence of the concatenation. It must be finite in its left end.
addedShift
Rational
The concatenation will have an additional shift of this size.
Returns
Sequence
The sequence obtained from concatenating sequence at the end of sequence .
Exceptions
ArgumentException
If either sequence is infinite at the end where concatenation happens.
Concat(IEnumerable<Sequence>, Boolean, Boolean)
Concatenates a set of sequences, in the order they are provided.
public static Sequence Concat(IEnumerable<Sequence> sequences, bool preserveDelay, bool preserveShift)
Parameters
sequences
IEnumerable<Sequence>
The sequences to be concatenated. They must be finite at each point of concatenation.
preserveDelay
Boolean
For each concatenation, let be the second sequence.
If starts later than , and this option is true
, this gap will be preserved in the concatenation with an infinite-valued segment.
Otherwise, the gap is removed as if started from .
preserveShift
Boolean
For each concatenation, let be the second sequence.
Let be starting value of , if is not and this option is true
, this shift will be preserved in the concatenation.
Otherwise, the shift is removed as if .
Returns
Sequence
The sequence obtained from concatenating all the sequences.
Exceptions
ArgumentException
If any sequence is infinite at an end where concatenation happens
ToNonNegative()
Computes a non-negative version of this sequence, i.e. a curve if , otherwise.
public Sequence ToNonNegative()
Returns
ToLeftContinuous()
Computes a left-continuous version of this sequence.
public Sequence ToLeftContinuous()
Returns
ToRightContinuous()
Computes a right-continuous version of this sequence.
public Sequence ToRightContinuous()
Returns
LowerPseudoInverse(Boolean)
Computes the lower pseudo-inverse function, .
public Sequence LowerPseudoInverse(bool startFromZero)
Parameters
startFromZero
Boolean
If true, it is assumed that be defined from .
Returns
Exceptions
ArgumentException
If the curve is not non-decreasing.
UpperPseudoInverse(Boolean)
Computes the upper pseudo-inverse function, .
public Sequence UpperPseudoInverse(bool startFromZero)
Parameters
startFromZero
Boolean
If true, it is assumed that be defined from .
Returns
Exceptions
ArgumentException
If the curve is not non-decreasing.
Addition(Sequence, Sequence)
Adds two sequences, over their overlapping parts.
public static Sequence Addition(Sequence a, Sequence b)
Parameters
a
Sequence
b
Sequence
Returns
Sequence
The sequence resulting from the sum.
Addition(Sequence)
Adds two sequences, over their overlapping parts.
public Sequence Addition(Sequence b)
Parameters
b
Sequence
Returns
Sequence
The sequence resulting from the sum.
Subtraction(Sequence, Sequence, Boolean)
Subtracts two sequences, over their overlapping parts.
The operation does not enforce non-negative values.
public static Sequence Subtraction(Sequence a, Sequence b, bool nonNegative)
Parameters
a
Sequence
b
Sequence
nonNegative
Boolean
If true, the result is non-negative.
Returns
Sequence
The sequence resulting from the sum.
Subtraction(Sequence, Boolean)
Subtracts two sequences, over their overlapping parts.
public Sequence Subtraction(Sequence b, bool nonNegative)
Parameters
b
Sequence
nonNegative
Boolean
If true, the result is non-negative.
Returns
Sequence
The sequence resulting from the sum.
Minimum(Sequence, Sequence, Boolean, ComputationSettings)
Computes minimum of two sequences.
public static Sequence Minimum(Sequence a, Sequence b, bool cutToOverlap, ComputationSettings settings)
Parameters
a
Sequence
First operand.
b
Sequence
Second operand.
cutToOverlap
Boolean
If set, the minimum is performed over the overlapping part.
settings
ComputationSettings
Returns
Sequence
The sequence resulting from the minimum.
Minimum(Sequence, Boolean, ComputationSettings)
Computes minimum of two sequences.
public Sequence Minimum(Sequence b, bool cutToOverlap, ComputationSettings settings)
Parameters
b
Sequence
Second operand.
cutToOverlap
Boolean
If set, the minimum is performed over the overlapping part.
settings
ComputationSettings
Returns
Sequence
The sequence resulting from the minimum.
LowerEnvelope(Sequence, Sequence, ComputationSettings)
Computes the lower envelope of the pair of sequences given. complexity.
Used for minimum
public static List<Element> LowerEnvelope(Sequence a, Sequence b, ComputationSettings settings)
Parameters
a
Sequence
b
Sequence
settings
ComputationSettings
Returns
Maximum(Sequence, Sequence, Boolean, ComputationSettings)
Computes maximum of two sequences, over their overlapping parts.
public static Sequence Maximum(Sequence a, Sequence b, bool cutToOverlap, ComputationSettings settings)
Parameters
a
Sequence
First operand.
b
Sequence
Second operand.
cutToOverlap
Boolean
If set, the maximum is performed over the overlapping part.
settings
ComputationSettings
Returns
Sequence
The sequence resulting from the maximum.
Maximum(Sequence, Boolean, ComputationSettings)
Computes maximum of two sequences, over their overlapping parts.
public Sequence Maximum(Sequence b, bool cutToOverlap, ComputationSettings settings)
Parameters
b
Sequence
Second operand.
cutToOverlap
Boolean
If set, the maximum is performed over the overlapping part.
settings
ComputationSettings
Returns
Sequence
The sequence resulting from the maximum.
UpperEnvelope(Sequence, Sequence, ComputationSettings)
Computes the lower envelope of the pair of sequences given. complexity.
Used for maximum.
public static List<Element> UpperEnvelope(Sequence a, Sequence b, ComputationSettings settings)
Parameters
a
Sequence
b
Sequence
settings
ComputationSettings
Returns
Convolution(Sequence, Sequence, ComputationSettings, Nullable<Rational>, Nullable<Rational>, Boolean, Boolean, Boolean)
Computes the convolution of two sequences, .
Described in [BT08], Section 4.4 point 3
public static Sequence Convolution(Sequence f, Sequence g, ComputationSettings settings, Nullable<Rational> cutEnd, Nullable<Rational> cutCeiling, bool isEndIncluded, bool isCeilingIncluded, bool useIsomorphism)
Parameters
f
Sequence
g
Sequence
settings
ComputationSettings
cutEnd
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
cutCeiling
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
isEndIncluded
Boolean
isCeilingIncluded
Boolean
useIsomorphism
Boolean
Returns
Sequence
The result of the convolution.
Convolution(Sequence, ComputationSettings, Nullable<Rational>)
Computes the convolution of two sequences, .
Described in [BT08], Section 4.4 point 3
public Sequence Convolution(Sequence sequence, ComputationSettings settings, Nullable<Rational> cutEnd)
Parameters
sequence
Sequence
settings
ComputationSettings
cutEnd
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
Returns
Sequence
The result of the convolution.
EstimateConvolution(Sequence, Sequence, ComputationSettings, Nullable<Rational>, Nullable<Rational>, Boolean)
Computes the number of elementary convolutions involved in computing the convolution of the two sequences, avoiding allocations as much as possible.
public static long EstimateConvolution(Sequence a, Sequence b, ComputationSettings settings, Nullable<Rational> cutEnd, Nullable<Rational> cutCeiling, bool countElements)
Parameters
a
Sequence
b
Sequence
settings
ComputationSettings
cutEnd
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
cutCeiling
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
countElements
Boolean
If true, instead of counting only how many convolutions are done, it counts how many convolution elements are produced.
Returns
Int64
The number of elementary convolutions involved in computing the result of the convolution, or the number of elements resulting from these convolutions if is true
.
Deconvolution(Sequence, Sequence, Nullable<Rational>, Nullable<Rational>, ComputationSettings)
Computes the deconvolution of two sequences, .
Described in [BT08], Section 4.5
public static Sequence Deconvolution(Sequence a, Sequence b, Nullable<Rational> cutStart, Nullable<Rational> cutEnd, ComputationSettings settings)
Parameters
a
Sequence
b
Sequence
cutStart
Nullable<Rational>
If not null, element deconvolutions whose result ends strictly before this time are skipped.
cutEnd
Nullable<Rational>
If not null, the result is cut or filled with up to this time, endpoint excluded.
settings
ComputationSettings
Returns
Sequence
The result of the deconvolution.
Deconvolution(Sequence, Nullable<Rational>, Nullable<Rational>, ComputationSettings)
Computes the deconvolution of two sequences, .
Described in [BT08], Section 4.5
public Sequence Deconvolution(Sequence sequence, Nullable<Rational> cutStart, Nullable<Rational> cutEnd, ComputationSettings settings)
Parameters
sequence
Sequence
cutStart
Nullable<Rational>
If not null, element deconvolutions whose result ends strictly before this time are skipped.
cutEnd
Nullable<Rational>
If not null, the result is cut or filled with up to this time, endpoint excluded.
settings
ComputationSettings
Returns
Sequence
The result of the deconvolution.
MaxPlusConvolution(Sequence, Sequence, ComputationSettings, Nullable<Rational>, Nullable<Rational>, Boolean, Boolean, Boolean)
Computes the max-plus convolution of two sequences.
Adapted from the min-plus convolution algorithm described in [BT08], Section 4.4 point 3
public static Sequence MaxPlusConvolution(Sequence f, Sequence g, ComputationSettings settings, Nullable<Rational> cutEnd, Nullable<Rational> cutCeiling, bool isEndIncluded, bool isCeilingIncluded, bool useIsomorphism)
Parameters
f
Sequence
g
Sequence
settings
ComputationSettings
cutEnd
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
cutCeiling
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
isEndIncluded
Boolean
isCeilingIncluded
Boolean
useIsomorphism
Boolean
Returns
Sequence
The result of the convolution.
MaxPlusConvolution(Sequence, ComputationSettings, Nullable<Rational>)
Computes the max-plus convolution of two sequences.
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public Sequence MaxPlusConvolution(Sequence sequence, ComputationSettings settings, Nullable<Rational> cutEnd)
Parameters
sequence
Sequence
settings
ComputationSettings
cutEnd
Nullable<Rational>
If defined, computation of convolutions beyond the given limit will be omitted.
Returns
Sequence
The result of the convolution.
MaxPlusDeconvolution(Sequence, Sequence, ComputationSettings)
Computes the max-plus convolution of two sequences.
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public static Sequence MaxPlusDeconvolution(Sequence a, Sequence b, ComputationSettings settings)
Parameters
a
Sequence
b
Sequence
settings
ComputationSettings
Returns
Sequence
The result of the max-plus deconvolution.
MaxPlusDeconvolution(Sequence, ComputationSettings)
Computes the max-plus convolution of two sequences.
Max-plus operators are defined through min-plus operators, see [DNC18] Section 2.4
public Sequence MaxPlusDeconvolution(Sequence sequence, ComputationSettings settings)
Parameters
sequence
Sequence
settings
ComputationSettings
Returns
Sequence
The result of the max-plus deconvolution.
Composition(Sequence, Sequence)
Compute the composition , over a limited interval.
Algorithmic properties discussed in [ZNS23b].
public static Sequence Composition(Sequence f, Sequence g)
Parameters
f
Sequence
Outer function, defined in or .
g
Sequence
Inner function, non-negative and non-decreasing, defined in .
Returns
Sequence
The result of the composition.
Exceptions
ArgumentException
If the operands are not defined as expected.
Composition(Sequence)
Compute the composition of this sequence, , and , i.e. , over a limited interval. This sequence must be defined in or .
public Sequence Composition(Sequence g)
Parameters
g
Sequence
Inner function, non-negative and non-decreasing, defined in .
Returns
Sequence
The result of the composition.
Exceptions
ArgumentException
If the operands are not defined as expected.