<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def linear(self, **paircoords):
 """ Linearize bin indices. This function is called by subclasses. Refer to the source code of :py:class:`RBinning` for an example. Parameters args : list a list of bin index, (xi, yi, zi, ..) Returns ------- linearlized bin index """

        N = len(paircoords[list(paircoords.keys())[0]])
        integer = numpy.empty(N, ('i8', (self.Ndim,))).T

        # do each dimension
        for i, dim in enumerate(self.dims):

            if self.spacing[i] == 'linspace':
                x = paircoords[dim] - self.min[i]
                integer[i] = numpy.ceil(x * self.inv[i])

            elif self.spacing[i] == 'logspace':
                x = paircoords[dim].copy()
                x[x == 0] = self.min[i] * 0.9
                x = numpy.log10(x / self.min[i])
                integer[i] = numpy.ceil(x * self.inv[i])

            elif self.spacing[i] is None:
                edge = self.edges if self.Ndim == 1 else self.edges[i]
                integer[i] = numpy.searchsorted(edge, paircoords[dim], side='left')

        return numpy.ravel_multi_index(integer, self.shape, mode='clip')