code: def dct_matrix(rows, cols, unitary=True):
      # TODO : need description for parameters
      """
      Return a (rows x cols) matrix implementing a discrete cosine transform.
  
      This algorithm is adapted from Dan Ellis' Rastmat spec2cep.m, lines 15-20.
  
      """
      rval = np.zeros((rows, cols))
      col_range = np.arange(cols)
      scale = np.sqrt(2.0 / cols)
      for i in xrange(rows):
          rval[i] = (
              np.cos(i * (col_range * 2 + 1) / (2.0 * cols) * np.pi)
              * scale
          )
  
      if unitary:
          rval[0] *= np.sqrt(0.5)
      return rval
  
file_path: Theano/theano/sandbox/fourier.py
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import numpy.fft
  from six.moves import xrange
  from theano import tensor
  from theano.gof import Op, Apply, generic
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: dct_matrix(rows, cols, unitary) and returns: rval