// the registry on the JS target: a plain array of Float32Arrays if (typeof globalThis.bend_weights === "undefined") globalThis.bend_weights = []; function bend_js_sgemm(m, n, k, ta, tb, a, b) { let slots = 1; while (slots < m * n) slots *= 2; const c = new Array(slots).fill(0); for (let i = 0; i < m; i++) { for (let j = 0; j < n; j++) { let acc = 0; for (let l = 0; l < k; l++) { const x = ta ? a[l * m + i] : a[i * k + l]; const y = tb ? b[j * k + l] : b[l * n + j]; acc += x * y; } c[i * n + j] = acc; } } return c; } function bend_js_read_floats(path, n) { const fs = require("fs"); const buf = fs.readFileSync(path); if (buf.length < n * 4) return null; const f = new Float32Array(buf.buffer, buf.byteOffset, n); return Array.from(f); } function blas_sgemm(m, n, k, ta, tb, a, b) { return io_done(bend_js_sgemm(m, n, k, ta, tb, a, b)); }