Following is my minimization problem to solve for matrix D:
$$P=BDB^{T}$$
where dimension of $B$ is $576 \times 1296$ and dimension of $P$(unsymmetric) is $576\times 576$ and $D$ is a diagonal matrix of dimension $1296 \times 1296$.
To tackle this problem, I am doing the following:
Firstly, I used vector operation:
$$vec(P)= vec(BDB^T) = (B\otimes B)vec(D)$$
Since matrix D is diagonal, we can only choose columns of $B\otimes B$ corresponding to diagonal entries of matrix D.
When I try to implement this in Matlab, I ran into a memory problem. Can anyone help me fix this?
My matlab code looks like the following:
kronBB = kron(B,B); % kronecker product %
D = eye(size(B,2));
vecD = D(:);
in = find(vecD); % non-zero indices of vector D %
kronBB1 = kronBB(:,in) % Only keeping columns corresponding to the diagonal entries of matrix D ;
Error in matlab reads:
Requested 576x576x1296x1296 (4151.9GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information. Error in kron (line 34) K = reshape(A.*B,[ma*mb na*nb]);
Here is a Matlab program giving you what you call "kronBB1" under two forms : $U$ (direct, as you do) and $V$ (the way I advise) with my formula that I have inplemented as a set of Kronecker products of column vectors (that are still column vectors) without memory issues. This program checks that $U$ and $V$ are the same :