-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathphp_rindow_openblas.h
80 lines (66 loc) · 3.12 KB
/
php_rindow_openblas.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* rindow_openblas extension for PHP */
#ifndef PHP_RINDOW_OPENBLAS_H
# define PHP_RINDOW_OPENBLAS_H
# define phpext_rindow_openblas_ptr &rindow_openblas_module_entry
# define PHP_RINDOW_OPENBLAS_VERSION "0.4.1"
# if defined(ZTS) && defined(COMPILE_DL_RINDOW_OPENBLAS)
ZEND_TSRMLS_CACHE_EXTERN()
# endif
// Rindow\OpenBLAS\Blas object structures
typedef struct {
zend_object std;
} php_rindow_openblas_blas_t;
static inline php_rindow_openblas_blas_t* php_rindow_openblas_blas_fetch_object(zend_object* obj)
{
return (php_rindow_openblas_blas_t*) ((char*) obj - XtOffsetOf(php_rindow_openblas_blas_t, std));
}
#define Z_RINDOW_OPENBLAS_BLAS_OBJ_P(zv) (php_rindow_openblas_blas_fetch_object(Z_OBJ_P(zv)))
// Rindow\OpenBLAS\Lapack object structures
typedef struct {
zend_object std;
} php_rindow_openblas_lapack_t;
static inline php_rindow_openblas_lapack_t* php_rindow_openblas_lapack_fetch_object(zend_object* obj)
{
return (php_rindow_openblas_lapack_t*) ((char*) obj - XtOffsetOf(php_rindow_openblas_lapack_t, std));
}
#define Z_RINDOW_OPENBLAS_LAPACK_OBJ_P(zv) (php_rindow_openblas_lapack_fetch_object(Z_OBJ_P(zv)))
// Rindow\OpenBLAS\Math object structures
typedef struct {
zend_object std;
} php_rindow_openblas_math_t;
static inline php_rindow_openblas_math_t* php_rindow_openblas_math_fetch_object(zend_object* obj)
{
return (php_rindow_openblas_math_t*) ((char*) obj - XtOffsetOf(php_rindow_openblas_math_t, std));
}
#define Z_RINDOW_OPENBLAS_MATH_OBJ_P(zv) (php_rindow_openblas_math_fetch_object(Z_OBJ_P(zv)))
static inline void *php_rindow_openblas_get_address(
php_interop_polite_math_matrix_linear_buffer_t* buffer,zend_long offset,int valueSize)
{
return (uint8_t *)(buffer->data)+(offset*valueSize);
}
extern int php_rindow_openblas_common_dtype_to_valuesize(zend_long dtype);
extern int php_rindow_openblas_common_dtype_is_int(zend_long dtype);
extern int php_rindow_openblas_common_dtype_is_float(zend_long dtype);
extern int php_rindow_openblas_common_dtype_is_bool(zend_long dtype);
extern void php_rindow_openblas_buffer_init_ce(INIT_FUNC_ARGS);
extern void php_rindow_openblas_blas_init_ce(INIT_FUNC_ARGS);
extern void php_rindow_openblas_lapack_init_ce(INIT_FUNC_ARGS);
extern void php_rindow_openblas_math_init_ce(INIT_FUNC_ARGS);
extern zend_class_entry* php_rindow_openblas_buffer_ce;
extern zend_module_entry rindow_openblas_module_entry;
extern int php_rindow_openblas_assert_shape_parameter(
char* name, zend_long n);
extern int php_rindow_openblas_assert_vector_buffer_spec(
char* name,php_interop_polite_math_matrix_linear_buffer_t *buffer,
zend_long n, zend_long offset, zend_long inc);
extern int php_rindow_openblas_assert_matrix_buffer_spec(
char *name,php_interop_polite_math_matrix_linear_buffer_t *buffer,
zend_long m, zend_long n, zend_long offset, zend_long ld);
extern int php_rindow_openblas_assert_buffer_size(
php_interop_polite_math_matrix_linear_buffer_t *buffer,
zend_long offset,zend_long size,
char* message);
extern int php_rindow_openblas_assert_buffer_type(
php_interop_polite_math_matrix_linear_buffer_t *buffer,
char* name);
#endif /* PHP_RINDOW_OPENBLAS_H */