def convert_to_mosek(sdp):
import mosek<EOL>if sdp.complex_matrix:<EOL><INDENT>from .picos_utils import convert_to_picos<EOL>Problem = convert_to_picos(sdp).to_real()<EOL>Problem._make_mosek_instance()<EOL>task = Problem.msk_task<EOL>if sdp.verbose > <NUM_LIT:0>:<EOL><INDENT>task.set_Stream(mosek.streamtype.log, streamprinter)<EOL><DEDENT>return task<EOL><DEDENT>barci, barcj, barcval, barai, baraj, baraval =convert_to_mosek_matrix(sdp)<EOL>bkc = [mosek.boundkey.fx] * sdp.n_vars<EOL>blc = [-v for v in sdp.obj_facvar]<EOL>buc = [-v for v in sdp.obj_facvar]<EOL>env = mosek.Env()<EOL>task = env.Task(<NUM_LIT:0>, <NUM_LIT:0>)<EOL>if sdp.verbose > <NUM_LIT:0>:<EOL><INDENT>task.set_Stream(mosek.streamtype.log, streamprinter)<EOL><DEDENT>numvar = <NUM_LIT:0><EOL>numcon = len(bkc)<EOL>BARVARDIM = [sum(sdp.block_struct)]<EOL>task.appendvars(numvar)<EOL>task.appendcons(numcon)<EOL>task.appendbarvars(BARVARDIM)<EOL>for i in range(numcon):<EOL><INDENT>task.putconbound(i, bkc[i], blc[i], buc[i])<EOL><DEDENT>symc = task.appendsparsesymmat(BARVARDIM[<NUM_LIT:0>], barci, barcj, barcval)<EOL>task.putbarcj(<NUM_LIT:0>, [symc], [<NUM_LIT:1.0>])<EOL>for i in range(len(barai)):<EOL><INDENT>syma = task.appendsparsesymmat(BARVARDIM[<NUM_LIT:0>], barai[i], baraj[i],<EOL>baraval[i])<EOL>task.putbaraij(i, <NUM_LIT:0>, [syma], [<NUM_LIT:1.0>])<EOL><DEDENT>task.putobjsense(mosek.objsense.minimize)<EOL>return task<EOL>
Convert an SDP relaxation to a MOSEK task.

    :param sdp: The SDP relaxation to convert.
    :type sdp: :class:`ncpol2sdpa.sdp`.

    :returns: :class:`mosek.Task`.