Commit b39a5785 authored by Matti Picus's avatar Matti Picus Committed by GitHub

add test for ndarray attributes (GH-3521)

parent 22a49f40
# mode: run
# tag: numpy
import numpy as np
cimport numpy as cnp
cnp.import_array()
def access_shape():
"""
>>> access_shape()
10
"""
cdef cnp.ndarray[double, ndim=2, mode='c'] array_in = \
1e10 * np.ones((10, 10))
return array_in.shape[0]
def access_size():
"""
>>> access_size()
100
"""
cdef cnp.ndarray[double, ndim=2, mode='c'] array_in = \
1e10 * np.ones((10, 10))
return array_in.size
def access_strides():
"""
>>> access_strides()
(80, 8)
"""
cdef cnp.ndarray[double, ndim=2, mode='c'] array_in = \
1e10 * np.ones((10, 10), dtype=np.float64)
return (array_in.strides[0], array_in.strides[1])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment