def diag_mat(operator):
 size = (operator.size[0], 1)
 return lo.LinOp(lo.DIAG_MAT, size, [operator], None)

def diag_mat ( operator ) : size = ( operator . size [ 0 ] , 1 ) return lo . LinOp ( lo . DIAG_MAT , size , [ operator ] , None )
converts the diagonal of a matrix to a vector .