[petsc-users] Load a Sparse Matrix from a MAT file in PETSC

Matthew Knepley knepley at gmail.com
Fri Jun 10 17:14:07 CDT 2022


On Fri, Jun 10, 2022 at 3:59 PM NILTON SANTOS VALDIVIA <
100442268 at alumnos.uc3m.es> wrote:

> Hello Matthew,
>
> Thank you very much for your answer. What I'm trying to do is to solve a
> linear system using the A and b (matrix and vector) provided in
> https://sparse.tamu.edu/FEMLAB/waveguide3D (no matter if its a .mat or a
> .mtx file) and also I want to solve the system with multiple MPI processes,
> I'm not an expert on it, just starting to understand the procedure. I'd
> really appreciate if you could help me with this exercise.
>

I would:

  1) Download the Matrix Market format

  2) Use Mat test ex72 to read that matrix + vector and output them in
PETSc binary format

  3) Use KSP ex10 to read the PETSc binary format and test your solver

  Thanks,

     Matt


> Best Regards,
>
> NILTON SANTOS
>
>
> El vie, 10 jun 2022 a las 19:57, Matthew Knepley (<knepley at gmail.com>)
> escribió:
>
>> On Fri, Jun 10, 2022 at 1:15 PM NILTON SANTOS VALDIVIA <
>> 100442268 at alumnos.uc3m.es> wrote:
>>
>>> Hello,
>>>
>>> I was trying to load a sparse matrix from a .MAT file  (and solve the
>>> linear system). But even though, I have extracted  the A and b matrix and
>>> vector from this suite *https://sparse.tamu.edu/FEMLAB/waveguide3D
>>> <https://sparse.tamu.edu/FEMLAB/waveguide3D>* and saved the variables
>>> (A, b) in a MAT file as PETSC recommends, I couldn't be able to load the
>>> matrix. Is there something that I was doing wrong? or do you know a way to
>>> load a matrix  from the above link?
>>>
>>> Actually I was using src/ksp/ksp/tutorials/ex10.c.html
>>> <https://petsc.org/main/src/ksp/ksp/tutorials/ex10.c.html> example to
>>> try to load a .MAT file (containing A and b) without success.
>>>
>>
>> Do you want to load a Matrix Market format matrix and vector? If so, this
>> is what https://petsc.org/main/src/mat/tests/ex72.c.html does.
>>
>>   Thanks,
>>
>>      Matt
>>
>>
>>>
>>> Best Regards,
>>>
>>> NILTON SANTOS
>>>
>>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220610/89cb6079/attachment-0001.html>


More information about the petsc-users mailing list