Reading a Sparse matrix in CRS format from a function to be used in parallel linear solvers
Matthew Knepley
knepley at gmail.com
Wed Jan 31 08:17:11 CST 2007
On 1/31/07, #DOMINIC DENVER JOHN CHANDAR# <DOMI0002 at ntu.edu.sg> wrote:
>
> Hi,
>
> I have a function which creates a sparse matrix following a certain
> eqn and returns a pointer to the row, column index and the value of a sparse
> matrix (CRS- form).
> i j val
> 1 1 1.0
> 2 2 1.0
> 2 3 -1.5..
> so on...
>
> The matrix *may not **have a definite pattern* like the one we see for
> tridiagonal or pentadiagonal matrices or the test cases (linear solvers)
> cited in the petsc documentation. Now, i would like to use the linear
> solvers in petsc to solve the system of equations. I do not want to write
> that sparse matrix into a file and read it into petsc since it may be
> huge.I would like to call that function from petsc and would return the
> pointer to i j and val and insert values of this sparse matrix using
> MatSetValues in parallel. How can I achieve this ?
>
We do not have CRS format as it is not a very space efficient format. Most
of our formats are row-oriented. I suggest
looking at the example for MatSetValues() and trying to rework the
discretization function to directly call this. Most
discretizations naturally generate row-by-row values or even blocks like
FEM. Even totally nustructured stuff from
economics is row-by-row.
Thanks,
Matt
Cheers,
> Dominic
>
--
One trouble is that despite this system, anyone who reads journals widely
and critically is forced to realize that there are scarcely any bars to
eventual
publication. There seems to be no study too fragmented, no hypothesis too
trivial, no literature citation too biased or too egotistical, no design too
warped, no methodology too bungled, no presentation of results too
inaccurate, too obscure, and too contradictory, no analysis too
self-serving,
no argument too circular, no conclusions too trifling or too unjustified,
and
no grammar and syntax too offensive for a paper to end up in print. --
Drummond Rennie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20070131/5baf07ec/attachment.htm>
More information about the petsc-users
mailing list