--- Final Solver (used for performance test) ---
from typing import Any
import numpy as np


class Solver:
    def solve(self, problem: tuple[np.ndarray, np.ndarray], **kwargs: Any) -> np.ndarray:
        """Compute the outer product of two 1-D vectors."""
        vec1, vec2 = problem

        # Avoid conversion overhead when the harness already passes ndarrays.
        if not isinstance(vec1, np.ndarray):
            vec1 = np.asarray(vec1)
        if not isinstance(vec2, np.ndarray):
            vec2 = np.asarray(vec2)

        n = vec1.shape[0]

        # Empirically, broadcasting is fastest for tiny and very large vectors,
        # while einsum without optimization overhead is fastest for mid sizes.
        if n < 128 or n > 2048:
            return vec1[:, None] * vec2
        return np.einsum("i,j->ij", vec1, vec2, optimize=False)
--- 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.4695s
Total Solver Time:   6.8692s
Raw Speedup:         0.9418 x
Final Reward (Score): 1.0000
---------------------------
.F

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

performance_results = {'raw_speedup': 0.9418035284068564, '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.9418035284068564 > 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 239.43s (0:03:59) ====================
