import torch


def get_kernel(data: torch.Tensor, kernel_type='linear') -> torch.Tensor:
  """Gives linear kernel needed in the dual mode.

  Arguments:
    data: torch.Tensor, one of the two views (sample x feature).
    kernel_type: str, 'linear' by default but other kernels can be implemented.

  Returns:
    kernel: torch.Tensor, linear kernel of one of the two views
      (sample x sample).
  """
  if kernel_type == 'linear':
    kernel = torch.matmul(data, data.T)
  else:
    raise NotImplementedError(f'{kernel_type} kernel is not supported yet.')
  return kernel