-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnumpy_struct.h
More file actions
36 lines (30 loc) · 1.07 KB
/
numpy_struct.h
File metadata and controls
36 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef __NUMPY_STRUCT_H
#include <stdio.h>
typedef struct {
int num_arrays;
long *numpy_array_addresses;
char **numpy_array_names;
char **numpy_array_data_types;
long **numpy_array_shapes;
long *numpy_array_ranks;
} numpy_struct;
void print_numpy_struct(numpy_struct *toPrint) {
printf("Number of arrays is %d\n",toPrint->num_arrays);
for(int i = 0; i < toPrint->num_arrays; i++) {
printf("Rank for item %d is %d\n",(int) i,(int) toPrint->numpy_array_ranks[i]);
printf("Array address is %d\n",(int) toPrint->numpy_array_addresses[i]);
printf("Array data type is %s\n", toPrint->numpy_array_data_types[i]);
printf("Name of array is %s\n",toPrint->numpy_array_names[i]);
for(int j = 0; j < toPrint->numpy_array_ranks[i]; j++) {
printf("Rank for array %d and index %d is %d\n",i,j,(int) toPrint->numpy_array_shapes[i][j]);
}
}
}
typedef struct {
void *native_ops_handle;
void *pipeline_handle;
void *executor_handle;
void *isolate_thread;
void *isolate;
} handles;
#endif