Partial trace over symbolic matrix

2 views (last 30 days)
I want to perform the partial trace over a symbolic matrix that contains fractions , for example:
N_sym=sym(1/32*eye(8));
Which is:
N_sym =
[ 1/32, 0, 0, 0, 0, 0, 0, 0]
[ 0, 1/32, 0, 0, 0, 0, 0, 0]
[ 0, 0, 1/32, 0, 0, 0, 0, 0]
[ 0, 0, 0, 1/32, 0, 0, 0, 0]
[ 0, 0, 0, 0, 1/32, 0, 0, 0]
[ 0, 0, 0, 0, 0, 1/32, 0, 0]
[ 0, 0, 0, 0, 0, 0, 1/32, 0]
[ 0, 0, 0, 0, 0, 0, 0, 1/32]
So my code would be
N_sym=sym(1/32*eye(8));
sys=[1,2]; % Defines the subsystems that I want to trace out
dims=2*[1 1 1]; % Defines the dimensions of each subsystem
PartialTrace(N_sym,sys,dims) % A function in Qetlab (http://www.qetlab.com/PartialTrace)
and I get the following message:
Error using symengine
Arguments must be 2-dimensional.
Error in sym/privUnaryOp (line 1019)
Csym = mupadmex(op,args{1}.s,varargin{:});
Error in sym/sum (line 55)
s = privUnaryOp(A, 'symobj::prodsumdim', num2str(dim), '_plus');
Error in PartialTrace (line 93) % If you click on "(line 93)" the source code will pop-up
Xpt = sum(Xpt(:,:,1:sub_sys_vec(1)+1:sub_sys_vec(1)^2),3);
Seems that there is some problem with the fact that I (partially) trace a symbolic matrix, although in the source code (see comment on the code above in order to see the source code) seems to be considering the case of a non-numeric matrix... Let me know if something needs to be clarified more!
Any ideas how to make it work? Any hint will be of great help!!
Thanks!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!