cell-wise PervasiveDy` highRank
This commit is contained in:
parent
66b5c1fc0a
commit
72893fc2f5
@ -37,11 +37,11 @@ B takedrop_highrank(bool take, B w, B x); // from sfns.c
|
||||
|
||||
|
||||
|
||||
// Used by Insert in fold.c
|
||||
B insert_base(B f, B x, bool has_w, B w) {
|
||||
B insert_base(B f, B x, bool has_w, B w) { // Used by Insert in fold.c
|
||||
assert(isArr(x) && RNK(x)>0);
|
||||
usz* xsh = SH(x);
|
||||
usz xn = xsh[0];
|
||||
assert(!has_w || xn>0);
|
||||
S_KSLICES(x, xsh, 1, xn, 0)
|
||||
usz p = xn*x_csz;
|
||||
B r = w;
|
||||
@ -57,6 +57,29 @@ B insert_base(B f, B x, bool has_w, B w) {
|
||||
return r;
|
||||
}
|
||||
|
||||
B scan_arith(B f, B w, B x, usz* xsh) { // Used by scan.c
|
||||
bool has_w = w.u != m_f64(0).u;
|
||||
assert(isArr(x) && (!has_w || isArr(w)));
|
||||
ur xr = RNK(x);
|
||||
usz xn = xsh[0];
|
||||
assert(xr>1 && (!has_w || xn>0));
|
||||
S_KSLICES(x, xsh, 1, xn, 0)
|
||||
usz p = 0;
|
||||
B c = w;
|
||||
M_APD_SH(r, 1, xsh);
|
||||
if (!has_w) {
|
||||
APDD(r, incG(c = SLICE(x, 0)));
|
||||
p+= x_csz;
|
||||
}
|
||||
FC2 fc2 = c2fn(f);
|
||||
for (usz i = !has_w; i < xn; i++) {
|
||||
APDD(r, incG(c = fc2(f, c, SLICE(x, p))));
|
||||
p+= x_csz;
|
||||
}
|
||||
decG(c);
|
||||
return taga(APD_SH_GET(r, 0));
|
||||
}
|
||||
|
||||
|
||||
#if TEST_CELL_FILLS
|
||||
i32 fullCellFills = 2*CATCH_ERRORS;
|
||||
|
||||
@ -375,7 +375,7 @@ B insert_c1(Md1D* d, B x) { B f = d->f;
|
||||
return taga(r);
|
||||
}
|
||||
}
|
||||
return insert_base(f, x, 0, bi_N);
|
||||
return insert_base(f, x, 0, m_f64(0));
|
||||
}
|
||||
B insert_c2(Md1D* d, B w, B x) { B f = d->f;
|
||||
if (isAtm(x) || RNK(x)==0) thrM("˝: 𝕩 must have rank at least 1");
|
||||
|
||||
@ -177,6 +177,7 @@ static B scan_plus(f64 r0, B x, u8 xe, usz ia) {
|
||||
B fne_c1(B, B);
|
||||
B shape_c2(B, B, B);
|
||||
|
||||
extern B scan_arith(B f, B w, B x, usz* xsh); // from cells.c
|
||||
B scan_c1(Md1D* d, B x) { B f = d->f;
|
||||
if (isAtm(x) || RNK(x)==0) thrM("`: Argument cannot have rank 0");
|
||||
ur xr = RNK(x);
|
||||
@ -229,6 +230,7 @@ B scan_c1(Md1D* d, B x) { B f = d->f;
|
||||
if (rtid==n_or) { x=num_squeezeChk(x); xe=TI(x,elType); if (xe==el_bit) return scan_or(x, ia); }
|
||||
}
|
||||
base:;
|
||||
if (xr>1 && ia >= 6 * (u64)*SH(x) && isPervasiveDy(f)) return scan_arith(f, m_f64(0), x, SH(x));
|
||||
SLOW2("𝕎` 𝕩", f, x);
|
||||
B xf = getFillR(x);
|
||||
|
||||
@ -305,6 +307,7 @@ B scan_c2(Md1D* d, B w, B x) { B f = d->f;
|
||||
}
|
||||
}
|
||||
base:;
|
||||
if (xr>1 && ia >= 6 * (u64)*SH(x) && isPervasiveDy(f)) return scan_arith(f, w, x, SH(x));
|
||||
SLOW3("𝕨 F` 𝕩", w, x, f);
|
||||
B wf = getFillR(w);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user