/* Copyright : Copyright (c) MOSEK ApS, Denmark. All rights reserved. File : sdo3.cs Purpose : Solves the semidefinite problem: min tr(X_1) + ... + tr(X_n) st. + ... + >= b_1 ... + ... + >= b_k where X_i are symmetric positive semidefinite of dimension d, A_ji are constant symmetric matrices and b_i are constant. This example is to demonstrate creating and using many matrix variables of the same dimension. */ using System; using mosek.fusion; namespace mosek.fusion.example { public class sdo3 { // A helper method computing a semidefinite slice of a 3-dim variable public static Variable Slice(Variable X, int d, int j) { return X.Slice(new int[] {j,0,0}, new int[] {j+1,d,d}) .Reshape(new int[] {d,d}); } public static void Main(string[] args) { // Sample input data int n = 100; int d = 4; int k = 3; double[] b = {9,10,11}; double[][,] A = new double[n*k][,]; var rand = new Random(); for(int i=0; i 1e-6) { Console.WriteLine("X" + j + "="); for(int s1=0; s1