public static FSharpList <RankedTree <a> > insertTree <a>(IComparer <a> comparer, RankedTree <a> t, FSharpList <RankedTree <a> > ts) { while (true) { FSharpList <RankedTree <a> > fsharpList1 = ts; if (fsharpList1.get_TailOrNull() != null) { FSharpList <RankedTree <a> > fsharpList2 = fsharpList1; FSharpList <RankedTree <a> > tailOrNull = fsharpList2.get_TailOrNull(); RankedTree <a> headOrDefault = fsharpList2.get_HeadOrDefault(); if (BinomialHeap.rank <a>(t) >= BinomialHeap.rank <a>(headOrDefault)) { IComparer <a> comparer1 = comparer; RankedTree <a> rankedTree = BinomialHeap.link <a>(comparer, t, headOrDefault); ts = tailOrNull; t = rankedTree; comparer = comparer1; } else { goto label_3; } } else { break; } } return(FSharpList <RankedTree <a> > .Cons(t, FSharpList <RankedTree <a> > .get_Empty())); label_3: return(FSharpList <RankedTree <a> > .Cons(t, ts)); }
public SeriesBuilder() { SeriesBuilder <K, V> seriesBuilder = this; this.keys = FSharpList <K> .get_Empty(); this.values = FSharpList <V> .get_Empty(); }
Tuple <IIndex <TNewKey>, IVector <R> > IIndexBuilder.Resample <K, TNewKey, R>(IIndexBuilder chunkBuilder, IIndex <K> index, IEnumerable <K> keys, Deedle.Direction dir, VectorConstruction vector, Func <Tuple <K, Tuple <IIndex <K>, VectorConstruction> >, Tuple <TNewKey, R> > selector) { if (!index.IsOrdered) { throw new InvalidOperationException("Resampling is only supported on ordered indices"); } IIndexBuilder indexBuilder = (IIndexBuilder)this; IEnumerable <M1> m1s; if (dir == Deedle.Direction.Forward) { IEnumerable <Tuple <K, long> > tuples = (IEnumerable <Tuple <K, long> >)SeqModule.Map <K, Tuple <K, long> >((Func <M0, M1>) new LinearIndex.keyLocations <K>(index), keys); m1s = SeqModule.MapIndexed <Tuple <Tuple <K, long>, Tuple <K, long> >, Tuple <K, Tuple <long, long> > >((Func <int, Func <M0, M1> >) new LinearIndex.locations <K>(index), (IEnumerable <M0>)SeqModule.Pairwise <Tuple <K, long> >(SeqModule.Append <Tuple <K, long> >((IEnumerable <M0>)tuples, (IEnumerable <M0>)FSharpList <Tuple <K, long> > .Cons(new Tuple <K, long>(default(K), Addressing.LinearAddress.invalid), FSharpList <Tuple <K, long> > .get_Empty())))); } else { int keyLen = SeqModule.Length <K>(keys); IEnumerable <Tuple <K, long> > tuples = (IEnumerable <Tuple <K, long> >)SeqModule.Map <K, Tuple <K, long> >((Func <M0, M1>) new LinearIndex.keyLocations <K>(index), keys); m1s = SeqModule.MapIndexed <Tuple <Tuple <K, long>, Tuple <K, long> >, Tuple <K, Tuple <long, long> > >((Func <int, Func <M0, M1> >) new LinearIndex.locations <K>(index, keyLen), (IEnumerable <M0>)SeqModule.Pairwise <Tuple <K, long> >(SeqModule.Append <Tuple <K, long> >((IEnumerable <M0>)FSharpList <Tuple <K, long> > .Cons(new Tuple <K, long>(default(K), Addressing.LinearAddress.invalid), FSharpList <Tuple <K, long> > .get_Empty()), (IEnumerable <M0>)tuples))); } Tuple <K, Tuple <long, long> >[] tupleArray1 = (Tuple <K, Tuple <long, long> >[])ArrayModule.OfSeq <Tuple <K, Tuple <long, long> > >((IEnumerable <M0>)m1s); Func <Tuple <K, Tuple <long, long> >, Tuple <K, Tuple <IIndex <K>, VectorConstruction> > > Func1 = (Func <Tuple <K, Tuple <long, long> >, Tuple <K, Tuple <IIndex <K>, VectorConstruction> > >) new LinearIndex.vectorConstructions <K>(chunkBuilder, index); Tuple <K, Tuple <long, long> >[] tupleArray2 = tupleArray1; if ((object)tupleArray2 == null) { throw new ArgumentNullException("array"); } Tuple <K, Tuple <IIndex <K>, VectorConstruction> >[] tupleArray3 = new Tuple <K, Tuple <IIndex <K>, VectorConstruction> > [tupleArray2.Length]; for (int index1 = 0; index1 < tupleArray3.Length; ++index1) { tupleArray3[index1] = Func1.Invoke(tupleArray2[index1]); } Tuple <K, Tuple <IIndex <K>, VectorConstruction> >[] tupleArray4 = tupleArray3; Func <Tuple <K, Tuple <IIndex <K>, VectorConstruction> >, Tuple <TNewKey, R> > Func2 = selector; Tuple <K, Tuple <IIndex <K>, VectorConstruction> >[] tupleArray5 = tupleArray4; if ((object)tupleArray5 == null) { throw new ArgumentNullException("array"); } Tuple <TNewKey, R>[] tupleArray6 = new Tuple <TNewKey, R> [tupleArray5.Length]; for (int index1 = 0; index1 < tupleArray6.Length; ++index1) { tupleArray6[index1] = Func2.Invoke(tupleArray5[index1]); } Tuple <TNewKey, R>[] tupleArray7 = tupleArray6; IIndex <TNewKey> index2 = indexBuilder.Create <TNewKey>(SeqModule.Map <Tuple <TNewKey, R>, TNewKey>((Func <M0, M1>) new LinearIndex.newIndex <TNewKey, R>(), (IEnumerable <M0>)tupleArray7), (FSharpOption <bool>)null); IVectorBuilder vectorBuilder1 = this.vectorBuilder; Func <Tuple <TNewKey, R>, R> Func3 = (Func <Tuple <TNewKey, R>, R>) new LinearIndex.vect <TNewKey, R>(); Tuple <TNewKey, R>[] tupleArray8 = tupleArray7; if ((object)tupleArray8 == null) { throw new ArgumentNullException("array"); } R[] optionalValueArray = new R[tupleArray8.Length]; IVectorBuilder vectorBuilder2 = vectorBuilder1; for (int index1 = 0; index1 < optionalValueArray.Length; ++index1) { optionalValueArray[index1] = Func3.Invoke(tupleArray8[index1]); } IVector <R> missing = vectorBuilder2.CreateMissing <R>(optionalValueArray); return(new Tuple <IIndex <TNewKey>, IVector <R> >(index2, missing)); }
void ICollection <KeyValuePair <K, V> > .Clear() { this.keys = FSharpList <K> .get_Empty(); this.values = FSharpList <V> .get_Empty(); }
public Rows() { FrameBuilder.Rows <R, C> rows = this; this.series = FSharpList <Tuple <R, ISeries <C> > > .get_Empty(); }
public Columns() { FrameBuilder.Columns <R, C> columns = this; this.series = FSharpList <Tuple <C, ISeries <R> > > .get_Empty(); }
public static Frame <TRowKey, TColumnKey> Merge <TRowKey, TColumnKey>(this Frame <TRowKey, TColumnKey> frame, TRowKey rowKey, ISeries <TColumnKey> row) { return(frame.Merge(FFrameextensions.FrameofRowsStatic <TRowKey, ISeries <TColumnKey>, TColumnKey>((IEnumerable <Tuple <TRowKey, ISeries <TColumnKey> > >)FSharpList <Tuple <TRowKey, ISeries <TColumnKey> > > .Cons(FFrameextensions.op_EqualsGreater <TRowKey, ISeries <TColumnKey> >(rowKey, row), FSharpList <Tuple <TRowKey, ISeries <TColumnKey> > > .get_Empty())))); }
public static bool isEmpty <a>(BinomialHeap <a> heap) { return(heap.Heap.Equals((object)FSharpList <RankedTree <a> > .get_Empty(), LanguagePrimitives.get_GenericEqualityComparer())); }
public static BinomialHeap <T> empty <T>() { return(new BinomialHeap <T>((IComparer <T>)Comparer <T> .Default, FSharpList <RankedTree <T> > .get_Empty())); }
public static BinomialHeap <a> emptyCustom <a>(IComparer <a> comparer) { return(new BinomialHeap <a>(comparer, FSharpList <RankedTree <a> > .get_Empty())); }
internal static Tuple <RankedTree <a>, FSharpList <RankedTree <a> > > removeMinTree <a>(IComparer <a> comparer, FSharpList <RankedTree <a> > heap) { FSharpList <RankedTree <a> > fsharpList1 = heap; if (fsharpList1.get_TailOrNull() == null) { throw new InvalidOperationException("The heap is empty."); } FSharpList <RankedTree <a> > fsharpList2 = fsharpList1; if (fsharpList2.get_TailOrNull().get_TailOrNull() == null) { return(new Tuple <RankedTree <a>, FSharpList <RankedTree <a> > >(fsharpList2.get_HeadOrDefault(), FSharpList <RankedTree <a> > .get_Empty())); } FSharpList <RankedTree <a> > tailOrNull = fsharpList2.get_TailOrNull(); RankedTree <a> headOrDefault = fsharpList2.get_HeadOrDefault(); Tuple <RankedTree <a>, FSharpList <RankedTree <a> > > tuple = BinomialHeap.removeMinTree <a>(comparer, tailOrNull); FSharpList <RankedTree <a> > fsharpList3 = tuple.Item2; RankedTree <a> rankedTree = tuple.Item1; FSharpChoice <Unit, Unit, Unit> fsharpChoice = BinomialHeap.LTGTEQ(comparer.Compare(BinomialHeap.root <a>(headOrDefault), BinomialHeap.root <a>(rankedTree))); if (fsharpChoice is FSharpChoice <Unit, Unit, Unit> .Choice1Of3 || fsharpChoice is FSharpChoice <Unit, Unit, Unit> .Choice3Of3) { return(new Tuple <RankedTree <a>, FSharpList <RankedTree <a> > >(headOrDefault, tailOrNull)); } return(new Tuple <RankedTree <a>, FSharpList <RankedTree <a> > >(rankedTree, FSharpList <RankedTree <a> > .Cons(headOrDefault, fsharpList3))); }
public static BinomialHeap <a> insert <a>(a x, BinomialHeap <a> heap) { FSharpList <RankedTree <a> > heap1 = BinomialHeap.insertTree <a>(heap.Comparer, RankedTree <a> .NewNode(0, x, FSharpList <RankedTree <a> > .get_Empty()), heap.Heap); return(new BinomialHeap <a>(heap.Comparer, heap1)); }
public static Series <K, int> Diff <K>(this Series <K, int> series, int offset) { Series <K, int> series1 = series; int num = offset; Series <K, int> series2 = series1; IVectorBuilder instance = FVectorBuilderimplementation.VectorBuilder.Instance; Tuple <IIndex <K>, VectorConstruction> tuple = series2.Index.Builder.Shift <K>(new Tuple <IIndex <K>, VectorConstruction>(series2.Index, VectorConstruction.NewReturn(0)), num); VectorConstruction vectorConstruction1 = tuple.Item2; IIndex <K> index = tuple.Item1; VectorConstruction vectorConstruction2 = series2.Index.Builder.Shift <K>(new Tuple <IIndex <K>, VectorConstruction>(series2.Index, VectorConstruction.NewReturn(0)), -num).Item2; VectorConstruction vectorConstruction3 = VectorConstruction.NewCombine((Lazy <long>)LazyExtensions.Create <long>((FSharpFunc <Unit, M0>) new SeriesExtensions.Diff2 <K>(index)), FSharpList <VectorConstruction> .Cons(vectorConstruction2, FSharpList <VectorConstruction> .Cons(vectorConstruction1, FSharpList <VectorConstruction> .get_Empty())), VectorListTransform.NewBinary((IBinaryTransform) new SeriesExtensions.Diff5((FSharpFunc <OptionalValue <int>, FSharpFunc <OptionalValue <int>, OptionalValue <int> > >) new SeriesExtensions.Diff4((FSharpFunc <int, FSharpFunc <int, int> >) new SeriesExtensions.Diff3())))); IVector <int> vector = instance.Build <int>(index.AddressingScheme, vectorConstruction3, new IVector <int>[1] { series2.Vector }); return(new Series <K, int>(index, vector, instance, series2.Index.Builder)); }
public static Frame <K, string> FromRowKeys <K>(IEnumerable <K> keys) { return(new Frame <K, string>(FrameUtils.indexBuilder.Create <K>(keys, (FSharpOption <bool>)null), FrameUtils.indexBuilder.Create <string>((IEnumerable <string>)FSharpList <string> .get_Empty(), (FSharpOption <bool>)null), FrameUtils.vectorBuilder.Create <IVector>(new IVector[0]), FIndexBuilderimplementation.IndexBuilder.Instance, FVectorBuilderimplementation.VectorBuilder.Instance)); }
public static Frame <R, C> CreateEmpty <R, C>() { return(new Frame <R, C>(FIndexextensions.Index.ofKeys <R>(FSharpList <R> .get_Empty()), FIndexextensions.Index.ofKeys <C>(FSharpList <C> .get_Empty()), FVectorBuilderimplementation.VectorBuilder.Instance.Create <IVector>((IVector[])ArrayModule.OfSeq <IVector>((IEnumerable <M0>)FSharpList <IVector> .get_Empty())), FIndexBuilderimplementation.IndexBuilder.Instance, FVectorBuilderimplementation.VectorBuilder.Instance)); }