def sum(self, axis=None, target = None):
        """
        Sum the matrix along the given dimension, where 0 represents the leading
        dimension and 1 represents the non-leading dimension. If None, the sum
        of all elements is returned. If a target is not prvided, a new vector is
        created for storing the result.
        """
        if axis is None:
          return vdot(self, CUDAMatrix.ones.slice(0, self.shape[0]*self.shape[1]))
        else:
          return sum(self, axis, target)

        Sum the matrix along the given dimension, where 0 represents the leading
        dimension and 1 represents the non-leading dimension. If None, the sum
        of all elements is returned. If a target is not prvided, a new vector is
        created for storing the result.
        
cudamat/cudamat.py