nodes: 0, module; 1, function_definition; 2, function_name:msvd; 3, parameters; 4, block; 5, identifier:m; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# reverse the n first columns of u; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, comment:"""Modified singular value decomposition.
  
    Returns U, S, V where Udagger M V = diag(S) and the singular values
    are sorted in ascending order (small to large).
    """; 15, assignment; 16, assignment; 17, assignment; 18, assignment; 19, assignment; 20, expression_list; 21, pattern_list; 22, call; 23, identifier:order; 24, call; 25, identifier:s; 26, subscript; 27, identifier:u; 28, subscript; 29, identifier:vdgr; 30, subscript; 31, identifier:u; 32, identifier:s; 33, attribute; 34, identifier:u; 35, identifier:s; 36, identifier:vdgr; 37, attribute; 38, argument_list; 39, attribute; 40, argument_list; 41, identifier:s; 42, identifier:order; 43, identifier:u; 44, slice; 45, identifier:order; 46, identifier:vdgr; 47, identifier:order; 48, call; 49, identifier:T; 50, attribute; 51, identifier:svd; 52, identifier:m; 53, identifier:s; 54, identifier:argsort; 55, attribute; 56, argument_list; 57, identifier:np; 58, identifier:linalg; 59, identifier:vdgr; 60, identifier:conj
code: def msvd(m):
    """Modified singular value decomposition.
  
    Returns U, S, V where Udagger M V = diag(S) and the singular values
    are sorted in ascending order (small to large).
    """
    u, s, vdgr = np.linalg.svd(m)
    order = s.argsort()
    # reverse the n first columns of u
    s = s[order]
    u= u[:,order]
    vdgr = vdgr[order]
    return u, s, vdgr.conj().T