def getWeightsFromIds(weights, kernelIds):
    """Get the weights corresponding to the provided indices.

    .. note:: The kernel indices are assumed to start with 1 instead of 0.
        This is because we use sparse matrices to represent kernel ids,
        which would remove zero-based ids. This method subtracts 1 from the
        kernel indices for proper indexing of the weight matrix.

    :param np.ndarray weights: Array of weight values.
    :param np.ndarray kernelIds: Array of indices.
    :return: Array of weights.
    :rtype: np.ndarray
    """

    return weights[kernelIds - 1]