Exemplo n.º 1
0
        private static SparseArray <Range> SaveToArray(List <Pair <int, Range> > tempRange)
        {
            var found  = tempRange.Count;
            var place  = new int[found];
            var ranges = new Range[found];

            for (int i = 0; i < found; i++)
            {
                var pair = tempRange[i];
                place[i]  = pair.First;
                ranges[i] = pair.Second;
            }
            for (int i = 0; i < found; i++)
            {
                for (int j = i + 1; j < found; j++)
                {
                    if (place[i] == place[j])
                    {
                        throw new ArgumentException("There were multiple ranges with the index " + place[i] + "!");
                    }
                }
            }
            return(SparseArray <Range> .CreateSparseArray(place, ranges));
        }
Exemplo n.º 2
0
 public ODMatrixWriter(SparseArray <T> reference, int types, int times)
     : base(reference, types, times)
 {
 }
Exemplo n.º 3
0
        public SparseArray <K> CreateSimilarArray <K>()
        {
            SparseArray <K> ret = new SparseArray <K>(this.Indexing);

            return(ret);
        }
Exemplo n.º 4
0
        public static SparseTwinIndex <T> CreateSimilarArray <TFirst, TSecond>(SparseArray <TFirst> first, SparseArray <TSecond> second)
        {
            var indexes = new SparseIndexing();

            indexes.Indexes = (SparseSet[])first.Indexing.Indexes.Clone();
            var length = indexes.Indexes.Length;

            for (var i = 0; i < length; i++)
            {
                indexes.Indexes[i].SubIndex = new SparseIndexing()
                {
                    Indexes = second.Indexing.Indexes.Clone() as SparseSet[]
                };
            }
            return(new SparseTwinIndex <T>(indexes));
        }
Exemplo n.º 5
0
        public static SparseTriIndex <T> CreateSimilarArray <TFirst, TSecond, TThird>(SparseArray <TFirst> first, SparseArray <TSecond> second, SparseArray <TThird> third)
        {
            var indexes = new SparseIndexing();

            indexes.Indexes = (SparseSet[])first.Indexing.Indexes.Clone();
            var length = indexes.Indexes.Length;

            for (var i = 0; i < length; i++)
            {
                SparseSet[] subIndexes;
                indexes.Indexes[i].SubIndex = new SparseIndexing()
                {
                    Indexes = (subIndexes = (SparseSet[])second.Indexing.Indexes.Clone())
                };
                var subindexLength = indexes.Indexes[i].SubIndex.Indexes.Length;
                for (var j = 0; j < subindexLength; j++)
                {
                    subIndexes[j].SubIndex.Indexes = third.Indexing.Indexes.Clone() as SparseSet[];
                }
            }
            return(new SparseTriIndex <T>(indexes));
        }
Exemplo n.º 6
0
        public static SparseTriIndex <T> CreateSimilarArray <J, K, L>(SparseArray <J> first, SparseArray <K> second, SparseArray <L> third)
        {
            SparseIndexing indexes = new SparseIndexing();

            indexes.Indexes = first.Indexing.Indexes.Clone() as SparseSet[];
            var length = indexes.Indexes.Length;

            for (int i = 0; i < length; i++)
            {
                SparseSet[] subIndexes;
                indexes.Indexes[i].SubIndex = new SparseIndexing()
                {
                    Indexes = (subIndexes = second.Indexing.Indexes.Clone() as SparseSet[])
                };
                var subindexLength = indexes.Indexes[i].SubIndex.Indexes.Length;
                for (int j = 0; j < subindexLength; j++)
                {
                    subIndexes[j].SubIndex.Indexes = third.Indexing.Indexes.Clone() as SparseSet[];
                }
            }
            return(new SparseTriIndex <T>(indexes));
        }
Exemplo n.º 7
0
 public ODCCreator2(SparseArray <T> sparseRepresentation, int types, int times)
 {
     Data       = sparseRepresentation.CreateSquareTwinArray <float[]>();
     this.Types = types;
     this.Times = times;
 }
Exemplo n.º 8
0
        public static SparseTwinIndex <T> CreateSimilarArray <J, K>(SparseArray <J> first, SparseArray <K> second)
        {
            SparseIndexing indexes = new SparseIndexing();

            indexes.Indexes = first.Indexing.Indexes.Clone() as SparseSet[];
            var length = indexes.Indexes.Length;

            for (int i = 0; i < length; i++)
            {
                indexes.Indexes[i].SubIndex = new SparseIndexing()
                {
                    Indexes = second.Indexing.Indexes.Clone() as SparseSet[]
                };
            }
            return(new SparseTwinIndex <T>(indexes));
        }
Exemplo n.º 9
0
        public SparseArray <TKey> CreateSimilarArray <TKey>()
        {
            var ret = new SparseArray <TKey>(Indexing);

            return(ret);
        }