function Mcell_out = mtransform(Mcell,x0,x1)
% function [Mcell_out] = mtransform(Mcell,phi0,phi1)
%
% Multiplicative transform: Given a Kraus map
%
% Mcell=[M1;
%        M2;
%       ...
%        Mk];
%
% and x1'x1=phi_1, x0'x0=phi_0
%
% Mcell_out= [ x1 Mi x0^(-1),
%              ...
[k,m]=size(Mcell); % here m is supposed to be 1
n=length(cell2mat(Mcell(1)));

M=cell2mat(Mcell);

M=kron(eye(k),x1)*M*inv(x0);
Mcell_out=mat2cell(M,n*ones(k,1),n);
end