forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbigarray.js
319 lines (274 loc) · 8.12 KB
/
bigarray.js
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
// GENERATED CODE BY BUCKLESCRIPT VERSION 0.3 , PLEASE EDIT WITH CARE
'use strict';
var Caml_builtin_exceptions = require("./caml_builtin_exceptions");
var Caml_array = require("./caml_array");
function dims() {
var n = function () {
throw "caml_ba_num_dims not implemented by bucklescript yet\n";
}();
var d = Caml_array.caml_make_vect(n, 0);
for(var i = 0 ,i_finish = n - 1 | 0; i <= i_finish; ++i){
d[i] = function () {
throw "caml_ba_dim not implemented by bucklescript yet\n";
}();
}
return d;
}
function map_file(_, $staropt$star, _$1, _$2, _$3, _$4) {
$staropt$star ? $staropt$star[0] : /* int64 */[
/* hi */0,
/* lo */0
];
return function () {
throw "caml_ba_map_file_bytecode not implemented by bucklescript yet\n";
}();
}
var Genarray = /* module */[
/* dims */dims,
/* map_file */map_file
];
function create(_, _$1, _$2) {
return function () {
throw "caml_ba_create not implemented by bucklescript yet\n";
}();
}
function of_array(kind, layout, data) {
var ba = create(kind, layout, data.length);
layout !== 0 ? 1 : 0;
for(var i = 0 ,i_finish = data.length - 1 | 0; i <= i_finish; ++i){
(function () {
throw "caml_ba_set_1 not implemented by bucklescript yet\n";
}());
}
return ba;
}
function map_file$1(fd, pos, kind, layout, shared, dim) {
return map_file(fd, pos, kind, layout, shared, /* int array */[dim]);
}
var Array1 = /* module */[
/* create */create,
/* of_array */of_array,
/* map_file */map_file$1
];
function create$1(_, _$1, _$2, _$3) {
return function () {
throw "caml_ba_create not implemented by bucklescript yet\n";
}();
}
function slice_left(_, _$1) {
return function () {
throw "caml_ba_slice not implemented by bucklescript yet\n";
}();
}
function slice_right(_, _$1) {
return function () {
throw "caml_ba_slice not implemented by bucklescript yet\n";
}();
}
function of_array$1(kind, layout, data) {
var dim1 = data.length;
var dim2 = dim1 ? data[0].length : 0;
var ba = create$1(kind, layout, dim1, dim2);
layout !== 0 ? 1 : 0;
for(var i = 0 ,i_finish = dim1 - 1 | 0; i <= i_finish; ++i){
var row = data[i];
if (row.length !== dim2) {
throw [
Caml_builtin_exceptions.invalid_argument,
"Bigarray.Array2.of_array: non-rectangular data"
];
}
for(var j = 0 ,j_finish = dim2 - 1 | 0; j <= j_finish; ++j){
(function () {
throw "caml_ba_set_2 not implemented by bucklescript yet\n";
}());
}
}
return ba;
}
function map_file$2(fd, pos, kind, layout, shared, dim1, dim2) {
return map_file(fd, pos, kind, layout, shared, /* int array */[
dim1,
dim2
]);
}
var Array2 = /* module */[
/* create */create$1,
/* slice_left */slice_left,
/* slice_right */slice_right,
/* of_array */of_array$1,
/* map_file */map_file$2
];
function create$2(_, _$1, _$2, _$3, _$4) {
return function () {
throw "caml_ba_create not implemented by bucklescript yet\n";
}();
}
function slice_left_1(_, _$1, _$2) {
return function () {
throw "caml_ba_slice not implemented by bucklescript yet\n";
}();
}
function slice_right_1(_, _$1, _$2) {
return function () {
throw "caml_ba_slice not implemented by bucklescript yet\n";
}();
}
function slice_left_2(_, _$1) {
return function () {
throw "caml_ba_slice not implemented by bucklescript yet\n";
}();
}
function slice_right_2(_, _$1) {
return function () {
throw "caml_ba_slice not implemented by bucklescript yet\n";
}();
}
function of_array$2(kind, layout, data) {
var dim1 = data.length;
var dim2 = dim1 ? data[0].length : 0;
var dim3 = dim2 ? data[0][0].length : 0;
var ba = create$2(kind, layout, dim1, dim2, dim3);
layout !== 0 ? 1 : 0;
for(var i = 0 ,i_finish = dim1 - 1 | 0; i <= i_finish; ++i){
var row = data[i];
if (row.length !== dim2) {
throw [
Caml_builtin_exceptions.invalid_argument,
"Bigarray.Array3.of_array: non-cubic data"
];
}
for(var j = 0 ,j_finish = dim2 - 1 | 0; j <= j_finish; ++j){
var col = row[j];
if (col.length !== dim3) {
throw [
Caml_builtin_exceptions.invalid_argument,
"Bigarray.Array3.of_array: non-cubic data"
];
}
for(var k = 0 ,k_finish = dim3 - 1 | 0; k <= k_finish; ++k){
(function () {
throw "caml_ba_set_3 not implemented by bucklescript yet\n";
}());
}
}
}
return ba;
}
function map_file$3(fd, pos, kind, layout, shared, dim1, dim2, dim3) {
return map_file(fd, pos, kind, layout, shared, /* int array */[
dim1,
dim2,
dim3
]);
}
var Array3 = /* module */[
/* create */create$2,
/* slice_left_1 */slice_left_1,
/* slice_right_1 */slice_right_1,
/* slice_left_2 */slice_left_2,
/* slice_right_2 */slice_right_2,
/* of_array */of_array$2,
/* map_file */map_file$3
];
function array1_of_genarray(a) {
if (function () {
throw "caml_ba_num_dims not implemented by bucklescript yet\n";
}() === 1) {
return a;
}
else {
throw [
Caml_builtin_exceptions.invalid_argument,
"Bigarray.array1_of_genarray"
];
}
}
function array2_of_genarray(a) {
if (function () {
throw "caml_ba_num_dims not implemented by bucklescript yet\n";
}() === 2) {
return a;
}
else {
throw [
Caml_builtin_exceptions.invalid_argument,
"Bigarray.array2_of_genarray"
];
}
}
function array3_of_genarray(a) {
if (function () {
throw "caml_ba_num_dims not implemented by bucklescript yet\n";
}() === 3) {
return a;
}
else {
throw [
Caml_builtin_exceptions.invalid_argument,
"Bigarray.array3_of_genarray"
];
}
}
function reshape_1(_, _$1) {
return function () {
throw "caml_ba_reshape not implemented by bucklescript yet\n";
}();
}
function reshape_2(_, _$1, _$2) {
return function () {
throw "caml_ba_reshape not implemented by bucklescript yet\n";
}();
}
function reshape_3(_, _$1, _$2, _$3) {
return function () {
throw "caml_ba_reshape not implemented by bucklescript yet\n";
}();
}
var float32 = /* Float32 */0;
var float64 = /* Float64 */1;
var complex32 = /* Complex32 */10;
var complex64 = /* Complex64 */11;
var int8_signed = /* Int8_signed */2;
var int8_unsigned = /* Int8_unsigned */3;
var int16_signed = /* Int16_signed */4;
var int16_unsigned = /* Int16_unsigned */5;
var $$int = /* Int */8;
var int32 = /* Int32 */6;
var int64 = /* Int64 */7;
var nativeint = /* Nativeint */9;
var $$char = /* Char */12;
var c_layout = /* C_layout */0;
var fortran_layout = /* Fortran_layout */1;
function reshape(_, _$1) {
return function () {
throw "caml_ba_reshape not implemented by bucklescript yet\n";
}();
}
exports.float32 = float32;
exports.float64 = float64;
exports.complex32 = complex32;
exports.complex64 = complex64;
exports.int8_signed = int8_signed;
exports.int8_unsigned = int8_unsigned;
exports.int16_signed = int16_signed;
exports.int16_unsigned = int16_unsigned;
exports.$$int = $$int;
exports.int32 = int32;
exports.int64 = int64;
exports.nativeint = nativeint;
exports.$$char = $$char;
exports.c_layout = c_layout;
exports.fortran_layout = fortran_layout;
exports.Genarray = Genarray;
exports.Array1 = Array1;
exports.Array2 = Array2;
exports.Array3 = Array3;
exports.array1_of_genarray = array1_of_genarray;
exports.array2_of_genarray = array2_of_genarray;
exports.array3_of_genarray = array3_of_genarray;
exports.reshape = reshape;
exports.reshape_1 = reshape_1;
exports.reshape_2 = reshape_2;
exports.reshape_3 = reshape_3;
/* Not a pure module */