Beispiel
numba 0.67.0rc1: guvectorize
Verifiziertes Beispiel für pypi numba 0.67.0rc1: guvectorize. Der Vertrag lief auf python 3.12 · linux debian/x64 · docker und bestand.
sha256:1b6a1fec598fd0115ab2be8b625156617399eff4ebbfb19e6f401139e2ffe906
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 pip
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| python 3.12 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-slim@sha256:09f7da3bc104… |
2026-09-02 |
Fall
HOW- Ziel
- verify numba.guvectorize in pkg:pypi/numba@0.67.0rc1
- Pakete
- Symbole
-
- numba.guvectorize
- Erstellt
- 2026-09-02T13:14:27Z
Contract
- assert guvectorize with explicit signatures performs 1D vector addition and broadcasts across 2D arrays
- assert guvectorize with reduction layout computes sum reduction over 1D and 2D arrays
- assert guvectorize with matrix-vector signature computes matrix-vector products
- assert guvectorize dynamically compiles layout function with explicit output buffer argument
- assert guvectorize with explicit signatures raises TypeError when called with incompatible argument types
Dateien
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- test/contract.py
Quelltext
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify numba.guvectorize in pkg:pypi/numba@0.67.0rc1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/numba@0.67.0rc1
Demonstrate these symbols/APIs:
- numba.guvectorize
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:98bb5813a13ce793eed9cb59b23fc4cbd7f1f0a6a5c38ab2e3ae5826954f97aa","contract":["assert guvectorize with explicit signatures performs 1D vector addition and broadcasts across 2D arrays","assert guvectorize with reduction layout computes sum reduction over 1D and 2D arrays","assert guvectorize with matrix-vector signature computes matrix-vector products","assert guvectorize dynamically compiles layout function with explicit output buffer argument","assert guvectorize with explicit signatures raises TypeError when called with incompatible argument types"],"goal":"verify numba.guvectorize in pkg:pypi/numba@0.67.0rc1","kind":"HOW","packages":["pkg:pypi/numba@0.67.0rc1"],"schemaVersion":1,"symbols":["numba.guvectorize"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/numba@0.67.0rc1"],"schemaVersion":1,"subject":"pkg:pypi/numba@0.67.0rc1","symbols":["numba.guvectorize"],"verifierAdapter":"python@1"}
[project]
name = "verify-numba-guvectorize"
version = "0.1.0"
dependencies = [
"llvmlite==0.49.0",
"numba==0.67.0rc1",
"numpy==2.5.2",
]
--pre
llvmlite==0.49.0
numba==0.67.0rc1
numpy==2.5.2
{
"schemaVersion": 1,
"goal": "verify numba.guvectorize in pkg:pypi/numba@0.67.0rc1",
"kind": "HOW",
"packages": [
"pkg:pypi/numba@0.67.0rc1"
],
"symbols": [
"numba.guvectorize"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import numpy as np
import numba
from numba import guvectorize, int64, float64
def test_guvectorize_explicit_signatures():
@guvectorize([(int64[:], int64[:], int64[:]), (float64[:], float64[:], float64[:])], '(n),(n)->(n)')
def gu_add(a, b, out):
for i in range(a.shape[0]):
out[i] = a[i] + b[i]
# 1D vector addition
a = np.array([1, 2, 3], dtype=np.int64)
b = np.array([4, 5, 6], dtype=np.int64)
res = gu_add(a, b)
assert isinstance(res, np.ndarray)
assert np.array_equal(res, np.array([5, 7, 9], dtype=np.int64))
# Broadcasting over 2D array
a_2d = np.array([[1, 2], [3, 4]], dtype=np.int64)
b_2d = np.array([[10, 20], [30, 40]], dtype=np.int64)
res_2d = gu_add(a_2d, b_2d)
assert res_2d.shape == (2, 2)
assert np.array_equal(res_2d, np.array([[11, 22], [33, 44]], dtype=np.int64))
def test_guvectorize_reduction_layout():
@guvectorize([(float64[:], float64[:])], '(n)->()')
def gu_sum(a, out):
s = 0.0
for i in range(a.shape[0]):
s += a[i]
out[0] = s
# 1D array reduction to scalar
arr_1d = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64)
res_1d = gu_sum(arr_1d)
assert np.isclose(res_1d, 10.0)
# 2D array reduction along axis
arr_2d = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float64)
res_2d = gu_sum(arr_2d)
assert res_2d.shape == (3,)
assert np.allclose(res_2d, np.array([3.0, 7.0, 11.0]))
def test_guvectorize_matrix_vector():
@guvectorize([(float64[:,:], float64[:], float64[:])], '(m,n),(n)->(m)')
def gu_matvec(A, x, out):
for i in range(A.shape[0]):
s = 0.0
for j in range(A.shape[1]):
s += A[i, j] * x[j]
out[i] = s
mat = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64)
vec = np.array([5.0, 6.0], dtype=np.float64)
res = gu_matvec(mat, vec)
assert res.shape == (2,)
assert np.allclose(res, np.array([17.0, 39.0]))
def test_guvectorize_dynamic_compilation():
@guvectorize('(n)->()')
def gu_mean(a, out):
s = 0.0
for i in range(a.shape[0]):
s += a[i]
out[0] = s / a.shape[0]
arr = np.array([1.0, 2.0, 3.0, 4.0, 5.0], dtype=np.float64)
out_scalar = np.zeros(())
gu_mean(arr, out_scalar)
assert np.isclose(out_scalar, 3.0)
def test_guvectorize_type_error():
@guvectorize([(int64[:], int64[:], int64[:])], '(n),(n)->(n)')
def gu_int_add(a, b, out):
for i in range(a.shape[0]):
out[i] = a[i] + b[i]
try:
gu_int_add("invalid", "string")
assert False, "Should have raised TypeError"
except TypeError as e:
assert isinstance(e, TypeError)
def main():
test_guvectorize_explicit_signatures()
test_guvectorize_reduction_layout()
test_guvectorize_matrix_vector()
test_guvectorize_dynamic_compilation()
test_guvectorize_type_error()
print("All guvectorize contract assertions passed.")
if __name__ == "__main__":
main()
Ursprungs-Seeder
anonym