Sdp Code is Working too slow. How can I make it faster

My matrix P is here:

I know my matrix is too big but I have to solve it. However, when I run the code, I am waiting too much and I cannot see the result because generally it just crashes. How can I make it faster?
Here is my code

    function [G,B] = DI_PP2(P_exp,k)
d = size(P_exp,1); 
m = size(P_exp,3); 


variable P(d,d,m,m,d);
dual variables T{d,d,m,m} lambda
for e=1:d
  for b=1:d

 minimize (-G)

 subject to

 for e=1:d   

 for x=1:m
     for y=1:m
         for a=1:d
             for b=1:d
squeeze(sum(P(a,b,x,y,:),5))==P_exp(a,b,x,y) : T{a,b,x,y};

sum(sum(sum(P(:,:,:,:,:),1),2),5)==1 : lambda;


Can you show us the solver and CVX output? how much of the time is before solver output starts vs. after solver output starts?

The thing is that the program just starts and then I didnt see it can finish yet
But I changed the parameter k so now it is working … still I am uncomfortable with that

Given that you haven’t provided a reproducible problem, your chances of getting useful advice would improve if you provided the specific information I suggested.

You asked me the time. But for saying how long it take, first I should see once program run and finish. However when I start to run the code, code never finished and I just waited and waited and I didnt see it was completed/finished
So I notice that, I gave k=2 as an input to the program and I changed it as 1 this time it finished

Perhaps you can show us the CVX and solver output? We are not mind readers.

After writing this scripts to the comman line
[G,B] = DI_PP2(P_exp,2)
I pressed enter and I did not see anything. How can I show you the solver output in that case. In the screen nothing was written. For seeing something I waited 10 min and again I did not see anything. There was not an output to show to you I just saw a white screen
But thank you very much for your interest

You just answered my first question. What are the dimensions (values of d and m) of your variables? It sounds like CVX is still doing its modeling (transformations), and has not even called the solver yet.

Can you try running your model with very small values of d and m, and see what happens?

The obvious thing to try to do is to eliminate as many levels of for loop as you can. You currently have a quadruple for loop. If you can vectorize to not have any for loops, that should be the fastest for CVX modeling (transformation) time. If you can partially vectorize, and get it do a single, double, or even triple for loop, that should still improve the CVX modeling time.

The topic title says "“Sdp Coide”. But I don’t see any SDP (semidefinite) constraints in your program.

Thank you very much !
For smaller m and d it is working perfectly. And the think is that I am now looking for a generalization formula for n dimension so I have to solve it with real d and m value and yeah I will eliminate something…
Regarding to constraints I have this line
sum(sum(sum(P(:,:,:,:,:),1),2),5)==1 : lambda;
But should I put other constraints ?
Many thanks…

But should I put other constraints ?

I have no idea what your optimization model is supposed to be, so I don’t know what constraints it should have.