[petsc-users] Reading matrices into PETSc

Shri abhyshr at mcs.anl.gov
Wed Dec 22 03:41:21 CST 2010


Find attached a routine which reads matrix data from an ASCII file in i j value format and creates a seqaij matrix. 

----- Original Message -----


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? 

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. 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101222/0ddb21ee/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ReadMatFromFile.c
Type: text/x-csrc
Size: 2125 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101222/0ddb21ee/attachment-0001.c>


More information about the petsc-users mailing list