Exemple #1
0
        static bool _equivalent_subarrays(NpyArray_ArrayDescr sub1, NpyArray_ArrayDescr sub2)
        {
            if (sub1 == sub2)
            {
                return(true);
            }
            if (sub1 == null || sub2 == null)
            {
                return(false);
            }

            if (sub1.shape_num_dims != sub2.shape_num_dims)
            {
                return(false);
            }
            for (int i = 0; i < sub1.shape_num_dims; i++)
            {
                if (sub1.shape_dims[i] != sub2.shape_dims[i])
                {
                    return(false);
                }
            }

            return(NpyArray_EquivTypes(sub1._base, sub2._base));
        }
Exemple #2
0
 internal static void NpyArray_DestroySubarray(NpyArray_ArrayDescr self)
 {
     Npy_DECREF(self._base);
     if (0 < self.shape_num_dims)
     {
         NpyArray_free(self.shape_dims);
     }
     self.shape_dims = null;
     NpyArray_free(self);
 }
Exemple #3
0
        internal static NpyArray_ArrayDescr NpyArray_DupSubarray(NpyArray_ArrayDescr src)
        {
            NpyArray_ArrayDescr dest;

            dest = new NpyArray_ArrayDescr();

            Debug.Assert((0 == src.shape_num_dims && null == src.shape_dims) ||
                         (0 < src.shape_num_dims && null != src.shape_dims));

            dest._base = src._base;
            Npy_INCREF(dest._base);

            dest.shape_num_dims = src.shape_num_dims;
            if (0 < dest.shape_num_dims)
            {
                dest.shape_dims = new npy_intp[dest.shape_num_dims];
                memcpy(dest.shape_dims, src.shape_dims, dest.shape_num_dims * sizeof(npy_intp));
            }
            else
            {
                dest.shape_dims = null;
            }
            return(dest);
        }
Exemple #4
0
 internal static void NpyArray_DestroySubarray(NpyArray_ArrayDescr self)
 {
     numpyinternal.NpyArray_DestroySubarray(self);
 }
Exemple #5
0
 internal static NpyArray_ArrayDescr NpyArray_DupSubarray(NpyArray_ArrayDescr src)
 {
     return(numpyinternal.NpyArray_DupSubarray(src));
 }
Exemple #6
0
 internal static void NpyArray_free(NpyArray_ArrayDescr array)
 {
     return;
 }