示例#1
0
        Tuple <IIndex <K>, VectorConstruction> IIndexBuilder.Merge <K>(FSharpList <Tuple <IIndex <K>, VectorConstruction> > constructions, VectorListTransform transform)
        {
            bool flag = ListModule.ForAll <Tuple <IIndex <K>, VectorConstruction> >((Func <M0, bool>) new LinearIndex.allOrdered <K>(), (FSharpList <M0>)constructions);
            Func <IComparer <K>, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > > Func1 = (Func <IComparer <K>, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > >) new LinearIndex.mergeOrdered <K>(constructions);
            Func <Unit, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > >          Func2 = (Func <Unit, Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > >) new LinearIndex.mergeUnordered <K>(constructions);
            Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple1;

            if (flag)
            {
                Comparer <K> comparer = ((Tuple <IIndex <K>, VectorConstruction>)ListModule.Head <Tuple <IIndex <K>, VectorConstruction> >((FSharpList <M0>)constructions)).Item1.Comparer;
                Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple2;
                try
                {
                    tuple2 = Func1.Invoke((IComparer <K>)comparer);
                }
                catch (object ex)
                {
                    if ((Exception)ex is ComparisonFailedException)
                    {
                        tuple2 = Func2.Invoke((Unit)null);
                    }
                    else
                    {
                        throw;
                    }
                }
                tuple1 = tuple2;
            }
            else
            {
                tuple1 = Func2.Invoke((Unit)null);
            }
            Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple3 = tuple1;
            FSharpOption <bool> fsharpOption = tuple3.Item2;
            Tuple <K[], FSharpList <Tuple <long, long>[]> > tuple4 = tuple3.Item1;
            IEnumerable <VectorConstruction> fsharpList1           = (IEnumerable <VectorConstruction>)ListModule.Map <Tuple <IIndex <K>, VectorConstruction>, VectorConstruction>((Func <M0, M1>) new LinearIndex.vectors <K>(), (FSharpList <M0>)constructions);
            LinearIndexBuilder linearIndexBuilder = this;
            Tuple <K[], FSharpList <Tuple <long, long>[]> > tuple5 = tuple4;
            IEnumerable <VectorConstruction> vectors = fsharpList1;
            FSharpOption <bool> ordered = fsharpOption;

            K[] keys = tuple5.Item1;
            FSharpList <Tuple <long, long>[]> relocations = tuple5.Item2;
            Tuple <IIndex <K>, IEnumerable <VectorConstruction> > tuple6 = linearIndexBuilder.makeSeriesConstructions <K>(keys, relocations, vectors, ordered);
            IEnumerable <VectorConstruction> fsharpList2 = tuple6.Item2;
            IIndex <K> newIndex = tuple6.Item1;

            return(new Tuple <IIndex <K>, VectorConstruction>(newIndex, VectorConstruction.NewCombine((Lazy <long>)LazyExtensions.Create <long>((Func <Unit, M0>) new LinearIndex.DeedleIndicesIIndexBuilderMerge <K>(newIndex)), fsharpList2, transform)));
        }
示例#2
0
        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));
        }