def diag_vec(operator):
 size = (operator.size[0], operator.size[0])
 return lo.LinOp(lo.DIAG_VEC, size, [operator], None)

def diag_vec ( operator ) : size = ( operator . size [ 0 ] , operator . size [ 0 ] ) return lo . LinOp ( lo . DIAG_VEC , size , [ operator ] , None )
converts a vector to a diagonal matrix .