|
42 | 42 | struct ndarray * stdlib_ndarray_allocate( enum STDLIB_NDARRAY_DTYPE dtype, uint8_t *data, int64_t ndims, int64_t *shape, int64_t *strides, int64_t offset, enum STDLIB_NDARRAY_ORDER order, enum STDLIB_NDARRAY_INDEX_MODE imode, int64_t nsubmodes, enum STDLIB_NDARRAY_INDEX_MODE *submodes );
|
43 | 43 |
|
44 | 44 | /**
|
45 |
| -* Frees an ndarray's allocated memory. |
| 45 | +* Returns the size of an ndarray (in bytes). |
46 | 46 | */
|
47 |
| -void stdlib_ndarray_free( struct ndarray *arr ); |
| 47 | +int64_t stdlib_ndarray_bytelength( const struct ndarray *arr ); |
48 | 48 |
|
49 | 49 | /**
|
50 | 50 | * Returns a pointer to an ndarray's underlying byte array.
|
51 | 51 | */
|
52 | 52 | uint8_t * stdlib_ndarray_data( const struct ndarray *arr );
|
53 | 53 |
|
54 | 54 | /**
|
55 |
| -* Returns the number of ndarray dimensions. |
| 55 | +* Returns an ndarray dimension. |
56 | 56 | */
|
57 |
| -int64_t stdlib_ndarray_ndims( const struct ndarray *arr ); |
| 57 | +int64_t stdlib_ndarray_dimension( const struct ndarray *arr, const int64_t i ); |
58 | 58 |
|
59 | 59 | /**
|
60 |
| -* Returns a pointer to an array containing an ndarray shape (dimensions). |
| 60 | +* Disables specified ndarray flags. |
61 | 61 | */
|
62 |
| -int64_t * stdlib_ndarray_shape( const struct ndarray *arr ); |
| 62 | +int8_t stdlib_ndarray_disable_flags( struct ndarray *arr, const int64_t flags ); |
63 | 63 |
|
64 | 64 | /**
|
65 |
| -* Returns an ndarray dimension. |
| 65 | +* Returns an ndarray data type. |
66 | 66 | */
|
67 |
| -int64_t stdlib_ndarray_dimension( const struct ndarray *arr, const int64_t i ); |
| 67 | +enum STDLIB_NDARRAY_DTYPE stdlib_ndarray_dtype( const struct ndarray *arr ); |
68 | 68 |
|
69 | 69 | /**
|
70 |
| -* Returns a pointer to an array containing ndarray strides (in bytes). |
| 70 | +* Enables specified ndarray flags. |
71 | 71 | */
|
72 |
| -int64_t * stdlib_ndarray_strides( const struct ndarray *arr ); |
| 72 | +int8_t stdlib_ndarray_enable_flags( struct ndarray *arr, const int64_t flags ); |
73 | 73 |
|
74 | 74 | /**
|
75 |
| -* Returns an ndarray stride (in bytes). |
| 75 | +* Returns ndarray flags. |
76 | 76 | */
|
77 |
| -int64_t stdlib_ndarray_stride( const struct ndarray *arr, const int64_t i ); |
| 77 | +int64_t stdlib_ndarray_flags( const struct ndarray *arr ); |
78 | 78 |
|
79 | 79 | /**
|
80 |
| -* Returns an ndarray index offset (in bytes). |
| 80 | +* Frees an ndarray's allocated memory. |
81 | 81 | */
|
82 |
| -int64_t stdlib_ndarray_offset( const struct ndarray *arr ); |
| 82 | +void stdlib_ndarray_free( struct ndarray *arr ); |
83 | 83 |
|
84 | 84 | /**
|
85 |
| -* Returns the order of an ndarray. |
| 85 | +* Tests whether an ndarray has specified flags enabled. |
86 | 86 | */
|
87 |
| -enum STDLIB_NDARRAY_ORDER stdlib_ndarray_order( const struct ndarray *arr ); |
| 87 | +int8_t stdlib_ndarray_has_flags( const struct ndarray *arr, const int64_t flags ); |
88 | 88 |
|
89 | 89 | /**
|
90 |
| -* Returns an ndarray data type. |
| 90 | +* Returns the index mode of an ndarray. |
91 | 91 | */
|
92 |
| -enum STDLIB_NDARRAY_DTYPE stdlib_ndarray_dtype( const struct ndarray *arr ); |
| 92 | +enum STDLIB_NDARRAY_INDEX_MODE stdlib_ndarray_index_mode( const struct ndarray *arr ); |
93 | 93 |
|
94 | 94 | /**
|
95 |
| -* Returns the index mode of an ndarray. |
| 95 | +* Returns the number of elements in an ndarray. |
96 | 96 | */
|
97 |
| -enum STDLIB_NDARRAY_INDEX_MODE stdlib_ndarray_index_mode( const struct ndarray *arr ); |
| 97 | +int64_t stdlib_ndarray_length( const struct ndarray *arr ); |
98 | 98 |
|
99 | 99 | /**
|
100 |
| -* Returns the number of ndarray subscript modes. |
| 100 | +* Returns the number of ndarray dimensions. |
101 | 101 | */
|
102 |
| -int64_t stdlib_ndarray_nsubmodes( const struct ndarray *arr ); |
| 102 | +int64_t stdlib_ndarray_ndims( const struct ndarray *arr ); |
103 | 103 |
|
104 | 104 | /**
|
105 |
| -* Returns ndarray subscript modes. |
| 105 | +* Returns an ndarray index offset (in bytes). |
106 | 106 | */
|
107 |
| -enum STDLIB_NDARRAY_INDEX_MODE * stdlib_ndarray_submodes( const struct ndarray *arr ); |
| 107 | +int64_t stdlib_ndarray_offset( const struct ndarray *arr ); |
108 | 108 |
|
109 | 109 | /**
|
110 |
| -* Returns an ndarray subscript mode. |
| 110 | +* Returns the order of an ndarray. |
111 | 111 | */
|
112 |
| -enum STDLIB_NDARRAY_INDEX_MODE stdlib_ndarray_submode( const struct ndarray *arr, const int64_t i ); |
| 112 | +enum STDLIB_NDARRAY_ORDER stdlib_ndarray_order( const struct ndarray *arr ); |
113 | 113 |
|
114 | 114 | /**
|
115 |
| -* Returns the number of elements in an ndarray. |
| 115 | +* Returns the number of ndarray subscript modes. |
116 | 116 | */
|
117 |
| -int64_t stdlib_ndarray_length( const struct ndarray *arr ); |
| 117 | +int64_t stdlib_ndarray_nsubmodes( const struct ndarray *arr ); |
118 | 118 |
|
119 | 119 | /**
|
120 |
| -* Returns the size of an ndarray (in bytes). |
| 120 | +* Returns a pointer to an array containing an ndarray shape (dimensions). |
121 | 121 | */
|
122 |
| -int64_t stdlib_ndarray_bytelength( const struct ndarray *arr ); |
| 122 | +int64_t * stdlib_ndarray_shape( const struct ndarray *arr ); |
123 | 123 |
|
124 | 124 | /**
|
125 |
| -* Returns ndarray flags. |
| 125 | +* Returns an ndarray stride (in bytes). |
126 | 126 | */
|
127 |
| -int64_t stdlib_ndarray_flags( const struct ndarray *arr ); |
| 127 | +int64_t stdlib_ndarray_stride( const struct ndarray *arr, const int64_t i ); |
128 | 128 |
|
129 | 129 | /**
|
130 |
| -* Tests whether an ndarray has specified flags enabled. |
| 130 | +* Returns a pointer to an array containing ndarray strides (in bytes). |
131 | 131 | */
|
132 |
| -int8_t stdlib_ndarray_has_flags( const struct ndarray *arr, const int64_t flags ); |
| 132 | +int64_t * stdlib_ndarray_strides( const struct ndarray *arr ); |
133 | 133 |
|
134 | 134 | /**
|
135 |
| -* Enables specified ndarray flags. |
| 135 | +* Returns ndarray subscript modes. |
136 | 136 | */
|
137 |
| -int8_t stdlib_ndarray_enable_flags( struct ndarray *arr, const int64_t flags ); |
| 137 | +enum STDLIB_NDARRAY_INDEX_MODE * stdlib_ndarray_submodes( const struct ndarray *arr ); |
138 | 138 |
|
139 | 139 | /**
|
140 |
| -* Disables specified ndarray flags. |
| 140 | +* Returns an ndarray subscript mode. |
141 | 141 | */
|
142 |
| -int8_t stdlib_ndarray_disable_flags( struct ndarray *arr, const int64_t flags ); |
| 142 | +enum STDLIB_NDARRAY_INDEX_MODE stdlib_ndarray_submode( const struct ndarray *arr, const int64_t i ); |
143 | 143 |
|
144 | 144 | #endif // !STDLIB_NDARRAY_CTOR_H
|
0 commit comments