Question: Efficiently parsing a Maple sparse matrix to Matlab

Hi everybody, I have a rather large code in Maple for my research which needs fast eigensolving for large sparse matrices, thus, I am using the Matlab link to parse my matrices and get them eigensolved in Matlab. The problem is that, I am unable to directly parse a Maple sparse matrix to a Matlab sparse matrix which substantially slows down the calculation.

This is the best I can do so far:

 

> H:=Matrix(5000,5000,shape=symmetric,storage=sparse,datatype=float[8]):
>Matlab[setvar]("H",H):
>Matlab[evalM]("H2=sparse(H); [evv,ev]:=eigs(H2,10,'sa')"):

 

The problem is the second line, the matrix H is converted to a full matrix in Matlab which is slow and won't work for larger matrices. I tried defining H in Matlab to be sparse before parsing the Maple matrix but still won't work.

Any ideas guys?

p.s. I also thought of decomposing the Maple sparse matrix into 3 vectors containing the indices and non-zero values and then parsing those to Matlab and rebuilding the sparse matrix but I think it would be as slow as the code above.

Please Wait...