def read_sdpa_out(filename, solutionmatrix=False, status=False,<EOL>sdp=None):
primal = None<EOL>dual = None<EOL>x_mat = None<EOL>y_mat = None<EOL>status_string = None<EOL>with open(filename, '<STR_LIT:r>') as file_:<EOL><INDENT>for line in file_:<EOL><INDENT>if line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>primal = float((line.split())[<NUM_LIT:2>])<EOL><DEDENT>if line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>dual = float((line.split())[<NUM_LIT:2>])<EOL><DEDENT>if solutionmatrix:<EOL><INDENT>if line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>x_mat = parse_solution_matrix(file_)<EOL><DEDENT>if line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>y_mat = parse_solution_matrix(file_)<EOL><DEDENT><DEDENT>if line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>if line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>status_string = '<STR_LIT>'<EOL><DEDENT>elif line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>status_string = '<STR_LIT>'<EOL><DEDENT>elif line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>status_string = '<STR_LIT>'<EOL><DEDENT>elif line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>status_string = '<STR_LIT>'<EOL><DEDENT>elif line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>status_string = '<STR_LIT>'<EOL><DEDENT>elif line.find("<STR_LIT>") > -<NUM_LIT:1>:<EOL><INDENT>status_string = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>status_string = '<STR_LIT>'<EOL><DEDENT><DEDENT><DEDENT><DEDENT>for var in [primal, dual, status_string]:<EOL><INDENT>if var is None:<EOL><INDENT>status_string = '<STR_LIT>'<EOL>break<EOL><DEDENT><DEDENT>if solutionmatrix:<EOL><INDENT>for var in [x_mat, y_mat]:<EOL><INDENT>if var is None:<EOL><INDENT>status_string = '<STR_LIT>'<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if sdp is not None:<EOL><INDENT>sdp.primal = primal<EOL>sdp.dual = dual<EOL>sdp.x_mat = x_mat<EOL>sdp.y_mat = y_mat<EOL>sdp.status = status_string<EOL><DEDENT>if solutionmatrix and status:<EOL><INDENT>return primal, dual, x_mat, y_mat, status_string<EOL><DEDENT>elif solutionmatrix:<EOL><INDENT>return primal, dual, x_mat, y_mat<EOL><DEDENT>elif status:<EOL><INDENT>return primal, dual, status_string<EOL><DEDENT>else:<EOL><INDENT>return primal, dual<EOL><DEDENT>
Helper function to parse the output file of SDPA.

    :param filename: The name of the SDPA output file.
    :type filename: str.
    :param solutionmatrix: Optional parameter for retrieving the solution.
    :type solutionmatrix: bool.
    :param status: Optional parameter for retrieving the status.
    :type status: bool.
    :param sdp: Optional parameter to add the solution to a
                          relaxation.
    :type sdp: sdp.
    :returns: tuple of two floats and optionally two lists of `numpy.array` and
              a status string