{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For solving the matrix expression AX = B, this solver assumes the resulting matrix X is sparse, as is often the case for very sparse inputs.  If the resulting X is dense, the construction of this sparse result will be relatively expensive.  In that case, consider converting A to a dense matrix and using scipy.linalg.solve or its variants."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "x",
              "annotation": "ndarray or sparse array or matrix",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "the solution of the sparse linear equation. If b is a vector, then x is a vector of size A.shape[1] If b is a matrix, then x is a matrix of size (A.shape[1], b.shape[1])"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Solve the sparse linear system Ax=b, where b may be a vector or a matrix."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "A",
              "annotation": "ndarray or sparse array or matrix",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The square matrix A will be converted into CSC or CSR form"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "b",
              "annotation": "ndarray or sparse array or matrix",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The matrix or vector representing the right hand side of the equation. If a vector, b.shape must be (n,) or (n, 1)."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "permc_spec",
              "annotation": "str, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "How to permute the columns of the matrix for sparsity preservation. (default: 'COLAMD')"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "NATURAL"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": natural ordering."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "MMD_ATA"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": minimum degree ordering on the structure of A^T A."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "MMD_AT_PLUS_A"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": minimum degree ordering on the structure of A^T+A."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "COLAMD"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": approximate minimum degree column ordering "
                            },
                            {
                              "__type": "FootnoteReference",
                              "__tag": 4066,
                              "label": "1"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", "
                            },
                            {
                              "__type": "FootnoteReference",
                              "__tag": 4066,
                              "label": "2"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "use_umfpack",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "if True (default) then use UMFPACK for the solution "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "3"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "4"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "5"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "6"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " . This is only referenced if b is a vector and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "scikits.umfpack"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is installed."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/sparse/linalg/_dsolve/linsolve.py",
  "item_line": 134,
  "item_type": "function",
  "aliases": [
    "scipy.sparse.linalg.spsolve"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.sparse import csc_array\nfrom scipy.sparse.linalg import spsolve\nA = csc_array([[3, 2, 0], [1, -1, 0], [0, 5, 1]], dtype=float)\nB = csc_array([[2, 0], [-1, 0], [2, 0]], dtype=float)\nx = spsolve(A, B)\nnp.allclose(A.dot(x).toarray(), B.toarray())\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "A",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "b",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "permc_spec",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "use_umfpack",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "True"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "spsolve"
  },
  "references": [
    ".. [1] T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, Algorithm 836:",
    "       COLAMD, an approximate column minimum degree ordering algorithm,",
    "       ACM Trans. on Mathematical Software, 30(3), 2004, pp. 377--380.",
    "       :doi:`10.1145/1024074.1024080`",
    "",
    ".. [2] T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, A column approximate",
    "       minimum degree ordering algorithm, ACM Trans. on Mathematical",
    "       Software, 30(3), 2004, pp. 353--376. :doi:`10.1145/1024074.1024079`",
    "",
    ".. [3] T. A. Davis, Algorithm 832:  UMFPACK - an unsymmetric-pattern",
    "       multifrontal method with a column pre-ordering strategy, ACM",
    "       Trans. on Mathematical Software, 30(2), 2004, pp. 196--199.",
    "       https://dl.acm.org/doi/abs/10.1145/992200.992206",
    "",
    ".. [4] T. A. Davis, A column pre-ordering strategy for the",
    "       unsymmetric-pattern multifrontal method, ACM Trans.",
    "       on Mathematical Software, 30(2), 2004, pp. 165--195.",
    "       https://dl.acm.org/doi/abs/10.1145/992200.992205",
    "",
    ".. [5] T. A. Davis and I. S. Duff, A combined unifrontal/multifrontal",
    "       method for unsymmetric sparse matrices, ACM Trans. on",
    "       Mathematical Software, 25(1), 1999, pp. 1--19.",
    "       https://doi.org/10.1145/305658.287640",
    "",
    ".. [6] T. A. Davis and I. S. Duff, An unsymmetric-pattern multifrontal",
    "       method for sparse LU factorization, SIAM J. Matrix Analysis and",
    "       Computations, 18(1), 1997, pp. 140--158.",
    "       https://doi.org/10.1137/S0895479894246905T."
  ],
  "qa": "scipy.sparse.linalg._dsolve.linsolve:spsolve",
  "arbitrary": [],
  "local_refs": [
    "A",
    "b",
    "permc_spec",
    "use_umfpack",
    "x"
  ]
}