native 𝕨/highrank
This commit is contained in:
parent
96316f0fe1
commit
bb36755d67
@ -33,10 +33,11 @@
|
|||||||
// Replicate by constant
|
// Replicate by constant
|
||||||
// Boolean uses pdep, ≠`, or overwriting
|
// Boolean uses pdep, ≠`, or overwriting
|
||||||
// SHOULD make a shift/mask replacement for pdep
|
// SHOULD make a shift/mask replacement for pdep
|
||||||
// Others use +`, or lots of Singeli
|
// Other typed 𝕩 uses +`, or lots of Singeli
|
||||||
// Fixed shuffles, factorization, partial shuffles, self-overlapping
|
// Fixed shuffles, factorization, partial shuffles, self-overlapping
|
||||||
|
// Otherwise, cell-by-cell copying
|
||||||
// SHOULD do something for odd cell widths in Replicate
|
// SHOULD better handle small odd cell widths
|
||||||
|
// COULD do large copies for large 𝕨
|
||||||
|
|
||||||
// Indices inverse (/⁼), a lot like Group
|
// Indices inverse (/⁼), a lot like Group
|
||||||
// Always gives a squeezed result for integer 𝕩
|
// Always gives a squeezed result for integer 𝕩
|
||||||
@ -664,7 +665,7 @@ B slash_c2(B t, B w, B x) {
|
|||||||
w=any_squeeze(w); we=TI(w,elType);
|
w=any_squeeze(w); we=TI(w,elType);
|
||||||
if (!elInt(we)) {
|
if (!elInt(we)) {
|
||||||
s = usum(w);
|
s = usum(w);
|
||||||
goto slow;
|
goto arrW_base;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (we==el_bit) {
|
if (we==el_bit) {
|
||||||
@ -672,29 +673,31 @@ B slash_c2(B t, B w, B x) {
|
|||||||
r = compress(w, x, wia, xl, xt);
|
r = compress(w, x, wia, xl, xt);
|
||||||
goto decWX_ret;
|
goto decWX_ret;
|
||||||
}
|
}
|
||||||
if (xl>6 || (xl<3 && xl!=0)) goto base;
|
|
||||||
s = usum(w);
|
s = usum(w);
|
||||||
|
if (xl>6 || (xl<3 && xl!=0)) goto arrW_base;
|
||||||
if (s<=wia) {
|
if (s<=wia) {
|
||||||
w=num_squeezeChk(w); we=TI(w,elType);
|
w=num_squeezeChk(w); we=TI(w,elType);
|
||||||
if (we==el_bit) goto wbool;
|
if (we==el_bit) goto wbool;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RARE(TI(x,elType)==el_B)) { // Slow case
|
if (RARE(TI(x,elType)==el_B)) { // Slow case
|
||||||
slow:
|
arrW_base:
|
||||||
if (xr > 1) goto base;
|
|
||||||
SLOW2("𝕨/𝕩", w, x);
|
SLOW2("𝕨/𝕩", w, x);
|
||||||
B xf = getFillQ(x);
|
B xf = getFillQ(x);
|
||||||
MAKE_MUT(r0, s) mut_init(r0, el_B); MUTG_INIT(r0);
|
usz csz = arr_csz(x);
|
||||||
SGetU(w) SGetU(x)
|
MAKE_MUT(r0, s*csz) mut_init(r0, TI(x,elType)); MUTG_INIT(r0);
|
||||||
usz ri = 0;
|
SGetU(w)
|
||||||
for (usz i = 0; i < wia; i++) {
|
if (csz==1) { SGetU(x) usz ri=0; for (ux i=0; i<wia; i++) { usz c=o2s(GetU(w, i)); if (c) { mut_fillG(r0, ri, GetU(x, i), c); ri+= c; } } }
|
||||||
usz c = o2s(GetU(w, i));
|
else { usz ri=0; for (ux i=0; i<wia; i++) { usz c=o2s(GetU(w, i)); for(ux j=0;j<c;j++) { mut_copyG(r0, ri, x, i*csz, csz); ri+= csz; } } }
|
||||||
if (c) {
|
Arr* ra = mut_fp(r0);
|
||||||
mut_fillG(r0, ri, GetU(x, i), c);
|
if (xr == 1) {
|
||||||
ri+= c;
|
arr_shVec(ra);
|
||||||
|
} else {
|
||||||
|
usz* rsh = arr_shAlloc(ra, xr);
|
||||||
|
rsh[0] = s;
|
||||||
|
shcpy(rsh+1, SH(x)+1, xr-1);
|
||||||
}
|
}
|
||||||
}
|
r = withFill(taga(ra), xf);
|
||||||
r = withFill(mut_fv(r0), xf);
|
|
||||||
decWX_ret: decG(w);
|
decWX_ret: decG(w);
|
||||||
decX_ret: decG(x);
|
decX_ret: decG(x);
|
||||||
return r;
|
return r;
|
||||||
@ -761,14 +764,25 @@ B slash_c2(B t, B w, B x) {
|
|||||||
if (xlen == 0) return x;
|
if (xlen == 0) return x;
|
||||||
usz s = xlen * wv;
|
usz s = xlen * wv;
|
||||||
if (xl>6 || (xl<3 && xl!=0) || TI(x,elType)==el_B) {
|
if (xl>6 || (xl<3 && xl!=0) || TI(x,elType)==el_B) {
|
||||||
if (xr!=1) goto base;
|
|
||||||
SLOW2("𝕨/𝕩", w, x);
|
|
||||||
B xf = getFillQ(x);
|
B xf = getFillQ(x);
|
||||||
|
if (xr!=1) {
|
||||||
|
MAKE_MUT(r0, IA(x) * wv) mut_init(r0, TI(x,elType)); MUTG_INIT(r0);
|
||||||
|
usz csz = arr_csz(x);
|
||||||
|
ux ri = 0;
|
||||||
|
for (ux i = 0; i < xlen; i++) for (ux j = 0; j < wv; j++) {
|
||||||
|
mut_copyG(r0, ri, x, i*csz, csz);
|
||||||
|
ri+= csz;
|
||||||
|
}
|
||||||
|
r = withFill(mut_fv(r0), xf);
|
||||||
|
r = taga(TI(r,slice)(r, 0, IA(r)));
|
||||||
|
goto atmW_setsh;
|
||||||
|
}
|
||||||
|
SLOW2("𝕨/𝕩", w, x);
|
||||||
HArr_p r0 = m_harrUv(s);
|
HArr_p r0 = m_harrUv(s);
|
||||||
SGetU(x)
|
SGetU(x)
|
||||||
for (usz i = 0; i < xlen; i++) {
|
for (ux i = 0; i < xlen; i++) {
|
||||||
B cx = incBy(GetU(x, i), wv);
|
B cx = incBy(GetU(x, i), wv);
|
||||||
for (i64 j = 0; j < wv; j++) *r0.a++ = cx;
|
for (ux j = 0; j < wv; j++) *r0.a++ = cx;
|
||||||
}
|
}
|
||||||
NOGC_E;
|
NOGC_E;
|
||||||
r = withFill(r0.b, xf);
|
r = withFill(r0.b, xf);
|
||||||
@ -803,7 +817,8 @@ B slash_c2(B t, B w, B x) {
|
|||||||
bool oo = o>=wv; xi+=d+oo; o-=wv&-oo;
|
bool oo = o>=wv; xi+=d+oo; o-=wv&-oo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
goto decX_ret;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wv <= 256) { BOOL_REP_XOR_SCAN(wv) }
|
if (wv <= 256) { BOOL_REP_XOR_SCAN(wv) }
|
||||||
else { BOOL_REP_OVER(wv, xlen) }
|
else { BOOL_REP_OVER(wv, xlen) }
|
||||||
@ -821,6 +836,7 @@ B slash_c2(B t, B w, B x) {
|
|||||||
#undef CASE
|
#undef CASE
|
||||||
}
|
}
|
||||||
if (xr > 1) {
|
if (xr > 1) {
|
||||||
|
atmW_setsh:;
|
||||||
usz* rsh = m_shArr(xr)->a;
|
usz* rsh = m_shArr(xr)->a;
|
||||||
rsh[0] = s;
|
rsh[0] = s;
|
||||||
shcpy(rsh+1, SH(x)+1, xr-1);
|
shcpy(rsh+1, SH(x)+1, xr-1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user