The result is an \(m\) by \(n\) matrix where the \((i,j)\)'th
  entry is the \(d\)-dimensional Fourier basis function with
  frequency \(k_i\) evaluated at the point \(x_j\), i.e.,
  $$
    \frac{1}{\sqrt{|W|}}
    \exp(2\pi i \sum{l=1}^d k_{i,l} x_{j,l}/L_l)
  $$
  where \(L_l\), \(l=1,...,d\) are the box side lengths
  and \(|W|\) is the volume of the 
  domain (window/box). Note that the algorithm does not check whether
  the coordinates given in x are contained in the given box.
  Actually the box is only used to determine the side lengths and volume of the
  domain for normalization.
  
The stripped down faster version fourierbasisraw doesn't do checking or
  conversion of arguments and requires x and k to be matrices.