def _compute_cost_matrix(var_p: int, kernel_size: int) -> np.ndarray:
        """
        Compute the default cost matrix.

        :param var_p: The p-wasserstein distance.
        :param kernel_size: Kernel size for computing the cost matrix.
        :return: The cost matrix.
        """
        center = kernel_size // 2
        cost_matrix = np.zeros((kernel_size, kernel_size))

        for i in range(kernel_size):
            for j in range(kernel_size):
                # The code of the paper of this attack (https://arxiv.org/abs/1902.07906) implements the cost as:
                # cost_matrix[i, j] = (abs(i - center) ** 2 + abs(j - center) ** 2) ** (p / 2)
                # which only can reproduce L2-norm for p=1 correctly
                cost_matrix[i, j] = (abs(i - center) ** var_p + abs(j - center) ** var_p) ** (1 / var_p)

        return cost_matrix

        Compute the default cost matrix.

        :param var_p: The p-wasserstein distance.
        :param kernel_size: Kernel size for computing the cost matrix.
        :return: The cost matrix.
        
art/attacks/evasion/wasserstein.py