{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "reference:sparse.spmatrix_api",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "SciPy 2-D sparse matrix interface for numeric data."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "warning",
          "base_type": "warning",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "warning "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "The SciPy sparse package is switching to an array interface, compatible with NumPy arrays, from the older numpy.matrix interface.  We recommend that you use the array objects ("
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "csr_array",
                  "reference": {
                    "__type": "LocalRef",
                    "__tag": 4022,
                    "kind": "module",
                    "path": "scipy.sparse._csr:csr_array"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "coo_array",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", etc.)."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "When using the array interface, please note that:"
                }
              ]
            },
            {
              "__type": "BulletList",
              "__tag": 4053,
              "ordered": false,
              "start": 1,
              "children": [
                {
                  "__type": "ListItem",
                  "__tag": 4054,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "x * y"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " performs element-wise multiplication (just like NumPy arrays).   To make code work with both arrays and matrices, use "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "x @ y"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " for   matrix multiplication."
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "ListItem",
                  "__tag": 4054,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Operations, like "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "sum"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": ", produce np.matrix for spmatrix while they produce   np.array for sparray. Multiplication of np.matrix and np.array   differ in the same way as between spmatrix and sparray."
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "ListItem",
                  "__tag": 4054,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Sparse arrays use array style "
                        },
                        {
                          "__type": "Emphasis",
                          "__tag": 4047,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "slicing"
                            }
                          ]
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " operations, returning scalars,   or 1D or 2D sparse arrays according to the numpy standards for indexing.   If you need always 2D results, use an appropriate index with sparse arrays.   For example, "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "A[:, i, None]"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " or "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "A[:, [i]]"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "The construction utilities ("
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "eye",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "kron",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "random",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "random",
                    "version": "?",
                    "kind": "module",
                    "path": "random"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "diags",
                  "reference": {
                    "__type": "LocalRef",
                    "__tag": 4022,
                    "kind": "module",
                    "path": "scipy.sparse._construct:diags"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", etc.) have appropriate replacements (see "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "sparse-construction-functions",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ")."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "For more information see "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "Migration from spmatrix to sparray",
                  "reference": {
                    "__type": "LocalRef",
                    "__tag": 4022,
                    "kind": "docs",
                    "path": "reference:sparse.migration_to_sparray"
                  },
                  "kind": "exists"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Sparse Matrix Legacy Interface ("
        },
        {
          "__type": "CrossRef",
          "__tag": 4002,
          "value": "scipy.sparse",
          "reference": {
            "__type": "LocalRef",
            "__tag": 4022,
            "kind": "module",
            "path": "scipy.sparse"
          },
          "kind": "module"
        },
        {
          "__type": "Text",
          "__tag": 4046,
          "value": ")"
        }
      ],
      "level": 0,
      "target": "spmatrix_api"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    bsr_matrix - Block Sparse Row matrix\n    coo_matrix - A sparse matrix in COOrdinate format\n    csc_matrix - Compressed Sparse Column matrix\n    csr_matrix - Compressed Sparse Row matrix\n    dia_matrix - Sparse matrix with DIAgonal storage\n    dok_matrix - Dictionary Of Keys based sparse matrix\n    lil_matrix - Row-based list of lists sparse matrix\n    spmatrix - Sparse matrix base class",
          "execution_status": null,
          "out": ""
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Sparse matrix classes"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    eye - Sparse MxN matrix whose k-th diagonal is all ones\n    identity - Identity matrix in sparse matrix format\n    diags - Return a sparse matrix from diagonals\n    spdiags - Return a sparse matrix from diagonals\n    bmat - Build a sparse matrix from sparse sub-blocks\n    random - Random values in a given shape matrix\n    rand - Random values in a given shape matrix (old interface)",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "To combine matrices use the same functions as for"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "combining-arrays",
              "domain": null,
              "role": "ref",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Building sparse matrices"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Table",
          "__tag": 4065,
          "children": [
            {
              "__type": "TableRow",
              "__tag": 4068,
              "header": false,
              "children": [
                {
                  "__type": "TableCell",
                  "__tag": 4069,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "CrossRef",
                          "__tag": 4002,
                          "value": "issparse",
                          "reference": {
                            "__type": "RefInfo",
                            "__tag": 4000,
                            "module": "scipy",
                            "version": "?",
                            "kind": "module",
                            "path": "scipy._lib._sparse:issparse"
                          },
                          "kind": "module"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "(x)"
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "TableCell",
                  "__tag": 4069,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Check if the argument is a sparse object (array or matrix)."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "TableRow",
              "__tag": 4068,
              "header": false,
              "children": [
                {
                  "__type": "TableCell",
                  "__tag": 4069,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "CrossRef",
                          "__tag": 4002,
                          "value": "isspmatrix",
                          "reference": {
                            "__type": "RefInfo",
                            "__tag": 4000,
                            "module": "scipy",
                            "version": "?",
                            "kind": "module",
                            "path": "scipy.sparse._base:isspmatrix"
                          },
                          "kind": "module"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "(x)"
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "TableCell",
                  "__tag": 4069,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Check if the argument is an old style sparse matrix."
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    isspmatrix_csc\n    isspmatrix_csr\n    isspmatrix_bsr\n    isspmatrix_lil\n    isspmatrix_dok\n    isspmatrix_coo\n    isspmatrix_dia",
          "execution_status": null,
          "out": ""
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Identifying sparse matrices"
        }
      ],
      "level": 2,
      "target": null
    }
  ],
  "local_refs": []
}