问题遇到的现象和发生背景
The error description is as follows:
Error using full request 68813x68813 (35.3GB) array to exceed the preset maximum array size Creating an array larger than this limit can take a long time and result in no response from MATLAB for more information, see Array Size Limits or Default Items panel.
Error schurmat_sblk (line 35) if issparse(schur); schur = full(schur); end;
The function file schurmat_sblk is a file in cvx\sdpt3\Solver,
我的矩阵是有结构的,稀疏/低秩,还有别的解决方案吗?
问题相关代码,请勿粘贴截图
The value you may need are: n=8; d=2^n;m=(d^2)0.05;the size of Pauli is md^2, it's a sparse matrix. The size of y is m*1;
function [rhoE] = test_compressed_cc(n,~,m,Pauli,y)
d = 2^n;
cvx_begin sdp quiet
% how to define the variable ?
variable rhoE(d,d) hermitian;
rhoE == hermitian_semidefinite(d);
% ||x||_tr=tr(sqrt(x^\daggerx))=tr(sqrt(x^2))=Tr(x)
minimize(trace(rhoE));
subject to
(d/m)*(Pauli * vec(rhoE)) == y;
rhoE >= 0;
cvx_end
end
运行结果及报错内容
内存不足。
出错 schurmat_sblk (line 35)
if issparse(schur); schur = full(schur); end;
出错 HKMpred (line 60)
schur = schurmat_sblk(blk,At,par,schur,p,X,par.Zinv);
出错 sqlpmain (line 342)
HKMpred(blk,At,par,rp,Rd,sigmu,X,Z,invZchol);
出错 sqlp (line 242)
sqlpmain(blk3,At3,C3,b,par,parbarrier3,X03,y0,Z03);
出错 cvx_run_solver (line 50)
[ varargout{1:nargout} ] = sfunc( inputs{:} );
出错 cvx_sdpt3>solve (line 362)
[ obj, xx, y, zz, info ] = cvx_run_solver( @sqlp, blk, Avec, Cvec, b, OPTIONS, 'obj', 'x', 'y', 'z',
'info', settings, 5 ); %#ok
出错 cvxprob/solve (line 429)
[ x, status, tprec, iters, y ] = shim.solve( At, b, c, cones, quiet, prec, solv.settings,
eargs{:} );
出错 cvx_end (line 88)
solve( prob );
出错 Solve_CC_rhoE (line 22)
cvx_end
出错 test_8q_m (line 48)
[rhoE,noiseE] = Solve_CC_rhoE(n,r,m,s,Pauli,y,noiseT);
我的解答思路和尝试过的方法
尝试修改 cvx包里的 schurmat_sblk 文件,可以保存,但似乎运行会出问题,看不懂文件的代码;用足够大内存的服务器运行出现同样报错,不知道原因何在。
我想要达到的结果
代码能够顺利运行,解决内存不足问题