Esempio n. 1
0
        internal Tuple <IIndex <a>, VectorConstruction, VectorConstruction> makeTwoSeriesConstructions <a>(a[] spec_0, FSharpList <Tuple <long, long>[]> spec_1, VectorConstruction v1, VectorConstruction v2, FSharpOption <bool> ordered)
        {
            Tuple <a[], FSharpList <Tuple <long, long>[]> > tuple1 = new Tuple <a[], FSharpList <Tuple <long, long>[]> >(spec_0, spec_1);
            LinearIndexBuilder linearIndexBuilder = this;
            Tuple <a[], FSharpList <Tuple <long, long>[]> > tuple2 = tuple1;
            IEnumerable <VectorConstruction> vectors = IEnumerable <VectorConstruction> .Cons(v1, IEnumerable <VectorConstruction> .Cons(v2, IEnumerable <VectorConstruction> .get_Empty()));

            FSharpOption <bool> ordered1 = ordered;

            a[] keys = tuple2.Item1;
            FSharpList <Tuple <long, long>[]> relocations = tuple2.Item2;
            Tuple <IIndex <a>, IEnumerable <VectorConstruction> > tuple3 = linearIndexBuilder.makeSeriesConstructions <a>(keys, relocations, vectors, ordered1);

            if (tuple3.Item2.get_TailOrNull() != null)
            {
                IEnumerable <VectorConstruction> fsharpList = tuple3.Item2;
                if (fsharpList.get_TailOrNull().get_TailOrNull() != null)
                {
                    IEnumerable <VectorConstruction> tailOrNull = fsharpList.get_TailOrNull();
                    if (tailOrNull.get_TailOrNull().get_TailOrNull() == null)
                    {
                        VectorConstruction headOrDefault1 = tailOrNull.get_HeadOrDefault();
                        VectorConstruction headOrDefault2 = fsharpList.get_HeadOrDefault();
                        return(new Tuple <IIndex <a>, VectorConstruction, VectorConstruction>(tuple3.Item1, headOrDefault2, headOrDefault1));
                    }
                }
            }
            throw Operators.Failure("makeTwoSeriesConstructions: Expected two vectors");
        }
Esempio n. 2
0
        Tuple <IIndex <f>, VectorConstruction> IIndexBuilder.Shift <f>(Tuple <IIndex <f>, VectorConstruction> _arg3, int offset)
        {
            Tuple <IIndex <f>, VectorConstruction> tuple1 = _arg3;
            VectorConstruction vectorConstruction         = tuple1.Item2;
            IIndex <f>         index = tuple1.Item1;
            Tuple <Tuple <long, long>, RangeRestriction <long> > tuple2 = offset <= 0 ? new Tuple <Tuple <long, long>, RangeRestriction <long> >(new Tuple <long, long>(0L, index.KeyCount - 1L + (long)offset), RangeRestriction <long> .NewFixed((long)-offset, index.KeyCount - 1L)) : new Tuple <Tuple <long, long>, RangeRestriction <long> >(new Tuple <long, long>((long)offset, index.KeyCount - 1L), RangeRestriction <long> .NewFixed(0L, index.KeyCount - 1L - (long)offset));
            RangeRestriction <long> rangeRestriction = tuple2.Item2;
            long startAddress = tuple2.Item1.Item1;
            long endAddress   = tuple2.Item1.Item2;

            if (startAddress > endAddress)
            {
                ReadOnlyCollection <f> keys = ReadOnlyCollection.empty <f>();
                if (LinearIndexBuilder.init < 5)
                {
                    LanguagePrimitives.IntrinsicFunctions.FailStaticInit();
                }
                LinearIndexBuilder  indexBuilder = LinearIndexBuilder.indexBuilder;
                FSharpOption <bool> ordered      = FSharpOption <bool> .Some(true);

                return(new Tuple <IIndex <f>, VectorConstruction>((IIndex <f>) new LinearIndex <f>(keys, (IIndexBuilder)indexBuilder, ordered), VectorConstruction.NewEmpty(0L)));
            }
            FSharpOption <bool> fsharpOption = !index.IsOrdered ? (FSharpOption <bool>)null : FSharpOption <bool> .Some(true);

            return(new Tuple <IIndex <f>, VectorConstruction>(!LanguagePrimitives.HashCompare.GenericEqualityIntrinsic <Addressing.IAddressingScheme>((M0)index.AddressingScheme, (M0)Addressing.LinearAddressingScheme.Instance) ? (IIndex <f>) new LinearIndex <f>(ReadOnlyCollectionExtensions.ReadOnlyCollection ` 1GetSlice < f > (index.Keys, FSharpOption <int> .Some((int)startAddress), FSharpOption <int> .Some((int)endAddress)), LinearIndexBuilder.Instance, FSharpOption <bool> .Some(index.IsOrdered)) : (IIndex <f>) new LinearRangeIndex <f>(index, startAddress, endAddress), VectorConstruction.NewGetRange(vectorConstruction, rangeRestriction)));
        }
Esempio n. 3
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)));
        }
Esempio n. 4
0
        Tuple <IIndex <K>, VectorConstruction, VectorConstruction> IIndexBuilder.Intersect <K>(Tuple <IIndex <K>, VectorConstruction> _arg6, Tuple <IIndex <K>, VectorConstruction> _arg7)
        {
            Tuple <IIndex <K>, VectorConstruction> tuple1 = _arg6;
            VectorConstruction vectorConstruction1        = tuple1.Item2;
            IIndex <K>         index1 = tuple1.Item1;
            Tuple <IIndex <K>, VectorConstruction> tuple2 = _arg7;
            VectorConstruction vectorConstruction2        = tuple2.Item2;
            IIndex <K>         index2 = tuple2.Item1;
            Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple3;

            if ((!index1.IsOrdered ? 0 : (index2.IsOrdered ? 1 : 0)) != 0)
            {
                Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple4;
                try
                {
                    tuple4 = new Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> >(Seq.alignOrdered <K>(index1.Keys, index2.Keys, (IComparer <K>)index1.Comparer, true), FSharpOption <bool> .Some(true));
                }
                catch (object ex)
                {
                    if ((Exception)ex is ComparisonFailedException)
                    {
                        tuple4 = new Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> >(Seq.alignUnordered <K>(index1.Keys, index2.Keys, true), (FSharpOption <bool>)null);
                    }
                    else
                    {
                        throw;
                    }
                }
                tuple3 = tuple4;
            }
            else
            {
                tuple3 = new Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> >(Seq.alignUnordered <K>(index1.Keys, index2.Keys, true), FSharpOption <bool> .Some(false));
            }
            Tuple <Tuple <K[], FSharpList <Tuple <long, long>[]> >, FSharpOption <bool> > tuple5 = tuple3;
            FSharpOption <bool> fsharpOption = tuple5.Item2;
            Tuple <K[], FSharpList <Tuple <long, long>[]> > tuple6 = tuple5.Item1;
            LinearIndexBuilder linearIndexBuilder = this;
            Tuple <K[], FSharpList <Tuple <long, long>[]> > tuple7 = tuple6;
            VectorConstruction  v1      = vectorConstruction1;
            VectorConstruction  v2      = vectorConstruction2;
            FSharpOption <bool> ordered = fsharpOption;

            K[] spec_0 = tuple7.Item1;
            FSharpList <Tuple <long, long>[]> spec_1 = tuple7.Item2;

            return(linearIndexBuilder.makeTwoSeriesConstructions <K>(spec_0, spec_1, v1, v2, ordered));
        }
Esempio n. 5
0
        public LinearIndexBuilder(IVectorBuilder vectorBuilder)
        {
            LinearIndexBuilder linearIndexBuilder = this;

            this.vectorBuilder = vectorBuilder;
        }