{"task": {"agent_timeout": 1800, "task": "scicode-16", "verifier_timeout": 1800, "instruction": "# SciCode Problem 16\n\nWrite a script to generate a symmetric matrix with increasing values (starting from 1 and increasing by 1) along its diagonal and then implement the Davidson's method for finding the first few lowest eigenvalues of this matrix. When generating the matrix, the user should be able to specify the dimension of the matrix. All elements in the matrix should be modified based on the product of a normally distributed random number generated by numpy and an input given by the user. When solving for the eigenvalues, the user should be able to specify the convergence threshold and the number of eigenvalues to be solved for.\n\n'''\nInputs:\n- matrixA: Symmetric matrix (2D array of float).\n- num_eigenvalues: Number of lowest eigenvalues to compute (int).\n- threshold: Convergence threshold for the algorithm (float).\n\nOutput:\n- current_eigenvalues: computed eigenvalues (1D array of float).\n'''\n\n## Required Dependencies\n\n```python\nimport math\nimport numpy as np\n```\n\nYou must implement 2 functions sequentially. Each step builds on previous steps. Write ALL functions in a single file `/app/solution.py`.\n\n## Step 1 (Step ID: 16.1)\n\nWrite a function to generate a symmetric matrix with increasing values along its diagonal.  All elements in the matrix should be modified based on the product of a normally distributed random number generated by numpy and an input given by the user. Symmetrize the matrix by taking the average of the sum of the matrix and its tranpose.\n\n### Function to Implement\n\n```python\ndef init_matrix(dim, noise):\n    '''Generate a symmetric matrix with increasing values along its diagonal.\n    Inputs:\n    - dim: The dimension of the matrix (int).\n    - noise: Noise level (float).\n    Output:\n    - A: a 2D array where each element is a float, representing the symmetric matrix.\n    '''\n\nreturn A\n```\n\n---\n\n## Step 2 (Step ID: 16.2)\n\nWrite a function to implement the Davidson's method. The user should be able to set the convergence threshold and the number of eigenvalues to be solved.\n\n### Function to Implement\n\n```python\ndef davidson_solver(matrixA, num_eigenvalues, threshold):\n    '''Implements the Davidson algorithm to compute the first few eigenvalues of a symmetric matrix.\n    Inputs:\n    - matrixA: Symmetric matrix (2D array of float).\n    - num_eigenvalues: Number of lowest eigenvalues to compute (int).\n    - threshold: Convergence threshold for the algorithm (float).\n    Output:\n    - current_eigenvalues: computed eigenvalues (1D array of float).\n    '''\n\nreturn current_eigenvalues\n```\n\n---\n\n## Instructions\n\n1. Create `/app/solution.py` containing ALL functions above.\n2. Include the required dependencies at the top of your file.\n3. Each function must match the provided header exactly (same name, same parameters).\n4. Later steps may call functions from earlier steps \u2014 ensure they are all in the same file.\n5. Do NOT include test code, example usage, or __main__ blocks.\n", "memory": "", "runnable": false, "difficulty": "hard", "language": "", "cpus": "", "instruction_truncated": false, "category": "scientific_computing", "compose": true, "has_solution": true, "oracle": null, "docker_image": "", "taskset": "scicode", "tags": ["scicode", "scientific-computing", "python"]}, "runs": []}