semantically squeeze F⌜ result

This commit is contained in:
dzaima 2025-06-08 18:47:29 +03:00
parent 286067ad51
commit 2447eb25cf
2 changed files with 11 additions and 9 deletions

View File

@ -84,9 +84,11 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
ra_nosh = reshape_one(ria, f);
goto nosh;
} else if (RTID(f) == n_ltack) {
w = squeeze_any(w);
r = replicate_by(xia, wia, w);
goto arith_finish;
} else if (RTID(f) == n_rtack) {
x = squeeze_any(x);
ux xia = IA(x);
if (ria<=xia) ra_nosh = TI(x,slice)(incG(x), 0, ria); // ria==0 or ria==xia; necessary as reshape_cycle doesn't handle those
else ra_nosh = reshape_cycle(ria, xia, incG(x));
@ -94,7 +96,7 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
} else if (isPervasiveDyExt(f)) {
if (ria == 0) goto arith_empty;
if (!TI(w,arrD1)) goto generic;
if (TI(x,arrD1) && wia>=4 && xia<2560>>arrTypeBitsLog(TY(x))) {
if (TI(x,arrD1) && wia>=4 && xia<2560>>arrTypeBitsLog(TY(x))) { // arrD1 checks imply that squeeze won't change fill (and the arith call will squeeze anyway)
B expW, expX;
if (0) {
arith_empty:;
@ -110,11 +112,11 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
ra_nosh = RARE(!reusable(r))? cpyWithShape(r) : a(r);
arr_shErase(ra_nosh, 1);
goto nosh;
} else if (xia>7) {
} else if (xia>3) {
SGet(w)
M_APD_TOT(rm, ria)
incByG(x, wia);
for (usz wi = 0; wi < wia; wi++) APDD(rm, fc2(f, Get(w,wi), x));
for (usz wi = 0; wi < wia; wi++) APDD(rm, fc2(f, Get(w,wi), x)); // arith call will squeeze
ra_nosh = APD_TOT_GET(rm);
goto nosh;
} else goto generic;
@ -128,7 +130,7 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
for (usz xi = 0; xi < xia; xi++) HARR_ADDA(r, fc2(f, cw, Get(x,xi)));
}
rsh = HARR_FA(r, rr);
r = HARR_O(r).b;
r = squeeze_any(HARR_O(r).b);
}
if (0) {
nosh:

View File

@ -606,11 +606,11 @@ b←1↓1∾a←"hello" ⋄ b ⌽⎊'e' ⥊⟜1⍟2 5 ⋄ a ≡○•Hash b %% 1
# ⌜
!"𝕨𝔽⌜𝕩: Result rank too large (200≡=𝕨, 200≡=𝕩)" % +˜(2001)1
%USE eqvar (! + •internal.Keep + )˜ 6 # TODO _eqvar once it's consistent
%USE eqvar (! -˜•internal.Keep -˜)˜ 6 # TODO _eqvar once it's consistent
%USE eqvar (! •internal.Keep _eqvar)˜ 6
%USE eqvar (! •internal.Keep _eqvar)˜ 6
%USE eqvar (! 9•internal.Keep 9_eqvar)˜ 6
%USE eqvar (! + •internal.Keep + _eqvar)˜ 0124916
%USE eqvar (! -˜•internal.Keep -˜_eqvar)˜ 0124916
%USE eqvar (! •internal.Keep _eqvar)˜ 0124916
%USE eqvar (! •internal.Keep _eqvar)˜ 0124916
%USE eqvar (! 9•internal.Keep 9_eqvar)˜ 0124916
# ˜
5˜˝ "ab" %% 5