def updown_linear_approx(eigvals_lower, eigvals_upper, nv):
nal = len(eigvals_lower)<EOL>nau = len(eigvals_upper)<EOL>if nv < nal + nau:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(nal, nau, nv))<EOL><DEDENT>ret = np.zeros(nv)<EOL>ret[:nal] = eigvals_lower<EOL>ret[-nau:] = eigvals_upper<EOL>ret[nal-<NUM_LIT:1>:-nau+<NUM_LIT:1>] = np.linspace(eigvals_lower[-<NUM_LIT:1>], eigvals_upper[<NUM_LIT:0>], nv-nal-nau+<NUM_LIT:2>)<EOL>return ret<EOL>
Approximates Laplacian spectrum using upper and lower parts of the eigenspectrum.

Parameters
----------
eigvals_lower : numpy.ndarray
    Lower part of the spectrum, sorted
eigvals_upper : numpy.ndarray
    Upper part of the spectrum, sorted
nv : int
    Total number of nodes (eigenvalues) in the graph.

Returns
-------
numpy.ndarray
    Vector of approximated eigenvalues

Examples
--------
>>> updown_linear_approx([1, 2, 3], [7, 8, 9], 9)
array([1,  2,  3,  4,  5,  6,  7,  8,  9])