use APD for Arith⌜

This commit is contained in:
dzaima 2023-04-28 19:30:54 +03:00
parent b17d2010c2
commit 5aa896ab38
3 changed files with 6 additions and 6 deletions

View File

@ -78,10 +78,10 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
r = fc2(f, C2(slash, m_i32(xia), taga(wd)), C2(shape, m_f64(ria), incG(x)));
} else if (xia>7) {
SGet(w)
M_HARR(r, wia)
M_APD_SH1(rm, wia)
incByG(x, wia);
for (usz wi = 0; wi < wia; wi++) HARR_ADD(r, wi, fc2(f, Get(w,wi), x));
r = bqn_merge(HARR_FV(r));
for (usz wi = 0; wi < wia; wi++) APDD(rm, fc2(f, Get(w,wi), x));
r = taga(APD_SH_GET(rm, 0));
} else goto generic;
if (RNK(r)>1) {
SRNK(r, 0); // otherwise the following arr_shAlloc failing will result in r->sh dangling

View File

@ -439,7 +439,7 @@ B bqn_merge(B x) {
SGetU(x)
for (usz i = 0; i < xia; i++) APD(r, GetU(x, i));
decG(x);
return taga(APD_SH_GET(r, 0));
return taga(APD_SH_GET(r, 1));
}
#ifdef ALLOC_STAT

View File

@ -455,7 +455,7 @@ static B m_getU_B (void* a, usz ms) { return ((B*) a)[ms]; }
void apd_fail_apd(ApdMut* m, B x) { }
Arr* apd_sh_err(ApdMut* m, u32 ty) {
B msg = make_fmt("%c: Incompatible %S shapes (encountered shapes %2H and %H)", ty==0? '>' : ty, ty==0? "element" : "result", m->cr, m->csh, m->failEl);
B msg = make_fmt("%c: Incompatible %S shapes (encountered shapes %2H and %H)", ty==1? '>' : ty, ty==1? "element" : "result", m->cr, m->csh, m->failEl);
arr_shErase(m->obj, 1);
ptr_dec(m->obj);
dec(m->failEl);
@ -464,7 +464,7 @@ Arr* apd_sh_err(ApdMut* m, u32 ty) {
Arr* apd_rnk_err(ApdMut* m, u32 ty) {
ur er = RNK(m->failEl); // if it were atom, rank couldn't overflow
dec(m->failEl);
thrF("%c: Result rank too large (%i ≡ =𝕩, %s ≡ =%U)", ty==0? '>' : ty, m->rr0, er, ty==0? "⊑𝕩" : "𝔽v");
thrF("%c: Result rank too large (%i ≡ =𝕩, %s ≡ =%U)", ty==1? '>' : ty, m->rr0, er, ty==1? "⊑𝕩" : "𝔽v");
}
NOINLINE void apd_sh_fail(ApdMut* m, B x, u8 mode) {
if (mode<=1) m->cr = mode;