19 #if !defined(AT_CORE_H_INSIDE) 20 #error "Only <at/core.h> can be included directly." 60 #define AT_DECLARE_ARRAY(UPPER,type) \ 61 typedef struct AtArray##UPPER{ \ 64 }AtArray##UPPER; // Total: 40B 75 #undef AT_DECLARE_ARRAY 100 #define at_array_index_to_nd(array, s, s_nd) at_index_to_nd(array->h.dim, array->h.step,s,s_nd) 104 #define at_array_index_to_1d(array, s_nd, s) at_index_to_1d(array->h.dim, array->h.step,s_nd,s) 108 #define at_array_max(array) _Generic((array), \ 109 AtArrayU8*:at_arrayu8_max)(array) 137 #define at_array_destroy(array_ptr) _Generic((array_ptr), \ 138 AtArrayU8**: at_arrayu8_destroy \ 142 #define AT_DECLARE_ARRAY_OP(op) \ 154 #define AT_DECLARE_ARRAY_OP3(op) \ 155 op(u8 ,U8 ,uint8_t ) \ 156 op(u16,U16,uint16_t) \ 157 op(u32,U32,uint32_t) \ 158 op(u64,U64,uint64_t) \ 159 op(i8 ,I8 , int8_t ) \ 160 op(i16,I16, int16_t) \ 161 op(i32,I32, int32_t) \ 162 op(i64,I64, int64_t) \ 167 #define AT_DECLARE_ARRAY_CREATE(lower, UPPER) AtArray##UPPER* at_array##lower##_create(); 168 #define AT_DECLARE_ARRAY_NEW(lower, UPPER) AtArray##UPPER* at_array##lower##_new(uint8_t dim, uint64_t* shape); 169 #define AT_DECLARE_ARRAY_NEW_WITH_DATA(lower, UPPER, type) AtArray##UPPER* at_array##lower##_new_with_data(uint8_t dim, uint64_t* shape, type* data, bool copy); 170 #define AT_DECLARE_ARRAY_ZEROS(lower, UPPER) AtArray##UPPER* at_array##lower##_zeros(uint8_t dim, uint64_t* shape); 171 #define AT_DECLARE_ARRAY_ONES(lower, UPPER) AtArray##UPPER* at_array##lower##_ones(uint8_t dim, uint64_t* shape); 172 #define AT_DECLARE_ARRAY_FILL(lower, UPPER, type) void at_array##lower##_fill(AtArray##UPPER* array, type value); 173 #define AT_DECLARE_ARRAY_ADD_SCALAR(lower, UPPER, type) void at_array##lower##_add_scalar(AtArray##UPPER* array, type value); 174 #define AT_DECLARE_ARRAY_ADD_SCALAR_CLAMPED(lower, UPPER, type) void at_array##lower##_add_scalar_clamped(AtArray##UPPER* array, type value); 175 #define AT_DECLARE_ARRAY_MAX(lower, UPPER, type) type at_array##lower##_max(AtArray##UPPER* array); 176 #define AT_DECLARE_ARRAY_DESTROY(lower, UPPER) void at_array##lower##_destroy(AtArray##UPPER** array); 177 #define AT_DECLARE_ARRAY_GET_1D(lower, UPPER, type) type at_array##lower##_get_1d(AtArray##UPPER* array, uint64_t idx); 178 #define AT_DECLARE_ARRAY_GET_ND(lower, UPPER, type) type at_array##lower##_get_nd(AtArray##UPPER* array, uint64_t* idx); 179 #define AT_DECLARE_ARRAY_SET_1D(lower, UPPER, type) void at_array##lower##_set_1d(AtArray##UPPER* array, uint64_t idx, type value); 180 #define AT_DECLARE_ARRAY_SET_ND(lower, UPPER, type) void at_array##lower##_set_nd(AtArray##UPPER* array, uint64_t* idx, type value); 181 #define AT_DECLARE_ARRAY_SUB(lower, UPPER, type) void at_array##lower##_sub(AtArray##UPPER* array, AtRange* ranges, AtArray##UPPER** outputp, uint8_t copy); 183 AT_DECLARE_ARRAY_OP(AT_DECLARE_ARRAY_CREATE)
184 AT_DECLARE_ARRAY_OP(AT_DECLARE_ARRAY_NEW)
185 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_NEW_WITH_DATA)
186 AT_DECLARE_ARRAY_OP(AT_DECLARE_ARRAY_ZEROS)
187 AT_DECLARE_ARRAY_OP(AT_DECLARE_ARRAY_ONES)
188 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_FILL)
189 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_ADD_SCALAR)
190 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_ADD_SCALAR_CLAMPED)
191 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_MAX)
192 AT_DECLARE_ARRAY_OP(AT_DECLARE_ARRAY_DESTROY)
193 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_GET_1D)
194 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_GET_ND)
195 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_SET_1D)
196 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_SET_ND)
197 AT_DECLARE_ARRAY_OP3(AT_DECLARE_ARRAY_SUB)
199 #undef AT_DECLARE_ARRAY_CREATE 200 #undef AT_DECLARE_ARRAY_NEW 201 #undef AT_DECLARE_ARRAY_NEW_WITH_DATA 202 #undef AT_DECLARE_ARRAY_ZEROS 203 #undef AT_DECLARE_ARRAY_ONES 204 #undef AT_DECLARE_ARRAY_FILL 205 #undef AT_DECLARE_ARRAY_ADD_SCALAR 206 #undef AT_DECLARE_ARRAY_ADD_SCALAR_CLAMPED 207 #undef AT_DECLARE_ARRAY_MAX 208 #undef AT_DECLARE_ARRAY_DESTROY 209 #undef AT_DECLARE_ARRAY_GET_1D 210 #undef AT_DECLARE_ARRAY_GET_ND 211 #undef AT_DECLARE_ARRAY_SET_1D 212 #undef AT_DECLARE_ARRAY_SET_ND 213 #undef AT_DECLARE_ARRAY_SUB 215 #undef AT_DECLARE_ARRAY_OP 216 #undef AT_DECLARE_ARRAY_OP3 218 #define at_arrayu8_squeeze(ar) at_arrayheader_squeeze(&ar->h) 219 #define at_arrayu16_squeeze(ar) at_arrayheader_squeeze(&ar->h) 220 #define at_arrayu32_squeeze(ar) at_arrayheader_squeeze(&ar->h) 221 #define at_arrayu64_squeeze(ar) at_arrayheader_squeeze(&ar->h) 222 #define at_arrayi8_squeeze(ar) at_arrayheader_squeeze(&ar->h) 223 #define at_arrayi16_squeeze(ar) at_arrayheader_squeeze(&ar->h) 224 #define at_arrayi32_squeeze(ar) at_arrayheader_squeeze(&ar->h) 225 #define at_arrayi64_squeeze(ar) at_arrayheader_squeeze(&ar->h) 226 #define at_arrayf32_squeeze(ar) at_arrayheader_squeeze(&ar->h) 227 #define at_arrayd64_squeeze(ar) at_arrayheader_squeeze(&ar->h) 234 #define at_array_save(arrays,names,num,filename) at_arrayu8_save((AtArrayU8**)arrays,names,num,filename); 243 at_arrayu8_save(AtArrayU8** arrays,
char** names, uint8_t num,
const char* filename);
252 at_array_load(
char*** namesp, uint8_t *nump,
const char* filename);
AtArrayU8 * at_array_load(char ***namesp, uint8_t *nump, const char *filename)
at_array_load
void at_array_header_dispose(AtArrayHeader *header)
at_array_header_dispose
void at_index_to_nd(uint8_t dim, uint64_t *step, uint64_t s, uint64_t *s_nd)
at_index_to_nd
void at_arrayheader_squeeze(AtArrayHeader *h)
at_arrayheader_squeeze
void at_array_header_set(AtArrayHeader *header, uint8_t dim, uint64_t *shape)
at_array_header_set
#define AT_DECLARE_ARRAY(UPPER, type)
Vetor Multidimensional.
Definition: array.h:60
void at_array_header_init(AtArrayHeader *header)
at_array_header_init
void at_arrayu8_set_nd_many(AtArrayU8 *ar, uint64_t *coords, uint8_t *value)
at_arrayu8_set_nd_many
void at_arrayu8_save(AtArrayU8 **arrays, char **names, uint8_t num, const char *filename)
at_arrayu8_save
void at_arrayu16_sub_u8(AtArrayU16 *ar, AtRange *ranges, AtArrayU8 **output)
at_arrayu16_sub_u8
void at_index_to_1d(uint8_t dim, uint64_t *step, int64_t *s_nd, uint64_t *s)
at_index_to_1d