public static V Max <K, V>(this Series <K, V> series) { Series <K, V> series1 = series; FSharpFunc <V, FSharpFunc <V, V> > fsharpFunc = (FSharpFunc <V, FSharpFunc <V, V> >) new SeriesStatsExtensions.Max <V>(); Series <K, V> series2 = series1; V v = default(V); bool flag = false; IEnumerator <OptionalValue <V> > enumerator = FVectorextensionscore.IVector ` 1get_DataSequence < V > (series2.Vector).GetEnumerator(); try { while (enumerator.MoveNext()) { OptionalValue <V> current = enumerator.Current; if (current.HasValue) { v = !flag ? current.Value : (V)FSharpFunc <V, V> .InvokeFast <V>((FSharpFunc <V, FSharpFunc <V, M0> >) fsharpFunc, v, current.Value); flag = true; } } } finally { (enumerator as IDisposable)?.Dispose(); } return((V)OptionModule.GetValue <V>(!flag ? (FSharpOption <M0>)null : (FSharpOption <M0>)FSharpOption <V> .Some(v))); }
public Deedle.Ranges.Ranges <T> MergeWith(IEnumerable <Deedle.Ranges.Ranges <T> > ranges) { IEnumerable <Deedle.Ranges.Ranges <T> > list = (IEnumerable <Deedle.Ranges.Ranges <T> >)SeqModule.ToList <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>) new Ranges.MergeWith <T>(this, ranges, 0, (Deedle.Ranges.Ranges <T>)null)); if (SeqModule.IsEmpty <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>)list)) { throw new ArgumentException("Range cannot be empty", nameof(ranges)); } IRangeKeyOperations <T> operations = ((Deedle.Ranges.Ranges <T>)SeqModule.Head <Deedle.Ranges.Ranges <T> >((IEnumerable <M0>)list)).Operations; FSharpList <Tuple <T, T> > fsharpList = (FSharpList <Tuple <T, T> >)ListModule.SortWith <Tuple <T, T> >((FSharpFunc <M0, FSharpFunc <M0, int> >) new Ranges.MergeWith <T>(operations), SeqModule.ToList <Tuple <T, T> >((IEnumerable <M0>) new Ranges.MergeWith <T>(list, (Deedle.Ranges.Ranges <T>)null, (IEnumerator <Deedle.Ranges.Ranges <T> >)null, (Tuple <T, T>)null, (IEnumerator <Tuple <T, T> >)null, 0, (Tuple <T, T>)null))); FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, IEnumerable <Tuple <T, T> > > > fsharpFunc = (FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, IEnumerable <Tuple <T, T> > > >) new Ranges.MergeWith <T>(operations); IRangeKeyOperations <T> ops = operations; return(new Deedle.Ranges.Ranges <T>((IEnumerable <Tuple <T, T> >)FSharpFunc <Tuple <T, T>, FSharpList <Tuple <T, T> > > .InvokeFast <IEnumerable <Tuple <T, T> > >((FSharpFunc <Tuple <T, T>, FSharpFunc <FSharpList <Tuple <T, T> >, M0> >)fsharpFunc, (Tuple <T, T>)ListModule.Head <Tuple <T, T> >((FSharpList <M0>)fsharpList), (FSharpList <Tuple <T, T> >)ListModule.Tail <Tuple <T, T> >((FSharpList <M0>)fsharpList)), ops)); }
internal static Tuple <IIndex <a>, VectorConstruction, VectorConstruction> createJoinTransformation <a>(IIndexBuilder indexBuilder, IIndexBuilder otherIndexBuilder, JoinKind kind, Lookup lookup, IIndex <a> thisIndex, IIndex <a> otherIndex, VectorConstruction thisVector, VectorConstruction otherVector) { if ((lookup == Lookup.Exact ? 0 : (kind == JoinKind.Inner ? 1 : 0)) != 0) { throw new InvalidOperationException("Join/Zip - Inner join can only be used with Lookup.Exact."); } if ((lookup == Lookup.Exact ? 0 : (kind == JoinKind.Outer ? 1 : 0)) != 0) { throw new InvalidOperationException("Join/Zip - Outer join can only be used with Lookup.Exact."); } if (((!thisIndex.IsOrdered ? 0 : (otherIndex.IsOrdered ? 1 : 0)) != 0 ? 0 : (lookup != Lookup.Exact ? 1 : 0)) != 0) { throw new InvalidOperationException("Join/Zip - Lookup can be only used when joining/zipping ordered series/frames."); } JoinKind input = kind; Tuple <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind> tuple1 = MatchingHelpers.Let <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind>(new Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >(thisVector, otherVector, thisIndex, otherIndex, (FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > >) new JoinHelpers.createJoinTransformation <a>()), input); IIndex <a> sourceIndex; VectorConstruction vector1; FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > fsharpFunc1; IIndex <a> restriction; VectorConstruction vectorConstruction1; switch (tuple1.Item2) { case JoinKind.Left: VectorConstruction vectorConstruction2 = tuple1.Item1.Item1; IIndex <a> index1 = tuple1.Item1.Item3; FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > fsharpFunc2 = tuple1.Item1.Item5; VectorConstruction vectorConstruction3 = tuple1.Item1.Item2; sourceIndex = tuple1.Item1.Item4; vector1 = vectorConstruction3; fsharpFunc1 = fsharpFunc2; restriction = index1; vectorConstruction1 = vectorConstruction2; break; default: Tuple <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind> tuple2 = MatchingHelpers.Let <Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >, JoinKind>(new Tuple <VectorConstruction, VectorConstruction, IIndex <a>, IIndex <a>, FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > > >(thisVector, otherVector, thisIndex, otherIndex, (FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> > > >) new JoinHelpers.createJoinTransformation <a>()), input); switch (tuple2.Item2) { case JoinKind.Right: vectorConstruction1 = tuple2.Item1.Item2; restriction = tuple2.Item1.Item4; fsharpFunc1 = tuple2.Item1.Item5; vector1 = tuple2.Item1.Item1; sourceIndex = tuple2.Item1.Item3; break; default: switch (input) { case JoinKind.Outer: if ((!object.ReferenceEquals((object)thisIndex, (object)otherIndex) ? (LanguagePrimitives.HashCompare.GenericEqualityIntrinsic <IIndex <a> >((M0)thisIndex, (M0)otherIndex) ? 1 : 0) : 1) == 0) { goto default; } else { break; } case JoinKind.Inner: if ((!object.ReferenceEquals((object)thisIndex, (object)otherIndex) ? (LanguagePrimitives.HashCompare.GenericEqualityIntrinsic <IIndex <a> >((M0)thisIndex, (M0)otherIndex) ? 1 : 0) : 1) == 0) { goto default; } else { break; } default: switch (input) { case JoinKind.Outer: return(indexBuilder.Union <a>(new Tuple <IIndex <a>, VectorConstruction>(thisIndex, thisVector), new Tuple <IIndex <a>, VectorConstruction>(otherIndex, otherVector))); case JoinKind.Inner: return(indexBuilder.Intersect <a>(new Tuple <IIndex <a>, VectorConstruction>(thisIndex, thisVector), new Tuple <IIndex <a>, VectorConstruction>(otherIndex, otherVector))); default: throw new InvalidOperationException("Join/Zip - Invalid JoinKind value!"); } } return(new Tuple <IIndex <a>, VectorConstruction, VectorConstruction>(thisIndex, thisVector, otherVector)); } } if ((lookup != Lookup.Exact ? 0 : (object.ReferenceEquals((object)restriction, (object)sourceIndex) ? 1 : 0)) != 0) { return((Tuple <IIndex <a>, VectorConstruction, VectorConstruction>) FSharpFunc <IIndex <a>, VectorConstruction> .InvokeFast <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> >((FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <M0, M1> > >) fsharpFunc1, restriction, vectorConstruction1, (M0)vector1)); } Tuple <IIndex <a>, VectorConstruction> rowIndex = JoinHelpers.restrictToRowIndex <a>(lookup, restriction, sourceIndex, vector1); VectorConstruction vector2 = rowIndex.Item2; IIndex <a> index2 = rowIndex.Item1; if ((lookup != Lookup.Exact ? 0 : (LanguagePrimitives.HashCompare.GenericEqualityIntrinsic <IIndex <a> >((M0)restriction, (M0)index2) ? 1 : 0)) != 0) { return((Tuple <IIndex <a>, VectorConstruction, VectorConstruction>) FSharpFunc <IIndex <a>, VectorConstruction> .InvokeFast <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> >((FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <M0, M1> > >) fsharpFunc1, restriction, vectorConstruction1, (M0)vector2)); } VectorConstruction vectorConstruction4 = JoinHelpers.fillMissing(vector2, lookup); VectorConstruction vectorConstruction5 = otherIndexBuilder.Reindex <a>(index2, restriction, lookup, vectorConstruction4, (FSharpFunc <long, bool>) new JoinHelpers.otherRowCmd()); return((Tuple <IIndex <a>, VectorConstruction, VectorConstruction>) FSharpFunc <IIndex <a>, VectorConstruction> .InvokeFast <VectorConstruction, Tuple <IIndex <a>, VectorConstruction, VectorConstruction> >((FSharpFunc <IIndex <a>, FSharpFunc <VectorConstruction, FSharpFunc <M0, M1> > >) fsharpFunc1, restriction, vectorConstruction1, (M0)vectorConstruction5)); }