{
  "__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": "",
              "annotation": "Array: integer array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An array of indices with the same shape as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x2"
                    },
                    {
                      "__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": "Find indices where elements should be inserted to maintain order."
            }
          ]
        }
      ],
      "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": "x1",
              "annotation": "Array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Input array. Should have a real-valued data type. Must be sorted in ascending order along the last axis."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "x2",
              "annotation": "Array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Array containing search values. Should have a real-valued data type. Must have the same shape as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " except along the last axis."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "side",
              "annotation": "{'left', 'right'}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Argument controlling which index is returned if an element of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is equal to one or more elements of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ": "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'left'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " returns the index of the first of these elements; "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'right'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " returns the next index after the last of these elements. Default: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'left'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "xp",
              "annotation": "array_namespace, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The standard-compatible namespace for the array arguments. Default: infer."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Find the indices into a sorted array "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " such that if the elements in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " were inserted before the indices, the resulting array would remain sorted."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The behavior of this function is similar to that of "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "array_api.searchsorted",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but it relaxes the requirement that "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "x1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " must be one-dimensional. This function is vectorized, treating slices along the last axis as elements and preceding axes as batch (or \"loop\") dimensions."
            }
          ]
        }
      ],
      "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/_external/array_api_extra/_delegation.py",
  "item_line": 636,
  "item_type": "function",
  "aliases": [
    "scipy.differentiate.xpx.searchsorted"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import array_api_strict as xp\nimport array_api_extra as xpx\nx = xp.asarray([11, 12, 13, 13, 14, 15])\nxpx.searchsorted(x, xp.asarray([10, 11.5, 14.5, 16]), xp=xp)\nxpx.searchsorted(x, xp.asarray(13), xp=xp)\nxpx.searchsorted(x, xp.asarray(13), side='right', xp=xp)\n",
        "execution_status": "unexpected_exception",
        "out": "Traceback (most recent call last):\n  File \"<doctest scipy._external.array_api_extra._delegation:searchsorted[0]>\", line 1, in <module>\n    xpx.searchsorted(x, xp.asarray(13), side='right', xp=xp)\n    ^^^\nNameError: name 'xpx' is not defined\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n`searchsorted` is vectorized along the last axis.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x1 = xp.asarray([[1., 2., 3., 4.], [5., 6., 7., 8.]])\nx2 = xp.asarray([[1.1, 3.3], [6.6, 8.8]])\nxpx.searchsorted(x1, x2, xp=xp)\n",
        "execution_status": "unexpected_exception",
        "out": "Traceback (most recent call last):\n  File \"<doctest scipy._external.array_api_extra._delegation:searchsorted[0]>\", line 1, in <module>\n    xpx.searchsorted(x1, x2, xp=xp)\n    ^^^\nNameError: name 'xpx' is not defined\n"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x1",
        "annotation": "Array",
        "kind": "POSITIONAL_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x2",
        "annotation": "Array",
        "kind": "POSITIONAL_ONLY",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "side",
        "annotation": "Literal['left', 'right']",
        "kind": "KEYWORD_ONLY",
        "default": "left"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "xp",
        "annotation": "ModuleType | None",
        "kind": "KEYWORD_ONLY",
        "default": "None"
      }
    ],
    "return_annotation": "Array",
    "target_name": "searchsorted"
  },
  "references": null,
  "qa": "scipy._external.array_api_extra._delegation:searchsorted",
  "arbitrary": [],
  "local_refs": [
    "side",
    "x1",
    "x2",
    "xp"
  ]
}