Sparse knonecker product of large and several matrices

Hi,
I'm trying to create a sparse kronecker product without actually generating the kron product and then generating the sparse matrix. Is there a way to do this? For example
E=eye(100);
I=ones(20);
K=sparse(kron(E,I));
Right now the code first generates the kron product and then keeps on the information of non-zero elements. As I need to do this lots of time because I need to generate and keep in memory different K matrices (K1, K2, ... K200, for E1,...E200, and I1,...I200), the generation of the kron product uses all my memory. Is there anyway I could go from the E's and I's to the K's without generating the full matrices?
Thanks,

 Risposta accettata

Matt J
Matt J il 26 Mar 2014
Modificato: Matt J il 26 Mar 2014
E=speye(100);
I=ones(20);
K=kron(E,I);

3 Commenti

I wonder if you even need K in any kind of matrix form, whether sparse or full. See this Kronecker product manipulation tool for an alternative
Below, I construct a KronProd operator Ko equivalent to your K matrix. Note the difference in memory consumption. Ko is less than 1 KB.
>> e=ones(20,1); Ko=KronProd({e,e.',1},1:3,[nan,nan,100]);
>> Whos K Ko
Name Size Kilobytes Class Attributes
K 2000x2000 641 double sparse
Ko 2000x2000 0.896 KronProd
Thanks, I'll look at this.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Sparse Matrices in Centro assistenza e File Exchange

Richiesto:

il 26 Mar 2014

Commentato:

il 26 Mar 2014

Community Treasure Hunt

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

Start Hunting!

Translated by