--- Final Solver (used for performance test) ---
import numpy as np
import numba as nb

class Solver:
    def __init__(self):
        # Precompile numba function for outer product
        @nb.njit(fastmath=True, cache=True)
        def numba_outer(a, b):
            n = len(a)
            m = len(b)
            out = np.empty((n, m), dtype=np.float64)
            for i in range(n):
                ai = a[i]
                for j in range(m):
                    out[i, j] = ai * b[j]
            return out
        self._numba_outer = numba_outer
        # Warmup with small vectors to trigger compilation
        a = np.array([1.0, 2.0])
        b = np.array([3.0, 4.0])
        self._numba_outer(a, b)
    
    def solve(self, problem, **kwargs):
        """Calculate outer product of two vectors."""
        vec1, vec2 = problem
        # Convert to float64 for consistent performance
        a = np.asarray(vec1, dtype=np.float64)
        b = np.asarray(vec2, dtype=np.float64)
        n = len(a)
        # Use numba for small and medium sizes (up to 2000)
        if n <= 2000:
            return self._numba_outer(a, b)
        else:
            # For large sizes, use np.outer
            return np.outer(a, b)
--- End Solver ---
Running performance test...
============================= test session starts ==============================
platform linux -- Python 3.12.13, pytest-9.0.2, pluggy-1.6.0
rootdir: /tests
plugins: anyio-4.13.0, jaxtyping-0.3.9
collected 3 items

../tests/test_outputs.py .
--- Performance Summary ---
Validity: True
Total Baseline Time: 6.5258s
Total Solver Time:   6.9344s
Raw Speedup:         0.9411 x
Final Reward (Score): 1.0000
---------------------------
.F

=================================== FAILURES ===================================
_____________________________ test_solver_speedup ______________________________

performance_results = {'raw_speedup': 0.9410837010681654, 'speedup': 1.0, 'validity': True}

    def test_solver_speedup(performance_results):
        """Checks if the solver effectively optimized the code."""
>       assert performance_results["raw_speedup"] > 1.0, \
            f"Solver was not faster than baseline (Speedup: {performance_results['raw_speedup']:.2f}x)"
E       AssertionError: Solver was not faster than baseline (Speedup: 0.94x)
E       assert 0.9410837010681654 > 1.0

/tests/test_outputs.py:205: AssertionError
==================================== PASSES ====================================
=========================== short test summary info ============================
PASSED ../tests/test_outputs.py::test_solver_exists
PASSED ../tests/test_outputs.py::test_solver_validity
FAILED ../tests/test_outputs.py::test_solver_speedup - AssertionError: Solver...
=================== 1 failed, 2 passed in 232.54s (0:03:52) ====================
