[SciPy-user] Cannot handle sparse matrices, yet.

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed Oct 15 09:16:57 EDT 2003


>>>>> "Nils" == Nils Wagner <nwagner at mecha.uni-stuttgart.de> writes:

    Nils> k0r = real(full(k00)) k0i = imag(full(k00))

    Nils> and save them as two real matrices

    Nils> save -v4 -mat k0r save -v4 -mat k0i

    Nils> I obtain the same message as before

matfile handles the sparse->full case and complex matrices.

  >> S = sparse(zeros(100,100));
  >> M = full(S);
  >> M(1,1) = 3+j;
  >> save full.mat M

Then 

    >>> import Numeric
    >>> import matfile
    >>> d = matfile.load('full.mat')
    >>> M = d['M']
    >>> print M.shape, M[0,0]
    (100, 100) (3+1j)


JDH



More information about the SciPy-User mailing list