Skip to content

Simplify and extend logic in binop functions #4448

Open
4 of 8 issues completed
Open

Description

@1RyanK

Feature Description
Most of the binop functions (binopvv (vector-vector), binopvs (vector-scalar), binopsv (scalar-vector)) have unnecessarily long chains of logic to determine the output type. This makes the code hard to maintain. There should be a much simpler chain of logic to determine the output type. Similarly, the logic in the functions that actually execute the operation can hopefully be simplified. Furthermore, there is no regard to size of data types (int(8) vs int(16) vs ...) and uint seems altogether left out (technically I think this is partly referred to in Issue #4170).

Example Behavior
Should be set up to match numpy as much as possible. Technically numpy has np.float16, and Chapel doesn't support 16-bit floats, so if anything would fall there, probably just default to ak.float32.

Describe Workarounds
In some cases no, but where possible users can just directly cast results to whatever type they want.

Sub-issues

Sub-issues

4 of 8 Issues completed
Loading 8 sub-issues

Activity

  1. added this to the Numpy Alignment milestone on May 23, 2025
  2. self-assigned this
    on May 23, 2025
  3. added
    enhancement
    on May 23, 2025
  4. 1RyanK commented on Dec 23, 2025

    @1RyanK
    ContributorAuthor

    I was thinking about fixing up opeqvv and opeqvs as well and this may help.

    import numpy as np
    from collections import defaultdict
    
    # Core dtypes you care about
    DTYPES = {
        "i64": np.int64,
        "u64": np.uint64,
        "u8":  np.uint8,
        "b":   np.bool_,
        "f64": np.float64,
        # bigint simulation as an *array* dtype:
        # use dtype=object with values around 2**200
        "big": object,
    }
    
    OPS = ["+=", "-=", "*=", "//=", "%=", "**=", "&=", "|=", "^=", "<<=", ">>="]
    
    BIG_POS = 2**200 + 123
    BIG_POS2 = 2**200 + 456
    BIG_NEG = -(2**200 + 123)
    
    def sample_array(name):
        if name == "big":
            # keep values large but not astronomically huge to avoid pathological shifts
            return np.array([BIG_POS, BIG_POS2, BIG_POS + 2], dtype=object)
    
        dt = DTYPES[name]
        if dt is np.bool_:
            return np.array([True, False, True], dtype=dt)
        if dt is np.float64:
            return np.array([1.5, 2.0, -3.25], dtype=dt)
        return np.array([1, 2, 3], dtype=dt)
    
    def sample_rhs(name):
        if name == "big":
            # RHS bigint array; include a small shift amount in 2nd slot to keep shifts sane
            return np.array([BIG_POS, 2, 3], dtype=object)
    
        dt = DTYPES[name]
        if dt is np.bool_:
            return np.array([False, True, False], dtype=dt)
        if dt is np.float64:
            return np.array([0.5, 2.0, 4.0], dtype=dt)
        if dt is np.uint8:
            return np.array([250, 2, 3], dtype=dt)
        if dt is np.uint64:
            return np.array([2**63 + 5, 2, 3], dtype=dt)
        return np.array([2**63 - 1, 2, 3], dtype=dt)
    
    def do_inplace(op, a, b):
        loc = {"a": a, "b": b}
        exec(f"a {op} b", {}, loc)
        return loc["a"]
    
    def ops_str(ops):
        ops = list(ops)
        if len(ops) == len(OPS):
            return "ALL OPERATORS"
        return ", ".join(ops)
    
    def summarize_by_type(results):
        """
        Group successes by output dtype; failures by exception type only.
        """
        ok = defaultdict(list)   # out_dtype -> [ops]
        err = defaultdict(list)  # exc_type  -> [ops]
    
        for op, status, outdtype, exctype in results:
            if status == "OK":
                ok[outdtype].append(op)
            else:
                err[exctype].append(op)
    
        parts = []
        for outdtype in sorted(ok.keys()):
            parts.append(f"{ops_str(ok[outdtype])} => OK→{outdtype}")
        for exctype in sorted(err.keys()):
            parts.append(f"{ops_str(err[exctype])} => {exctype}")
        return " | ".join(parts)
    
    def run_pair(lhs, rhs):
        a0 = sample_array(lhs)
        b0 = sample_rhs(rhs)
    
        results = []
        for op in OPS:
            # Bigint-safe: skip bigint power (explosively slow)
            if (lhs == "big" or rhs == "big") and op == "**=":
                results.append((op, "ERR", "", "SKIP"))
                continue
    
            a = a0.copy()
            b = b0.copy()
    
            try:
                do_inplace(op, a, b)
                results.append((op, "OK", str(a.dtype), ""))
            except Exception as e:
                results.append((op, "ERR", "", type(e).__name__))
        return results
    
    def print_section(title):
        print("\n" + "=" * len(title))
        print(title)
        print("=" * len(title))
    
    def main():
        np.set_printoptions(edgeitems=2, threshold=4)
    
        keys = ["i64", "u64", "u8", "b", "f64", "big"]
    
        print_section("Array-vs-array inplace-op behavior (including bigint arrays as dtype=object)")
        for lhs in keys:
            for rhs in keys:
                res = run_pair(lhs, rhs)
                print(f"{lhs:>3} op= {rhs:<3} -> {summarize_by_type(res)}")
    
    if __name__ == "__main__":
        main()
    
    ============================================================================
    Array-vs-array inplace-op behavior (including bigint arrays as dtype=object)
    ============================================================================
    i64 op= i64 -> ALL OPERATORS => OK→int64
    i64 op= u64 -> &=, |=, ^=, <<=, >>= => TypeError | +=, -=, *=, //=, %=, **= => UFuncTypeError
    i64 op= u8  -> ALL OPERATORS => OK→int64
    <string>:1: RuntimeWarning: divide by zero encountered in floor_divide
    <string>:1: RuntimeWarning: divide by zero encountered in remainder
    i64 op= b   -> ALL OPERATORS => OK→int64
    i64 op= f64 -> &=, |=, ^=, <<=, >>= => TypeError | +=, -=, *=, //=, %=, **= => UFuncTypeError
    i64 op= big -> **= => SKIP | +=, -=, *=, //=, %=, &=, |=, ^=, <<=, >>= => UFuncTypeError
    u64 op= i64 -> &=, |=, ^=, <<=, >>= => TypeError | +=, -=, *=, //=, %=, **= => UFuncTypeError
    u64 op= u64 -> ALL OPERATORS => OK→uint64
    u64 op= u8  -> ALL OPERATORS => OK→uint64
    <string>:1: RuntimeWarning: divide by zero encountered in floor_divide
    <string>:1: RuntimeWarning: divide by zero encountered in remainder
    u64 op= b   -> ALL OPERATORS => OK→uint64
    u64 op= f64 -> &=, |=, ^=, <<=, >>= => TypeError | +=, -=, *=, //=, %=, **= => UFuncTypeError
    u64 op= big -> **= => SKIP | +=, -=, *=, //=, %=, &=, |=, ^=, <<=, >>= => UFuncTypeError
     u8 op= i64 -> ALL OPERATORS => UFuncTypeError
     u8 op= u64 -> ALL OPERATORS => OK→uint8
     u8 op= u8  -> ALL OPERATORS => OK→uint8
    <string>:1: RuntimeWarning: divide by zero encountered in floor_divide
    <string>:1: RuntimeWarning: divide by zero encountered in remainder
     u8 op= b   -> ALL OPERATORS => OK→uint8
     u8 op= f64 -> &=, |=, ^=, <<=, >>= => TypeError | +=, -=, *=, //=, %=, **= => UFuncTypeError
     u8 op= big -> **= => SKIP | +=, -=, *=, //=, %=, &=, |=, ^=, <<=, >>= => UFuncTypeError
      b op= i64 -> ALL OPERATORS => UFuncTypeError
      b op= u64 -> ALL OPERATORS => UFuncTypeError
      b op= u8  -> ALL OPERATORS => UFuncTypeError
      b op= b   -> +=, *=, &=, |=, ^= => OK→bool | -= => TypeError | //=, %=, **=, <<=, >>= => UFuncTypeError
      b op= f64 -> &=, |=, ^=, <<=, >>= => TypeError | +=, -=, *=, //=, %=, **= => UFuncTypeError
      b op= big -> **= => SKIP | +=, -=, *=, //=, %=, &=, |=, ^=, <<=, >>= => UFuncTypeError
    <string>:1: RuntimeWarning: overflow encountered in power
    f64 op= i64 -> +=, -=, *=, //=, %=, **= => OK→float64 | &=, |=, ^=, <<=, >>= => TypeError
    <string>:1: RuntimeWarning: overflow encountered in power
    f64 op= u64 -> +=, -=, *=, //=, %=, **= => OK→float64 | &=, |=, ^=, <<=, >>= => TypeError
    f64 op= u8  -> +=, -=, *=, //=, %=, **= => OK→float64 | &=, |=, ^=, <<=, >>= => TypeError
    <string>:1: RuntimeWarning: divide by zero encountered in floor_divide
    <string>:1: RuntimeWarning: invalid value encountered in remainder
    f64 op= b   -> +=, -=, *=, //=, %=, **= => OK→float64 | &=, |=, ^=, <<=, >>= => TypeError
    f64 op= f64 -> +=, -=, *=, //=, %=, **= => OK→float64 | &=, |=, ^=, <<=, >>= => TypeError
    f64 op= big -> **= => SKIP | +=, -=, *=, //=, %=, &=, |=, ^=, <<=, >>= => UFuncTypeError
    big op= i64 -> +=, -=, *=, //=, %=, &=, |=, ^=, >>= => OK→object | <<= => MemoryError | **= => SKIP
    big op= u64 -> +=, -=, *=, //=, %=, &=, |=, ^=, >>= => OK→object | <<= => MemoryError | **= => SKIP
    big op= u8  -> +=, -=, *=, //=, %=, &=, |=, ^=, <<=, >>= => OK→object | **= => SKIP
    big op= b   -> +=, -=, *=, &=, |=, ^=, <<=, >>= => OK→object | **= => SKIP | //=, %= => ZeroDivisionError
    big op= f64 -> +=, -=, *=, //=, %= => OK→object | **= => SKIP | &=, |=, ^=, <<=, >>= => TypeError
    big op= big -> +=, -=, *=, //=, %=, &=, |=, ^=, >>= => OK→object | <<= => OverflowError | **= => SKIP
    
  5. 1RyanK commented on Jan 12, 2026

    @1RyanK
    ContributorAuthor

    Here's code that tests differences. It's vv and vs/sv, but I think not opeq (in place).

    # =========================
    # Cell 0: imports (no connect)
    # =========================
    import operator, math, warnings, time
    import numpy as np
    import arkouda as ak
    
    # =========================
    # Cell 2: tiny operands (small numbers only)
    # (safe: avoids huge exponents but still includes a high-bit uint64 for bitwise)
    # =========================
    
    # Numpy vectors
    NP = {
        "np_bool":   np.array([False, True, True], dtype=np.bool_),
        "np_int64":  np.array([-1, 0, 2], dtype=np.int64),
        "np_uint64": np.array([0, 1, 20], dtype=np.uint64),   # keep high bit for bitwise
        "np_float64":np.array([-1.5, 0.0, 2.25], dtype=np.float64),
        "np_bigint_obj": np.array([1, 2, 3], dtype=object),     # small bigint-like python ints
    }
    
    # Arkouda vectors
    AK = {
        "ak_bool":   ak.array([False, True, True], dtype=ak.bool),
        "ak_int64":  ak.array([-1, 0, 2], dtype=ak.int64),
        "ak_uint64": ak.array([0, 1, 20], dtype=ak.uint64),
        "ak_float64":ak.array([-1.5, 0.0, 2.25], dtype=ak.float64),
    
        # bigint: unbounded (max_bits=-1) and bounded (e.g. 128)
        "ak_bigint_unbounded": ak.array([1, 2, 3], dtype=ak.bigint, max_bits=-1),
        "ak_bigint_128":       ak.array([1, 2, 3], dtype=ak.bigint, max_bits=128),
    }
    
    # Scalars (small!)
    SCALARS_NP = {
        "s_int": 2,
        "s_negint": -2,
        "s_float": 2.0,
        "s_nfloat": -2.0,
        "s_bool": True,
    }
    
    # For Arkouda scalar tests, just reuse same python scalars (keep small)
    SCALARS_AK = dict(SCALARS_NP)
    
    
    # =========================
    # Cell 3: operators
    # =========================
    
    BINOPS = {
        "+": operator.add,
        "-": operator.sub,
        "*": operator.mul,
        "/": operator.truediv,
        "//": operator.floordiv,
        "%": operator.mod,
        "**": operator.pow,
        "&": operator.and_,
        "|": operator.or_,
        "^": operator.xor,
        "<<": operator.lshift,
        ">>": operator.rshift,
        "==": operator.eq,
        "!=": operator.ne,
        "<": operator.lt,
        "<=": operator.le,
        ">": operator.gt,
        ">=": operator.ge,
    }
    
    
    # ==========================================================
    # Cell 4: safe exec + guards + progress + (optional) previews
    # ==========================================================
    
    # During the sweep, fetching Arkouda values can be slow.
    # If you want speed + progress, keep this False.
    # If you want values in the mismatch printouts, set True.
    FETCH_AK_VALUES_IN_PREVIEW = True
    
    def np_run(opfunc, a, b):
        try:
            with np.errstate(all="ignore"):
                with warnings.catch_warnings():
                    warnings.simplefilter("ignore", RuntimeWarning)
                    out = opfunc(a, b)
            return True, out, None
        except Exception as e:
            return False, None, repr(e)
    
    def ak_run(opfunc, a, b):
        try:
            out = opfunc(a, b)
            return True, out, None
        except Exception as e:
            return False, None, repr(e)
    
    def np_preview(x):
        if isinstance(x, np.ndarray):
            #return f"{x.dtype} {x.tolist()}"
            return f"{x.tolist()}"
        if isinstance(x, np.generic):
            #return f"{x.dtype} {x!r}"
            return f"{x.tolist()}"
        return f"{type(x).__name__} {x!r}"
    
    def ak_preview(x):
        if isinstance(x, ak.pdarray):
            if FETCH_AK_VALUES_IN_PREVIEW:
                arr = x.to_ndarray()
                #return f"{x.dtype} {arr.tolist()}"
                return f"{x.tolist()}"
            else:
                #return f"{x.dtype} <pdarray len={x.size}>"
                return f"{x.tolist()}"
        try:
            return f"{getattr(x,'dtype',type(x).__name__)} {x!r}"
        except Exception:
            return repr(x)
    
    def is_inty_scalar(x):
        return isinstance(x, (int, np.integer, bool, np.bool_))
        
    # Add near your other helpers (e.g., after is_inty_scalar)
    
    U128_MOD = 1 << 128
    
    def _is_bigint_128_case(Aname: str, Bname: str) -> bool:
        # If either side is explicitly ak_bigint_128, treat bigint results as mod 2**128
        return (Aname == "ak_bigint_128") or (Bname == "ak_bigint_128")
    
    def _wrap_u128_scalar(x):
        # Wrap python/numpy integer-like scalar into [0, 2**128-1]
        # Keep bool consistent (bool is int subclass).
        if isinstance(x, (bool, np.bool_)):
            x = int(x)
        if isinstance(x, (int, np.integer)):
            return int(x) % U128_MOD
        return x
    
    def _wrap_u128_list(xs):
        return [_wrap_u128_scalar(v) for v in xs]
    
    
    def should_skip_arkouda(op, a_name, b_name, a, b):
        """
        Conservative safety skips to avoid known crash / compute bombs.
        We still report them as SKIPPED so you see the inputs.
        """
    
        # Shifts: skip negative shift
        if op in ("<<", ">>"):
            if is_inty_scalar(b) and int(b) < 0:
                return True, "skip negative shift"
    
        if op == "**":
            # 1) Known fragile: pow with unbounded bigint (server-side limitations)
            if a_name == "ak_bigint_unbounded" or b_name == "ak_bigint_unbounded":
                return True, "skip pow with ak_bigint_unbounded (unbounded max_bits)"
    
            # 2) Negative exponent on integer-ish base (Arkouda errors; also avoids weirdness)
            if is_inty_scalar(b) and int(b) < 0:
                if (isinstance(a, ak.pdarray) and str(a.dtype) in ("int64","uint64","bigint","bool")):
                    return True, "skip negative exponent on integer/bigint base"
    
            # 3) Specific compute-bomb you found: bigint ** uint64 where uint64 contains 2**63
            #    This creates 3**(9223372036854775808) on lane 3.
            if a_name == "ak_bigint_unbounded" and b_name == "ak_uint64":
                return True, "skip ak_bigint_unbounded ** ak_uint64 (contains huge exponent 2**63)"
    
            # 4) Even for bounded bigint, avoid gigantic integer exponents coming from uint64 high bits
            #    (keep bitwise edge in uint64, but don't use it as exponent)
            if b_name == "ak_uint64":
                return True, "skip ** with uint64 exponent vector (may include huge exponents)"
    
        return False, ""
    
    
    # ==========================================================
    # Cell 5: runner with progress + mismatch output
    # ==========================================================
    
    def sweep_small(
        verbose_matches=False,
        max_lines=5000,
        progress_every=100,
        progress_every_sec=2.0,
    ):
        """
        - Prints mismatches (and optionally matches)
        - Prints progress at least every progress_every cases OR every progress_every_sec seconds
        - Avoids server crashes via should_skip_arkouda()
        """
        lines = 0
        mismatches = 0
        total = 0
    
        # Precompute planned total (for i/N progress)
        def candidate_count_for_np_name(np_name):
            return 2 if np_name == "np_bigint_obj" else 1
    
        vv_pairs = sum(candidate_count_for_np_name(a) * candidate_count_for_np_name(b)
                       for a in NP for b in NP)
        vv_cases = vv_pairs * len(BINOPS)
    
        vs_pairs = sum(candidate_count_for_np_name(a) for a in NP) * len(SCALARS_NP)
        vs_cases = vs_pairs * len(BINOPS)
        sv_cases = vs_pairs * len(BINOPS)
    
        total_planned = vv_cases + vs_cases + sv_cases
        last_progress_t = time.time()
    
        def emit(s):
            nonlocal lines
            if lines < max_lines:
                print(s, flush=True)
            lines += 1
    
        def progress(kind, op, Aname, Bname):
            nonlocal last_progress_t
            now = time.time()
            if (total % progress_every == 0) or (now - last_progress_t >= progress_every_sec):
                print(f"Running case {total}/{total_planned}: [{kind}] {Aname} {op} {Bname}", flush=True)
                last_progress_t = now
    
        def compare_case(kind, op, Aname, Bname, npA, npB, akA, akB):
            nonlocal mismatches, total
            total += 1
            progress(kind, op, Aname, Bname)
    
            opfunc = BINOPS[op]
    
            np_ok, np_out, np_err = np_run(opfunc, npA, npB)
    
            #ak_skip, ak_skip_reason = should_skip_arkouda(op, Aname, Bname, akA, akB)
            #if ak_skip:
            #    ak_ok, ak_out, ak_err = False, None, f"SKIPPED: {ak_skip_reason}"
            #else:
            #    ak_ok, ak_out, ak_err = ak_run(opfunc, akA, akB)
            ak_skip, ak_skip_reason = should_skip_arkouda(op, Aname, Bname, akA, akB)
            ak_ok, ak_out, ak_err = ak_run(opfunc, akA, akB)
    
            # OK mismatch?
            if np_ok != ak_ok:
                mismatches += 1
                emit(f"[{kind}] {Aname} {op} {Bname}  OK_MISMATCH  NP(ok={np_ok}) AK(ok={ak_ok})")
                emit(f"   NP_in: {np_preview(npA)}  ,  {np_preview(npB)}")
                emit(f"   AK_in: {ak_preview(akA)}  ,  {ak_preview(akB)}")
                emit(f"   NP_err: {np_err}")
                emit(f"   AK_err: {ak_err}")
                return
    
            # both error
            if (not np_ok) and (not ak_ok):
                if verbose_matches:
                    emit(f"[{kind}] {Aname} {op} {Bname}  both_error")
                    emit(f"   NP_err: {np_err}")
                    emit(f"   AK_err: {ak_err}")
                return
    
            # both ok: compare dtype+value (value compare uses to_ndarray; keep arrays tiny)
            np_out_p = np_preview(np_out)
            ak_out_p = ak_preview(ak_out)
            
            # If bigint_128 case, make NP preview show the wrapped representation too (optional but nice)
            if _is_bigint_128_case(Aname, Bname):
                try:
                    if isinstance(np_out, np.ndarray) and isinstance(ak_out, ak.pdarray) and str(ak_out.dtype) == "bigint":
                        np_out_p = f"{_wrap_u128_list(np_out.tolist())}"
                except Exception:
                    pass
    
            value_same = True
            try:
                if isinstance(np_out, np.ndarray):
                    if isinstance(ak_out, ak.pdarray):
                        ak_dtype = str(ak_out.dtype)
    
                        # --- BIGINT handling (improved) ---
                        if ak_dtype == "bigint":
                            ak_list = ak_out.to_ndarray().tolist()
                            np_list = np_out.tolist()
    
                            if _is_bigint_128_case(Aname, Bname):
                                # Compare in the ring Z/(2**128), like Arkouda bigint_128 intends
                                value_same = (_wrap_u128_list(np_list) == ak_list)
                            else:
                                # Unbounded bigint should match Python ints exactly (no wrapping)
                                value_same = (np_list == ak_list)
    
                        # --- Non-bigint numeric arrays ---
                        elif np_out.dtype != object:
                            value_same = np.allclose(
                                np_out.astype(float),
                                ak_out.to_ndarray().astype(float),
                                equal_nan=True
                            )
                        else:
                            value_same = (np_out.tolist() == ak_out.to_ndarray().tolist())
    
                    else:
                        value_same = (np_out.tolist() == ak_out)
    
                else:
                    # scalar-ish
                    if isinstance(ak_out, ak.pdarray):
                        value_same = False
                    else:
                        # If Arkouda ever returns scalar bigint (unlikely here), keep behavior sane
                        if _is_bigint_128_case(Aname, Bname):
                            # Only wrap integer-like scalar results
                            if isinstance(np_out, (int, np.integer, bool, np.bool_)) and isinstance(ak_out, (int, np.integer)):
                                value_same = (_wrap_u128_scalar(np_out) == int(ak_out))
                            else:
                                value_same = (np_out == ak_out)
                        else:
                            if isinstance(np_out, float) and isinstance(ak_out, float) and math.isnan(np_out) and math.isnan(ak_out):
                                value_same = True
                            else:
                                value_same = (np_out == ak_out)
    
            except Exception:
                value_same = False
    
            if (not value_same):
                mismatches += 1
                emit(f"[{kind}] {Aname} {op} {Bname}  RESULT_DIFF")
                emit(f"   NP_out: {np_out_p}")
                emit(f"   AK_out: {ak_out_p}")
                emit(f"   NP_in: {np_preview(npA)}  ,  {np_preview(npB)}")
                emit(f"   AK_in: {ak_preview(akA)}  ,  {ak_preview(akB)}")
            elif verbose_matches:
                emit(f"[{kind}] {Aname} {op} {Bname} match")
    
        # 1) vector-vector
        for Aname, npA in NP.items():
            for Bname, npB in NP.items():
                if Aname == "np_bigint_obj":
                    akA_candidates = [("ak_bigint_unbounded", AK["ak_bigint_unbounded"]),
                                      ("ak_bigint_128", AK["ak_bigint_128"])]
                else:
                    akA_candidates = [(Aname.replace("np_", "ak_"), AK.get(Aname.replace("np_", "ak_")))]
    
                if Bname == "np_bigint_obj":
                    akB_candidates = [("ak_bigint_unbounded", AK["ak_bigint_unbounded"]),
                                      ("ak_bigint_128", AK["ak_bigint_128"])]
                else:
                    akB_candidates = [(Bname.replace("np_", "ak_"), AK.get(Bname.replace("np_", "ak_")))]
    
                for akAname, akA in akA_candidates:
                    for akBname, akB in akB_candidates:
                        if akA is None or akB is None:
                            continue
                        for op in BINOPS:
                            #print(op, akAname, akA, akBname, akB)
                            compare_case("vv", op, akAname, akBname, npA, npB, akA, akB)
    
        # 2) vector-scalar / scalar-vector
        for Aname, npA in NP.items():
            if Aname == "np_bigint_obj":
                akA_candidates = [("ak_bigint_unbounded", AK["ak_bigint_unbounded"]),
                                  ("ak_bigint_128", AK["ak_bigint_128"])]
            else:
                akA_candidates = [(Aname.replace("np_", "ak_"), AK.get(Aname.replace("np_", "ak_")))]
    
            for sname, sval in SCALARS_NP.items():
                for akAname, akA in akA_candidates:
                    if akA is None:
                        continue
                    for op in BINOPS:
                        # vector-scalar
                        compare_case("vs", op, akAname, sname, npA, sval, akA, SCALARS_AK[sname])
                        # scalar-vector
                        compare_case("sv", op, sname, akAname, sval, npA, SCALARS_AK[sname], akA)
    
        print("\nDone.", flush=True)
        print("Total cases:", total, "/", total_planned, flush=True)
        print("Mismatches:", mismatches, flush=True)
        print("Printed lines:", min(lines, max_lines), "(cap:", max_lines, ")", flush=True)
    
    # Run it:
    sweep_small(verbose_matches=False, max_lines=2000, progress_every=100, progress_every_sec=2.0)
    
    

    I think it might be worth trying to merge bigint binops and regular binops, like it is with opeq. Probably will combine more code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions