nodes: 0, module; 1, function_definition; 2, function_name:sparse_svd; 3, parameters; 4, block; 5, identifier:sparse_matrix; 6, identifier:num_values; 7, identifier:max_iter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, return_statement; 14, comment:"""Wrapper around SciPy's Singular Value Decomposition for sparse matrices.
  
    Args:
      sparse_matrix: a SciPy sparse matrix (typically large).
      num_values: the number of largest singular values to compute.
      max_iter: maximum number of iterations (>= 0) in the decomposition. If
        max_iter is None, runs FLAGS.max_iter_sparse_svd steps. If max_iter == 0,
        runs until convergence. Otherwise will run max_iter steps.
  
    Returns:
      A (u, s, v) tuple where s is an array entailing the singular values,
        and (u, v) the singular vector matrices. u is column orthogonal and
        v is row orthogonal. s is sorted in increasing order.
    """; 15, comparison_operator:num_values <= 0; 16, block; 17, boolean_operator; 18, block; 19, comparison_operator:max_iter is None; 20, block; 21, elif_clause; 22, assignment; 23, tuple; 24, identifier:num_values; 25, integer:0; 26, raise_statement; 27, comparison_operator:max_iter is not None; 28, comparison_operator:max_iter < 0; 29, raise_statement; 30, identifier:max_iter; 31, None; 32, expression_statement; 33, not_operator; 34, block; 35, pattern_list; 36, call; 37, identifier:u; 38, identifier:s; 39, identifier:v; 40, call; 41, identifier:max_iter; 42, None; 43, identifier:max_iter; 44, integer:0; 45, call; 46, assignment; 47, identifier:max_iter; 48, expression_statement; 49, identifier:u; 50, identifier:s; 51, identifier:v; 52, attribute; 53, argument_list; 54, identifier:ValueError; 55, argument_list; 56, identifier:ValueError; 57, argument_list; 58, identifier:max_iter; 59, attribute; 60, assignment; 61, identifier:linalg; 62, identifier:svds; 63, identifier:sparse_matrix; 64, keyword_argument; 65, keyword_argument; 66, keyword_argument; 67, binary_operator:"num_values should be > 0 but instead is %d." % num_values; 68, binary_operator:"max_iter should be >= 0 but instead is %d." % max_iter; 69, identifier:FLAGS; 70, identifier:max_iter_sparse_svd; 71, identifier:max_iter; 72, None; 73, identifier:k; 74, identifier:num_values; 75, identifier:maxiter; 76, identifier:max_iter; 77, identifier:return_singular_vectors; 78, True; 79, string:"num_values should be > 0 but instead is %d."; 80, identifier:num_values; 81, string:"max_iter should be >= 0 but instead is %d."; 82, identifier:max_iter
code: def sparse_svd(sparse_matrix, num_values, max_iter):
    """Wrapper around SciPy's Singular Value Decomposition for sparse matrices.
  
    Args:
      sparse_matrix: a SciPy sparse matrix (typically large).
      num_values: the number of largest singular values to compute.
      max_iter: maximum number of iterations (>= 0) in the decomposition. If
        max_iter is None, runs FLAGS.max_iter_sparse_svd steps. If max_iter == 0,
        runs until convergence. Otherwise will run max_iter steps.
  
    Returns:
      A (u, s, v) tuple where s is an array entailing the singular values,
        and (u, v) the singular vector matrices. u is column orthogonal and
        v is row orthogonal. s is sorted in increasing order.
    """
  
    if num_values <= 0:
      raise ValueError("num_values should be > 0 but instead is %d." % num_values)
  
    if max_iter is not None and max_iter < 0:
      raise ValueError("max_iter should be >= 0 but instead is %d." % max_iter)
  
    if max_iter is None:
      max_iter = FLAGS.max_iter_sparse_svd
    elif not max_iter:
      max_iter = None
  
    u, s, v = linalg.svds(
        sparse_matrix, k=num_values, maxiter=max_iter,
        return_singular_vectors=True)
  
    return (u, s, v)