Efficient multiple matrix product

I have the following implementation:

dphii = mat2cell(dphii, 3, 3*ones(1,m)); % double
dpsi = mat2cell(dpsi, 3, 3*ones(1,m)); % cvx var
J = cellfun(@mtimes, dpsi, dphii, 'uni', 0);
J = [J{:}];

which I like to write more efficiently. multiprod package won’t work, since cvx doesn’t support bsxfun. Any suggestions?

I found a solution (copy-paste the link manually):


Cool! Thanks for sharing.