Binary Matrix read problem

Barry Smith bsmith at
Fri Oct 9 18:14:32 CDT 2009

    If you are using ./configure with --with-64-bit-indices this could  
happen since Matlab has its ints as 32 bit. To load the matrix from  
Matlab you need
to not using --with-64-bit-indices with configure.

    This could also happen if you built PETSc with complex numbers. It  
can only read binary files from Matlab with real numbers.


On Oct 9, 2009, at 2:19 PM, Umut Tabak wrote:

> Dear all,
> I upgraded to petsc-3.0.0-p8 a couple of minutes ago, but I had a  
> problem with reading binary matrices written from matlab. I get
> [0]PETSC ERROR: Read from file failed!
> [0]PETSC ERROR: Read past end of file!
> I have a 64 bit system, did I miss sth in the configuration, I  
> checked the installation page again, but could not see the reason of  
> the problem. My codes worked fine before with patch level 4. In ddd  
> I get the error from MatLoad below:
> ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD, "K.bin",  
> FILE_MODE_READ, &view );  CHKERRQ(ierr);
> ierr = MatLoad(view, MATSEQAIJ, &K ); CHKERRQ(ierr);
> (as expected).
> Thanks for the pointers in advance.
> Umut

More information about the petsc-users mailing list