From bac1eaf9e3dd95c049010cbd3f5da67f8dbaa95b Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 5 Aug 2022 03:19:12 +0300 Subject: [PATCH] =?UTF-8?q?squeeze=20result=20of=20=C2=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/each.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/utils/each.c b/src/utils/each.c index ef607747..f1fe27ed 100644 --- a/src/utils/each.c +++ b/src/utils/each.c @@ -15,7 +15,7 @@ B eachd_fn(BBB2B f, B fo, B w, B x) { if (rM==0) { B r = f(fo, Get(w,0), Get(x,0)); decG(w); decG(x); - return m_hunit(r); + return m_unit(r); } if (rm && !eqShPart(a(w)->sh, a(x)->sh, rm)) thrF("Mapping: Expected equal shape prefix (%H ≡ ≢𝕨, %H ≡ ≢𝕩)", w, x); bool rw = rM==wr && ((v(w)->type==t_harr) & reusable(w)); // v(…) is safe as rank>0 @@ -31,7 +31,7 @@ B eachd_fn(BBB2B f, B fo, B w, B x) { else for (usz i = 0; i < ria; i++) r.a[i] = f(fo, Get(w,i), hmv(r,i)); } decG(rw? x : w); - return r.b; + return any_squeeze(r.b); } B bo = wg? w : x; @@ -48,7 +48,7 @@ B eachd_fn(BBB2B f, B fo, B w, B x) { } B rb = HARR_FC(r, bo); decG(w); decG(x); - return rb; + return any_squeeze(rb); } B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still has refcounting errors @@ -65,12 +65,12 @@ B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still if (reuse) { dec(xp[i]); xp[i++] = cr; for (; i < ia; i++) xp[i] = f(fo, mv(xp,i)); - return REUSE(x); + return any_squeeze(REUSE(x)); } else { M_HARR(rHc, ia) HARR_ADD(rHc, i, cr); for (usz i = 1; i < ia; i++) HARR_ADD(rHc, i, f(fo, inc(xp[i]))); - return HARR_FCD(rHc, x); + return any_squeeze(HARR_FCD(rHc, x)); } } else if (TI(x,elType)==el_i32) { i32* xp = i32any_ptr(x); @@ -89,7 +89,7 @@ B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still rp[i] = o2iu(cr); } decG(x); - return r; + return num_squeeze(r); } else if (TI(x,elType)==el_f64) { f64* xp = f64any_ptr(x); B r; f64* rp; @@ -107,7 +107,7 @@ B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still rp[i] = o2fu(cr); } decG(x); - return r; + return num_squeeze(r); } else if (v(x)->type==t_fillarr) { B* xp = fillarr_ptr(a(x)); if (reuse) { @@ -115,12 +115,12 @@ B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still c(FillArr,x)->fill = bi_noFill; dec(xp[i]); xp[i++] = cr; for (; i < ia; i++) xp[i] = f(fo, mv(xp,i)); - return REUSE(x); + return any_squeeze(REUSE(x)); } else { M_HARR(rHc, ia) HARR_ADD(rHc, i, cr); for (usz i = 1; i < ia; i++) HARR_ADD(rHc, i, f(fo, inc(xp[i]))); - return HARR_FCD(rHc, x); + return any_squeeze(HARR_FCD(rHc, x)); } } else rH = m_harr0c(x); @@ -130,5 +130,5 @@ B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still rH.a[i++] = cr; for (; i < ia; i++) rH.a[i] = f(fo, Get(x,i)); decG(x); - return rH.b; + return any_squeeze(rH.b); } \ No newline at end of file