def _dct(x, type, n=None, axis=(-1), overwrite_x=False, normalize=None):
 (x0, n, copy_made) = __fix_shape(x, n, axis, 'DCT')
 if ((type == 1) and (n < 2)):
  raise ValueError('DCT-I is not defined for size < 2')
 overwrite_x = (overwrite_x or copy_made)
 nm = _get_norm_mode(normalize)
 if np.iscomplexobj(x0):
  return (_raw_dct(x0.real, type, n, axis, nm, overwrite_x) + (1j * _raw_dct(x0.imag, type, n, axis, nm, overwrite_x)))
 else:
  return _raw_dct(x0, type, n, axis, nm, overwrite_x)

def _dct ( x , type , n = None , axis = ( - 1 ) , overwrite_x = False , normalize = None ) : ( x0 , n , copy_made ) = __fix_shape ( x , n , axis , 'DCT' ) if ( ( type == 1 ) and ( n < 2 ) ) : raise ValueError ( 'DCT-I is not defined for size < 2' ) overwrite_x = ( overwrite_x or copy_made ) nm = _get_norm_mode ( normalize ) if np . iscomplexobj ( x0 ) : return ( _raw_dct ( x0 . real , type , n , axis , nm , overwrite_x ) + ( 1j * _raw_dct ( x0 . imag , type , n , axis , nm , overwrite_x ) ) ) else : return _raw_dct ( x0 , type , n , axis , nm , overwrite_x )
return discrete cosine transform of arbitrary type sequence x .