@@ -55,7 +55,7 @@ convert(J jt, array w, void *yv, Transform t) -> bool {
55
55
56
56
template <>
57
57
[[nodiscard]] auto
58
- convert<D, bool >(J jt, A w, void *yv, D fuzz) -> bool {
58
+ convert<D, bool >(J jt, array w, void *yv, D fuzz) -> bool {
59
59
auto n = AN (w);
60
60
auto v = pointer_to_values<double >(w);
61
61
auto x = (B *)yv;
@@ -70,7 +70,7 @@ convert<D, bool>(J jt, A w, void *yv, D fuzz) -> bool {
70
70
71
71
template <>
72
72
[[nodiscard]] auto
73
- convert<D, I>(J jt, A w, void *yv, D fuzz) -> bool {
73
+ convert<D, I>(J jt, array w, void *yv, D fuzz) -> bool {
74
74
auto n = AN (w);
75
75
auto v = pointer_to_values<double >(w);
76
76
auto x = (I *)yv;
@@ -95,7 +95,7 @@ convert<D, I>(J jt, A w, void *yv, D fuzz) -> bool {
95
95
96
96
template <>
97
97
[[nodiscard]] auto
98
- convert<Z, D>(J jt, A w, void *yv, D fuzz) -> bool {
98
+ convert<Z, D>(J jt, array w, void *yv, D fuzz) -> bool {
99
99
auto const n = AN (w);
100
100
auto const *v = pointer_to_values<Z>(w);
101
101
auto x = (D *)yv;
@@ -116,7 +116,7 @@ convert<Z, D>(J jt, A w, void *yv, D fuzz) -> bool {
116
116
117
117
template <>
118
118
[[nodiscard]] auto
119
- convert<bool , X>(J jt, A w, void *yv) -> bool {
119
+ convert<bool , X>(J jt, array w, void *yv) -> bool {
120
120
return convert<B, X>(jt,
121
121
w,
122
122
yv,
@@ -135,7 +135,7 @@ inplace_negate(T *u, int64_t n) {
135
135
136
136
template <>
137
137
[[nodiscard]] auto
138
- convert<I, X>(J jt, A w, void *yv) -> bool {
138
+ convert<I, X>(J jt, array w, void *yv) -> bool {
139
139
I u[XIDIG];
140
140
auto const convert_one = [&](auto c) {
141
141
auto const b = c == IMIN;
@@ -170,7 +170,7 @@ jtxd1(J jt, D p, I mode) {
170
170
}
171
171
if (p == inf) return jtvci (jt, XPINF);
172
172
if (p == -inf) return jtvci (jt, XNINF);
173
- A t;
173
+ array t;
174
174
GAT0 (t, INT, 30 , 1 );
175
175
auto u = pointer_to_values (t);
176
176
int64_t m = 0 ;
@@ -191,22 +191,22 @@ jtxd1(J jt, D p, I mode) {
191
191
} else if (0 > p) {
192
192
inplace_negate (u, m);
193
193
}
194
- A z = jtxstd (jt, jtvec (jt, INT, m, u));
194
+ array z = jtxstd (jt, jtvec (jt, INT, m, u));
195
195
EPILOG (z);
196
196
}
197
197
198
198
template <>
199
199
[[nodiscard]] auto
200
- convert<D, X>(J jt, A w, void *yv, I mode) -> bool {
200
+ convert<D, X>(J jt, array w, void *yv, I mode) -> bool {
201
201
return convert<D, X>(jt, w, yv, [=](auto v){ return jtxd1 (jt, v, mode); }) && !jt->jerr ;
202
202
}
203
203
204
204
template <>
205
205
[[nodiscard]] auto
206
- convert<X, bool >(J jt, A w, void *yv) -> bool {
206
+ convert<X, bool >(J jt, array w, void *yv) -> bool {
207
207
auto v = pointer_to_values<X>(w);
208
208
auto x = (B *)yv;
209
- DO (AN (w), A q = v[i]; I e = pointer_to_values (q)[0 ]; if ((AN (q) ^ 1 ) | (e & -2 )) return 0 ; x[i] = (B)e;);
209
+ DO (AN (w), array q = v[i]; I e = pointer_to_values (q)[0 ]; if ((AN (q) ^ 1 ) | (e & -2 )) return 0 ; x[i] = (B)e;);
210
210
return 1 ;
211
211
}
212
212
@@ -220,7 +220,7 @@ value_from_X(X p) -> T {
220
220
221
221
template <>
222
222
[[nodiscard]] auto
223
- convert<X, I>(J jt, A w, void *yv) -> bool {
223
+ convert<X, I>(J jt, array w, void *yv) -> bool {
224
224
auto v = pointer_to_values<X>(w);
225
225
auto x = (I *)yv;
226
226
auto n = AN (w);
@@ -237,7 +237,7 @@ convert<X, I>(J jt, A w, void *yv) -> bool {
237
237
238
238
template <>
239
239
[[nodiscard]] auto
240
- convert<X, D>(J jt, A w, void *yv) -> bool {
240
+ convert<X, D>(J jt, array w, void *yv) -> bool {
241
241
return convert<X, D>(jt, w, yv, [](auto p) {
242
242
auto const c = pointer_to_values (p)[AN (p) - 1 ];
243
243
if (c == XPINF) return inf;
@@ -248,13 +248,13 @@ convert<X, D>(J jt, A w, void *yv) -> bool {
248
248
249
249
template <>
250
250
[[nodiscard]] auto
251
- convert<X, Q>(J jt, A w, void *yv) -> bool {
251
+ convert<X, Q>(J jt, array w, void *yv) -> bool {
252
252
return convert<X, Q>(jt, w, yv, [](auto v) -> Q { return {v, iv1}; });
253
253
}
254
254
255
255
template <>
256
256
[[nodiscard]] auto
257
- convert<D, Q>(J jt, A w, void *yv, I mode) -> bool {
257
+ convert<D, Q>(J jt, array w, void *yv, I mode) -> bool {
258
258
if (!(w)) return 0 ;
259
259
auto const n = AN (w);
260
260
auto const wv = pointer_to_values<double >(w);
@@ -302,7 +302,7 @@ convert<D, Q>(J jt, A w, void *yv, I mode) -> bool {
302
302
303
303
template <>
304
304
[[nodiscard]] auto
305
- convert<Q, D>(J jt, A w, void *yv) -> bool {
305
+ convert<Q, D>(J jt, array w, void *yv) -> bool {
306
306
auto const xb = (D)XBASE;
307
307
auto const wn = AN (w);
308
308
auto const wv = pointer_to_values<Q>(w);
@@ -352,7 +352,7 @@ convert<Q, D>(J jt, A w, void *yv) -> bool {
352
352
353
353
template <>
354
354
[[nodiscard]] auto
355
- convert<Q, X>(J jt, A w, void *yv) -> bool {
355
+ convert<Q, X>(J jt, array w, void *yv) -> bool {
356
356
auto v = pointer_to_values<Q>(w);
357
357
auto x = (X *)yv;
358
358
DQ (AN (w), if (!(jtequ (jt, iv1, v->d ))) return 0 ; *x++ = v->n ; ++v;);
@@ -368,17 +368,17 @@ set_real_part(Z *z, int64_t n, T *t) {
368
368
// Imaginary parts have already been cleared
369
369
template <>
370
370
[[nodiscard]] auto
371
- convert<D, Z>(J jt, A w, void *yv) -> bool {
371
+ convert<D, Z>(J jt, array w, void *yv) -> bool {
372
372
set_real_part (static_cast <Z*>(yv), AN (w), pointer_to_values<double >(w));
373
373
return 1 ;
374
374
}
375
375
376
- // Convert the data in w to the type t. w and t must be noun types. A new buffer is always created (with a
376
+ // Convert the data in w to the type t. w and t must be noun types. array new buffer is always created (with a
377
377
// copy of the data if w is already of the right type), and returned in *y. Result is
378
378
// 0 if error, 1 if success. If the conversion loses precision, error is returned
379
379
// Calls through bcvt are tagged with a flag in jt, indicating to set fuzz=0
380
380
B
381
- jtccvt (J jt, I tflagged, A w, A *y) {
381
+ jtccvt (J jt, I tflagged, array w, array *y) {
382
382
FPREFIP;
383
383
I const t = tflagged & NOUN;
384
384
if (!w) return 0 ;
@@ -423,7 +423,7 @@ jtccvt(J jt, I tflagged, A w, A *y) {
423
423
// modified: the caller must restore AN(w) and AK(w) if it needs it
424
424
// TODO: same-length conversion could be done in place
425
425
auto n = AN (w);
426
- A d;
426
+ array d;
427
427
GA (d, t, n, r, s);
428
428
auto yv = pointer_to_values<void >(d); // allocate the same # atoms, even if we will convert fewer
429
429
if (tflagged & NOUNCVTVALIDCT) {
@@ -530,9 +530,9 @@ jtccvt(J jt, I tflagged, A w, A *y) {
530
530
}
531
531
532
532
// clear rank before calling ccvt - needed for sparse arrays only but returns the block as the result
533
- A
534
- jtcvt (J jt, I t, A w) {
535
- A y;
533
+ auto
534
+ jtcvt (J jt, I t, array w) -> array {
535
+ array y;
536
536
bool const b = jtccvt (jt, t, w, &y);
537
537
ASSERT (b, EVDOMAIN);
538
538
return y;
@@ -542,8 +542,8 @@ jtcvt(J jt, I t, A w) {
542
542
// and use 'exact' and 'no rank' for them. If mode=0, do not promote XNUM/RAT to fixed-length types.
543
543
// If mode bit 1 is set, minimum precision is INT; if mode bit 2 is set, minimum precision is FL; if mode bit 3 is set,
544
544
// minimum precision is CMPX Result is a new buffer, always
545
- A
546
- jtbcvt (J jt, C mode, A w) {
545
+ auto
546
+ jtbcvt (J jt, C mode, array w) -> array {
547
547
FPREFIP;
548
548
if (!w) return 0 ;
549
549
@@ -556,7 +556,7 @@ jtbcvt(J jt, C mode, A w) {
556
556
// to integer. If none of the imaginary parts were flags, we leave the input unchanged. If some were flags, we
557
557
// convert the flagged values to float and keep the result as complex
558
558
array result = w;
559
- if ((((AN (w) - 1 ) | (AT (w) & CMPX) - 1 )) >= 0 ) { // not empty AND complex
559
+ if ((((AN (w) - 1 ) | (( AT (w) & CMPX) - 1 ) )) >= 0 ) { // not empty AND complex
560
560
Z *wv = pointer_to_values<Z>(w);
561
561
auto flags = std::transform_reduce (wv, wv + AN (w), int64_t {}, std::plus{}, isflag);
562
562
if (flags) {
@@ -589,11 +589,11 @@ jtbcvt(J jt, C mode, A w) {
589
589
RNE (result);
590
590
} /* convert to lowest type. 0=mode: don't convert XNUM/RAT to other types */
591
591
592
- A
593
- jticvt (J jt, A w) {
592
+ auto
593
+ jticvt (J jt, array w) -> array {
594
594
auto const n = AN (w);
595
595
auto const * v = pointer_to_values<double >(w);
596
- A z;
596
+ array z;
597
597
GATV (z, INT, n, AR (w), AS (w));
598
598
auto u = pointer_to_values (z);
599
599
for (int64_t i = 0 ; i < n; ++i) {
@@ -604,18 +604,18 @@ jticvt(J jt, A w) {
604
604
return z;
605
605
}
606
606
607
- A
608
- jtpcvt (J jt, I t, A w) {
607
+ auto
608
+ jtpcvt (J jt, I t, array w) -> array {
609
609
RANK2T oqr = jt->ranks ;
610
610
RESETRANK;
611
- A y;
611
+ array y;
612
612
bool const b = jtccvt (jt, t, w, &y);
613
613
jt->ranks = oqr;
614
614
return b ? y : w;
615
615
} /* convert w to type t, if possible, otherwise just return w */
616
616
617
- A
618
- jtcvt0 (J jt, A w) {
617
+ auto
618
+ jtcvt0 (J jt, array w) -> array {
619
619
auto const t = AT (w);
620
620
auto const n = (t & CMPX) ? 2 * AN (w) : AN (w);
621
621
if (n && t & FL + CMPX) {
@@ -625,14 +625,14 @@ jtcvt0(J jt, A w) {
625
625
return w;
626
626
} /* convert -0 to 0 in place */
627
627
628
- A
629
- jtxco1 (J jt, A w) {
628
+ auto
629
+ jtxco1 (J jt, array w) -> array {
630
630
ASSERT (AT (w) & DENSE, EVNONCE);
631
631
return jtcvt (jt, AT (w) & B01 + INT + XNUM ? XNUM : RAT, w);
632
632
}
633
633
634
- A
635
- jtxco2 (J jt, A a, A w) {
634
+ auto
635
+ jtxco2 (J jt, array a, array w) -> array {
636
636
ASSERT (AT (w) & DENSE, EVNONCE);
637
637
I j;
638
638
RE (j = jti0 (jt, a));
@@ -645,7 +645,7 @@ jtxco2(J jt, A a, A w) {
645
645
{
646
646
auto const n = AN (w);
647
647
auto const r = AR (w);
648
- A z;
648
+ array z;
649
649
GATV (z, XNUM, 2 * n, r + 1 , AS (w));
650
650
AS (z)[r] = 2 ;
651
651
memcpy (pointer_to_values (z), pointer_to_values (w), 2 * n * SZI);
0 commit comments