{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "524e59e1",
            "cell_type": "markdown",
            "source": "<div class='alert alert-warning'>\n\nSciPy's interactive examples with Jupyterlite are experimental and may not always work as expected. Execution of cells containing imports may result in large downloads (up to 60MB of content for the first import from SciPy). Load times when importing from SciPy may take roughly 10-20 seconds. If you notice any problems, feel free to open an [issue](https://github.com/scipy/scipy/issues/new/choose).\n\n</div>",
            "metadata": {}
        },
        {
            "id": "be4d5498",
            "cell_type": "markdown",
            "source": "In this example, a problem with a large sparse arrays and bounds on the\nvariables is solved.\n",
            "metadata": {}
        },
        {
            "id": "37ebbcb1",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.sparse import random_array\nfrom scipy.optimize import lsq_linear\nrng = np.random.default_rng()\n\nm = 2000\nn = 1000\n\nA = random_array((m, n), density=1e-4, random_state=rng)\nb = rng.standard_normal(m)\n\nlb = rng.standard_normal(n)\nub = lb + 1\n\nres = lsq_linear(A, b, bounds=(lb, ub), lsmr_tol='auto', verbose=1)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "The relative change of the cost function is less than `tol`.\nNumber of iterations 10, initial cost 1.0070e+03, final cost 9.6602e+02,\nfirst-order optimality 2.21e-09.        # may vary"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}