{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Some of the ord are not implemented because some associated functions like, _multi_svd_norm, are not yet available for sparse array."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This docstring is modified based on numpy.linalg.norm. https://github.com/numpy/numpy/blob/main/numpy/linalg/linalg.py"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The following norms can be calculated:"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "=====  ============================\nord    norm for sparse arrays\n=====  ============================\nNone   Frobenius norm\n'fro'  Frobenius norm\ninf    max(sum(abs(x), axis=1))\n-inf   min(sum(abs(x), axis=1))\n0      abs(x).sum(axis=axis)\n1      max(sum(abs(x), axis=0))\n-1     min(sum(abs(x), axis=0))\n2      Spectral norm (the largest singular value)\n-2     Not implemented\nother  Not implemented\n=====  ============================",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Frobenius norm is given by "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "InlineMath",
                  "__tag": 4057,
                  "value": "||A||_F = [\\sum_{i,j} abs(a_{i,j})^2]^{1/2}"
                }
              ]
            }
          ]
        }
      ],
      "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": "n",
              "annotation": "float or ndarray",
              "desc": []
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Norm of a sparse 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": "x",
              "annotation": "a sparse array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Input sparse array."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "ord",
              "annotation": "{non-zero int, inf, -inf, 'fro'}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Order of the norm (see table under "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Notes"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "). inf means numpy's "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "inf",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " object."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "{int, 2-tuple of ints, None}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an integer, it specifies the axis of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " along which to compute the vector norms.  If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a 2-tuple, it specifies the axes that hold 2-D matrices, and the matrix norms of these matrices are computed.  If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is None then either a vector norm (when "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is 1-D) or a matrix norm (when "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is 2-D) is returned."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function is able to return one of seven different matrix norms, depending on the value of the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "ord"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter."
            }
          ]
        }
      ],
      "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/_norm.py",
  "item_line": 20,
  "item_type": "function",
  "aliases": [
    "scipy.sparse.linalg.norm"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.sparse import csr_array, diags_array\nimport numpy as np\nfrom scipy.sparse.linalg import norm\na = np.arange(9) - 4\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "a\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "b = a.reshape((3, 3))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "b\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "b = csr_array(b)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "norm(b)\nnorm(b, 'fro')\nnorm(b, np.inf)\nnorm(b, -np.inf)\nnorm(b, 1)\nnorm(b, -1)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe matrix 2-norm or the spectral norm is the largest singular\nvalue, computed approximately and with limitations.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "b = diags_array([-1, 1], offsets=[0, 1], shape=(9, 10))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "norm(b, 2)\n",
        "execution_status": "failure"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "ord",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "norm"
  },
  "references": [
    ".. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*,",
    "    Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15"
  ],
  "qa": "scipy.sparse.linalg._norm:norm",
  "arbitrary": [],
  "local_refs": [
    "axis",
    "n",
    "ord",
    "x"
  ]
}