{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function is essentially equivalent to the following: given an N-dimensional vector "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x = (x1, x2, ..., xN)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", iterate over the dimensions, form linear combinations of products, B(x1) * B(x2) * ... B(xN) of (k+1)**N b-splines which are non-zero at "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Since b-splines are localized, the sum has (k+1)**N non-zero elements."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "i = (i1, i2, ..., iN)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a vector if intervals of the knot vectors, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "t[d, id] <= xd < t[d, id+1]"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d=1, 2, ..., N"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", then the core loop of this function is nothing but"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "``` result = 0 iters = [range(i[d] - self.k[d], i[d] + 1) for d in range(ndim)] for idx in itertools.product(*iters):     term = self.c[idx] * np.prod([B(x[d], self.k[d], idx[d], self.t[d])                                   for d in range(ndim)])     result += term ```"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For efficiency reasons, we iterate over the flattened versions of the arrays."
            }
          ]
        }
      ],
      "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": "out",
              "annotation": "ndarray, shape (npoints, num_c_tr)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Output values of the b-spline at given "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "xi"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " points."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Evaluate an N-dim tensor product spline or its derivative."
            }
          ]
        }
      ],
      "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": "xi",
              "annotation": "ndarray, shape(npoints, ndim)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "npoints"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " values to evaluate the spline at, each value is a point in an "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ndim"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-dimensional space."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "t",
              "annotation": "ndarray, shape(ndim, max_len_t)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Array of knots for each dimension. This array packs the tuple of knot arrays per dimension into a single 2D array. The array is ragged (knot lengths may differ), hence the real knots in dimension "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "d"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "t[d, :len_t[d]]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "len_t",
              "annotation": "ndarray, 1D, shape (ndim,)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Lengths of the knot arrays, per dimension."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "k",
              "annotation": "tuple of ints, len(ndim)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Spline degrees in each dimension."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "nu",
              "annotation": "ndarray of ints, shape(ndim,)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Orders of derivatives to compute, per dimension."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "extrapolate",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Whether to extrapolate out of bounds or return nans."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "c1r: ndarray, one-dimensional",
              "annotation": "",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Flattened array of coefficients. The original N-dimensional coefficient array "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " has shape "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n1, ..., nd, ...)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " where each "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ni == len(t[d]) - k[d] - 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and the second '...' represents trailing dimensions of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". In code, given the C-ordered array "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c1r"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c1 = c.reshape(c.shape[:ndim] + (-1,)); c1r = c1.ravel()"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "num_c_tr",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The number of elements of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c1r"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", which correspond to the trailing dimensions of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". In code, this is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c1 = c.reshape(c.shape[:ndim] + (-1,)); num_c_tr = c1.shape[-1]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "strides_c1",
              "annotation": "ndarray, one-dimensional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Pre-computed strides of the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array. Note: These are "
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "data"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " strides, not numpy-style byte strides. This array is equivalent to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "[stride // s1.dtype.itemsize for stride in s1.strides]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "indices_k1d",
              "annotation": "ndarray, shape((k+1)**ndim, ndim)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Pre-computed mapping between indices for iterating over a flattened array of shape "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "[k[d] + 1) for d in range(ndim)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and ndim-dimensional indices of the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(k+1,)*ndim"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " dimensional array. This is essentially a transposed version of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "np.unravel_index(np.arange((k+1)**ndim), (k+1,)*ndim)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "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": null,
  "item_line": null,
  "item_type": "built-in",
  "aliases": [
    "scipy.interpolate._dierckx.evaluate_ndbspline"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "scipy.interpolate._dierckx:evaluate_ndbspline",
  "arbitrary": [],
  "local_refs": [
    "c1r: ndarray",
    "extrapolate",
    "indices_k1d",
    "k",
    "len_t",
    "nu",
    "num_c_tr",
    "one-dimensional",
    "out",
    "strides_c1",
    "t",
    "xi"
  ]
}