def _vector_or_scalar(x, type='row'):
 if isinstance(x, (list, tuple)):
  x = np.array(x)
 if isinstance(x, np.ndarray):
  assert (x.ndim == 1)
  if (type == 'column'):
   x = x[:, None]
 return x

def _vector_or_scalar ( x , type = 'row' ) : if isinstance ( x , ( list , tuple ) ) : x = np . array ( x ) if isinstance ( x , np . ndarray ) : assert ( x . ndim == 1 ) if ( type == 'column' ) : x = x [ : , None ] return x
convert an object to either a scalar or a row or column vector .