{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "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": "k",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Rank required to achieve specified relative precision if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "eps_or_k < 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "idx",
              "annotation": ":class:`numpy.ndarray`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Column index array."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "proj",
              "annotation": ":class:`numpy.ndarray`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Interpolation coefficients."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute ID 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": ":class:`numpy.ndarray` or :class:`scipy.sparse.linalg.LinearOperator` with `rmatvec`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Matrix to be factored"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "eps_or_k",
              "annotation": "float or int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Relative error (if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "eps_or_k < 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") or rank (if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "eps_or_k >= 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ") of approximation."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rand",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Whether to use random sampling if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "A"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is of type "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.ndarray",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "*",
                        "kind": "api",
                        "path": "numpy:ndarray"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (randomized algorithms are always used if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "A"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is of type "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "scipy.sparse.linalg.LinearOperator",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "scipy",
                        "version": "*",
                        "kind": "api",
                        "path": "scipy.sparse.linalg._interface:LinearOperator"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ")."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rng",
              "annotation": "`numpy.random.Generator`, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Pseudorandom number generator state. When "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rng"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is None, a new "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.random.Generator",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "*",
                        "kind": "api",
                        "path": "numpy.random._generator:Generator"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is created using entropy from the operating system. Types other than "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.random.Generator",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "*",
                        "kind": "api",
                        "path": "numpy.random._generator:Generator"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are passed to "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.random.default_rng",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "*",
                        "kind": "api",
                        "path": "numpy.random:default_rng"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to instantiate a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Generator"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rand"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "False"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the argument is ignored."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "An ID of a matrix "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "A"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a factorization defined by a rank "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "k",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "k"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", a column index array "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "idx",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "idx"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and interpolation coefficients "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "proj",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "proj"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " such that      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "numpy.dot(A[:,idx[:k]], proj) = A[:,idx[k:]]",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The original matrix can then be reconstructed as      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "numpy.hstack([A[:,idx[:k]],\n                            numpy.dot(A[:,idx[:k]], proj)]\n                        )[:,numpy.argsort(idx)]",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "or via the routine "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "reconstruct_matrix_from_id",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.linalg.interpolative:reconstruct_matrix_from_id"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". This can equivalently be written as      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "numpy.dot(A[:,idx[:k]],\n                    numpy.hstack([numpy.eye(k), proj])\n                  )[:,np.argsort(idx)]",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "in terms of the skeleton and interpolation matrices      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "B = A[:,idx[:k]]",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "and      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "P = numpy.hstack([numpy.eye(k), proj])[:,np.argsort(idx)]",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "respectively. See also "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "reconstruct_interp_matrix",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.linalg.interpolative:reconstruct_interp_matrix"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "reconstruct_skel_matrix",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.linalg.interpolative:reconstruct_skel_matrix"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The ID can be computed to any relative precision or rank (depending on the value of "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "eps_or_k"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "). If a precision is specified ("
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "eps_or_k < 1",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), then this function has the output signature      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "k, idx, proj = interp_decomp(A, eps_or_k)",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Otherwise, if a rank is specified ("
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "eps_or_k >= 1",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), then the output signature is      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "idx, proj = interp_decomp(A, eps_or_k)",
          "execution_status": null
        }
      ],
      "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/linalg/interpolative.py",
  "item_line": 403,
  "item_type": "function",
  "aliases": [
    "scipy.linalg.interpolative.interp_decomp"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "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": "eps_or_k",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rand",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "True"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rng",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "interp_decomp"
  },
  "references": null,
  "qa": "scipy.linalg.interpolative:interp_decomp",
  "arbitrary": [],
  "local_refs": [
    "A",
    "eps_or_k",
    "idx",
    "k",
    "proj",
    "rand",
    "rng"
  ]
}