{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The pseudo-inverse of a matrix A, denoted "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "A^+"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", is defined as: \"the matrix that 'solves' [the least-squares problem] "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "Ax = b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ",\" i.e., if "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\bar{x}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is said solution, then "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "A^+"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is that matrix such that "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\bar{x} = A^+b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "It can be shown that if "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "Q_1 \\Sigma Q_2^T = A"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the singular value decomposition of A, then "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "A^+ = Q_2 \\Sigma^+ Q_1^T"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "Q_{1,2}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are orthogonal matrices, "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\Sigma"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a diagonal matrix consisting of A's so-called singular values, (followed, typically, by zeros), and then "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\Sigma^+"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is simply the diagonal matrix consisting of the reciprocals of A's singular values (again, followed by zeros). "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "LinAlgError",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If the SVD computation does not converge."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "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": "B",
              "annotation": "(..., N, M) ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The pseudo-inverse of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "matrix",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "numpy:matrix"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " instance, then so is "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "B",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "B"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the (Moore-Penrose) pseudo-inverse of 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": "(..., M, N) array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Matrix or stack of matrices to be pseudo-inverted."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rcond",
              "annotation": "(...) array_like of float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Cutoff for small singular values. Singular values less than or equal to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rcond * largest_singular_value"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are set to zero. Broadcasts against the stack of matrices. Default: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1e-15"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "hermitian",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If True, "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is assumed to be Hermitian (symmetric if real-valued), enabling a more efficient method for finding singular values. Defaults to False."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rtol",
              "annotation": "(...) array_like of float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Same as "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rcond"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", but it's an Array API compatible parameter name. Only "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rcond"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rtol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be set at a time. If none of them are provided then NumPy's "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1e-15"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " default is used. If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rtol=None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is passed then the API standard default is used."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 2.0.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Calculate the generalized inverse of a matrix using its singular-value decomposition (SVD) and including all "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "large"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " singular values."
            }
          ]
        }
      ],
      "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": "/numpy/linalg/_linalg.py",
  "item_line": 2153,
  "item_type": "_ArrayFunctionDispatcher",
  "aliases": [
    "numpy.linalg.pinv"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "The following example checks that ``a * a+ * a == a`` and\n``a+ * a * a+ == a+``:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nrng = np.random.default_rng()\na = rng.normal(size=(9, 6))\nB = np.linalg.pinv(a)\nnp.allclose(a, np.dot(a, np.dot(B, a)))\nnp.allclose(B, np.dot(B, np.dot(a, B)))\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.linalg.pinv",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "scipy.linalg.pinv"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Similar function in SciPy."
            }
          ]
        }
      ],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "scipy.linalg.pinvh",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "scipy.linalg.pinvh"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the (Moore-Penrose) pseudo-inverse of a Hermitian matrix."
            }
          ]
        }
      ],
      "type": null
    }
  ],
  "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": "rcond",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "hermitian",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rtol",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "<no value>"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "pinv"
  },
  "references": [
    ".. [1] G. Strang, *Linear Algebra and Its Applications*, 2nd Ed., Orlando,",
    "       FL, Academic Press, Inc., 1980, pp. 139-142."
  ],
  "qa": "numpy.linalg:pinv",
  "arbitrary": [],
  "local_refs": [
    "B",
    "a",
    "hermitian",
    "rcond",
    "rtol"
  ]
}