Exemple #1
0
        internal void AddIndex(ndarray arr, string s, int index)
        {
            index -= num_newindexes;
            if (arr != null)
            {
                Slice Slice = ParseIndexString(arr, index, s, false);
                if (Slice != null)
                {
                    AddIndex(Slice);
                    return;
                }

                CSharpTuple CSharpTuple = ParseCSharpTupleString(arr, index, s, false);
                if (CSharpTuple != null)
                {
                    AddCSharpTuple(CSharpTuple);
                    return;
                }
            }
            // Write the type
            indexes[num_indexes].type = NpyIndexType.NPY_INDEX_STRING;

            // Write the data
            indexes[num_indexes]._string = s;

            // Save the string
            if (strings == null)
            {
                strings = new List <string>();
            }
            strings.Add(s);

            ++num_indexes;
        }
Exemple #2
0
        internal void AddCSharpTuple(CSharpTuple CSTuple)
        {
            IsAdvancedIndexing        = true;
            indexes[num_indexes].type = NpyIndexType.NPY_INDEX_SLICE;

            NpyIndexSlice IndexSlice = new NpyIndexSlice()
            {
                start = (npy_intp)CSTuple.index1,
                stop  = CSTuple.index2 != null ? (npy_intp)CSTuple.index2 + 1 : (npy_intp)CSTuple.index1 + 1,
                step  = CSTuple.index3 != null ? (npy_intp)CSTuple.index3 : 1,
            };

            indexes[num_indexes].slice = IndexSlice;

            ++num_indexes;
        }