# PrecomputedSparseFunction

`PrecomputedSparseFunction(self, *args, **kwargs)`

Tensor symbol representing a sparse array in symbolic equations; unlike SparseFunction, PrecomputedSparseFunction uses externally-defined data for interpolation.

## Parameters

Name Type Description Default
`name` str Name of the symbol. required
`npoint` int Number of sparse points. required
`grid` Grid The computational domain from which the sparse points are sampled. required
`r` int Number of gridpoints in each Dimension to interpolate a single sparse point to. E.g. `r=2` for linear interpolation. required
`coordinates` np.ndarray The coordinates of each sparse point. required
`gridpoints` np.ndarray An array carrying the reference grid point corresponding to each sparse point. Of all the gridpoints that one sparse point would be interpolated to, this is the grid point closest to the origin, i.e. the one with the lowest value of each coordinate Dimension. Must be a two-dimensional array of shape `(npoint, grid.ndim)`. required
`interpolation_coeffs` np.ndarray An array containing the coefficient for each of the r^2 (2D) or r^3 (3D) gridpoints that each sparse point will be interpolated to. The coefficient is split across the n Dimensions such that the contribution of the point (i, j, k) will be multiplied by `interp_coeffs[..., i]*interp_coeffs[...,j]*interp_coeffs[...,k]`. So for `r=6`, we will store 18 coefficients per sparse point (instead of potentially 216). Must be a three-dimensional array of shape `(npoint, grid.ndim, r)`. required
`space_order` int Discretisation order for space derivatives. `0`
`shape` tuple of ints Shape of the object. `(npoint,)`
`dimensions` tuple of Dimension Dimensions associated with the object. Only necessary if the SparseFunction defines a multi-dimensional tensor. required
`dtype` data - type Any object that can be interpreted as a numpy data type. `np.float32`
`initializer` callable or any object exposing the buffer interface Data initializer. If a callable is provided, data is allocated lazily. required
`allocator` MemoryAllocator Controller for memory allocation. To be used, for example, when one wants to take advantage of the memory hierarchy in a NUMA architecture. Refer to `default_allocator.__doc__` for more information. required

## Notes

The parameters must always be given as keyword arguments, since SymPy uses `*args` to (re-)create the Dimension arguments of the symbolic object.

## Attributes

Name Description
interpolation_coeffs The Precomputed interpolation coefficients.
is_SparseFunction bool(x) -> bool