Source file owl_ext_types.ml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# 1 "src/owl/ext/owl_ext_types.ml"
open Bigarray
type flt = Flt
type cpx = Cpx
type mat = Mat
type vec = Vec
type arr = Arr
type num = Num
type p32 = P32
type p64 = P64
type dns = Dns
type sps = Sps
type dms = (float, float32_elt, c_layout) Genarray.t
type dmd = (float, float64_elt, c_layout) Genarray.t
type dmc = (Complex.t, complex32_elt, c_layout) Genarray.t
type dmz = (Complex.t, complex64_elt, c_layout) Genarray.t
type das = (float, float32_elt, c_layout) Genarray.t
type dad = (float, float64_elt, c_layout) Genarray.t
type dac = (Complex.t, complex32_elt, c_layout) Genarray.t
type daz = (Complex.t, complex64_elt, c_layout) Genarray.t
type sms = (float, float32_elt) Owl_sparse_matrix_generic.t
type smd = (float, float64_elt) Owl_sparse_matrix_generic.t
type smc = (Complex.t, complex32_elt) Owl_sparse_matrix_generic.t
type smz = (Complex.t, complex64_elt) Owl_sparse_matrix_generic.t
type sas = (float, float32_elt) Owl_sparse_ndarray_generic.t
type sad = (float, float64_elt) Owl_sparse_ndarray_generic.t
type sac = (Complex.t, complex32_elt) Owl_sparse_ndarray_generic.t
type saz = (Complex.t, complex64_elt) Owl_sparse_ndarray_generic.t
type ('a, 'b, 'c, 'd) typ =
| TYP_F : float -> (dns, num, flt, p64) typ
| TYP_C : Complex.t -> (dns, num, cpx, p64) typ
| TYP_DMS : dms -> (dns, mat, flt, p32) typ
| TYP_DMD : dmd -> (dns, mat, flt, p64) typ
| TYP_DMC : dmc -> (dns, mat, cpx, p32) typ
| TYP_DMZ : dmz -> (dns, mat, cpx, p64) typ
| TYP_DAS : das -> (dns, arr, flt, p32) typ
| TYP_DAD : dad -> (dns, arr, flt, p64) typ
| TYP_DAC : dac -> (dns, arr, cpx, p32) typ
| TYP_DAZ : daz -> (dns, arr, cpx, p64) typ
| TYP_SMS : sms -> (sps, mat, flt, p32) typ
| TYP_SMD : smd -> (sps, mat, flt, p64) typ
| TYP_SMC : sms -> (sps, mat, cpx, p32) typ
| TYP_SMZ : smd -> (sps, mat, cpx, p64) typ
| TYP_SAS : sas -> (sps, arr, flt, p32) typ
| TYP_SAD : sad -> (sps, arr, flt, p64) typ
| TYP_SAC : sac -> (sps, arr, cpx, p32) typ
| TYP_SAZ : saz -> (sps, arr, cpx, p64) typ
type ('a, 'b) elt =
| Flt32 : (flt, p32) elt
| Flt64 : (flt, p64) elt
| Cpx32 : (cpx, p32) elt
| Cpx64 : (cpx, p64) elt
type ('a, 'b) box =
| DM : (dns, mat) box
| DA : (dns, mat) box
| SM : (sps, arr) box
| SA : (sps, arr) box
type ext_typ =
| F of float
| C of Complex.t
| DMS of dms
| DMD of dmd
| DMC of dmc
| DMZ of dmz
| DAS of das
| DAD of dad
| DAC of dac
| DAZ of daz
| SMS of sms
| SMD of smd
| SMC of sms
| SMZ of smd
| SAS of sas
| SAD of sad
| SAC of sac
| SAZ of saz
let type_info = function
| F _ -> "(scalar, float)"
| C _ -> "(scalar, complex)"
| DMS _ -> "(dense, matrix, float, 32-bit)"
| DMD _ -> "(dense, matrix, float, 64-bit)"
| DMC _ -> "(dense, matrix, complex, 32-bit)"
| DMZ _ -> "(dense, matrix, complex, 64-bit)"
| DAS _ -> "(dense, ndarray, float, 32-bit)"
| DAD _ -> "(dense, ndarray, float, 64-bit)"
| DAC _ -> "(dense, ndarray, complex, 32-bit)"
| DAZ _ -> "(dense, ndarray, complex, 64-bit)"
| SMS _ -> "(sparse, matrix, float, 32-bit)"
| SMD _ -> "(sparse, matrix, float, 64-bit)"
| SMC _ -> "(sparse, matrix, complex, 32-bit)"
| SMZ _ -> "(sparse, matrix, complex, 64-bit)"
| SAS _ -> "(sparse, ndarray, float, 32-bit)"
| SAD _ -> "(sparse, ndarray, float, 64-bit)"
| SAC _ -> "(sparse, ndarray, complex, 32-bit)"
| SAZ _ -> "(sparse, ndarray, complex, 64-bit)"
let pack_flt x = F x
let unpack_flt = function F x -> x | _ -> failwith "unpack_flt: unknown type."
let pack_cpx x = C x
let unpack_cpx = function C x -> x | _ -> failwith "unpack_cpx: unknown type."
let pack_das x = DAS x
let unpack_das = function DAS x -> x | _ -> failwith "unpack_das: unknown type."
let pack_dad x = DAD x
let unpack_dad = function DAD x -> x | _ -> failwith "unpack_dad: unknown type."
let pack_dac x = DAC x
let unpack_dac = function DAC x -> x | _ -> failwith "unpack_dac: unknown type."
let pack_daz x = DAZ x
let unpack_daz = function DAZ x -> x | _ -> failwith "unpack_daz: unknown type."
let pack_dms x = DMS x
let unpack_dms = function DMS x -> x | _ -> failwith "unpack_dms: unknown type."
let pack_dmd x = DMD x
let unpack_dmd = function DMD x -> x | _ -> failwith "unpack_dmd: unknown type."
let pack_dmc x = DMC x
let unpack_dmc = function DMC x -> x | _ -> failwith "unpack_dmc: unknown type."
let pack_dmz x = DMZ x
let unpack_dmz = function DMZ x -> x | _ -> failwith "unpack_dmz: unknown type."