[petsc-users] Reading matrices into PETSc

Barry Smith bsmith at mcs.anl.gov
Wed Dec 22 08:09:33 CST 2010


On Dec 22, 2010, at 1:56 AM, Gaurish Telang wrote:

> I am sorry, but I am not yet clear on how to do this. I read ex32.c and ex72.c but I am still confused. What is ASCII 'slap' format? How should  matrix be supplied to PETSc? 

  You will need to modify one of those examples slightly to read in the exact format of the ASCII file that you have. The names of the various formats doesn't matter, you just need to match the reading in of the ASCII file to the exact format of your file.

   Barry

> 
> My matrix is a 2000x1900 matrix given in the format MATLAB stores sparse matrices. i.e    [row, column, non-zero-entry] format.
> 
> 
> 
> On Tue, Dec 21, 2010 at 11:03 PM, Gaurish Telang <gaurish108 at gmail.com> wrote:
> i have this large text file containing a matrix. 
>  
> This text file contains the non-zero entries of a very large sparse matrix
>  
> 
> The first two columns indicate the position of the non-zero entry
>   
> and the last column the actual non-zero value it self
>  
> 
> for 
> example the matrix 
>   
> 1 0 8
>   
> 0 0 5
>   
> 6 0 0
>   
> is written in the text file in the form of
>   
> 1 1 1
>   
> 1 3 8
>  
> 2 3 5
>   
> 3 1 6
> 
> This is the standard  [(row ,column),  non-zero] entry format. 
> i want PETSc to load this matrix
>   
> from the text file
>   
> i am not sure how
>   
> to do that. What commands do I use?  
> 
> I am new to PETSc, so some detail in the explanation will be really helpful.
> 
> Sincere thanks,
> 
> Gaurish.  
> 



More information about the petsc-users mailing list