def convert_to_mosek_matrix(sdp):
barci = []<EOL>barcj = []<EOL>barcval = []<EOL>barai = []<EOL>baraj = []<EOL>baraval = []<EOL>for k in range(sdp.n_vars):<EOL><INDENT>barai.append([])<EOL>baraj.append([])<EOL>baraval.append([])<EOL><DEDENT>row_offsets = [<NUM_LIT:0>]<EOL>block_offsets = [<NUM_LIT:0>]<EOL>cumulative_sum = <NUM_LIT:0><EOL>cumulative_square_sum = <NUM_LIT:0><EOL>for block_size in sdp.block_struct:<EOL><INDENT>cumulative_sum += block_size<EOL>cumulative_square_sum += block_size ** <NUM_LIT:2><EOL>row_offsets.append(cumulative_square_sum)<EOL>block_offsets.append(cumulative_sum)<EOL><DEDENT>for row in range(len(sdp.F.rows)):<EOL><INDENT>if len(sdp.F.rows[row]) > <NUM_LIT:0>:<EOL><INDENT>col_index = <NUM_LIT:0><EOL>for k in sdp.F.rows[row]:<EOL><INDENT>value = sdp.F.data[row][col_index]<EOL>i, j = convert_to_mosek_index(sdp.block_struct,<EOL>row_offsets, block_offsets, row)<EOL>if k > <NUM_LIT:0>:<EOL><INDENT>barai[k - <NUM_LIT:1>].append(i)<EOL>baraj[k - <NUM_LIT:1>].append(j)<EOL>baraval[k - <NUM_LIT:1>].append(-value)<EOL><DEDENT>else:<EOL><INDENT>barci.append(i)<EOL>barcj.append(j)<EOL>barcval.append(value)<EOL><DEDENT>col_index += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return barci, barcj, barcval, barai, baraj, baraval<EOL>
Converts the entire sparse representation of the Fi constraint matrices
    to sparse MOSEK matrices.