[petsc-users] MatMult method

Medane TCHAKOROM medane.tchakorom at univ-fcomte.fr
Thu Mar 31 09:10:54 CDT 2022


Hello,

I got one issue with MatMult method that I do not understand.

Whenever I multiply Matrix A by vector b (as shown below), the printed 
result

show a value with an exponent that is far away form the expected result. 
So I did the same

Matrix-vector product in python and get the expected answer (shown below).

Can someone please explain what is going on, cause I need the exact 
results in order to compute the norm.


Thanks


*Matrix A*

Mat Object: 1 MPI processes
   type: seqaij
row 0: (0, 4.)  (1, -1.)  (4, -1.)
row 1: (0, -1.)  (1, 4.)  (2, -1.)  (5, -1.)
row 2: (1, -1.)  (2, 4.)  (3, -1.)  (6, -1.)
row 3: (2, -1.)  (3, 4.)  (7, -1.)
row 4: (0, -1.)  (4, 4.)  (5, -1.)  (8, -1.)
row 5: (1, -1.)  (4, -1.)  (5, 4.)  (6, -1.)  (9, -1.)
row 6: (2, -1.)  (5, -1.)  (6, 4.)  (7, -1.)  (10, -1.)
row 7: (3, -1.)  (6, -1.)  (7, 4.)  (11, -1.)


*Vector b*


Vec Object: 1 MPI processes
   type: seq
0.998617
0.997763
0.997763
0.998617
0.996705
0.994672
0.994672
0.996705
0.993529
0.989549
0.989549
0.993529
0.997285
0.995611
0.995611
0.997285


*PETSc Results with : MatMult (A,x, some_vector_to_store_the_result)*

Vec Object: 1 MPI processes
   type: seq
2.
1.
1.
2.
1.
0.
*1.11022e-16*
1.



*Python result:*

[ 2. 0.999999 0.999999 2. 0.990577 -0.015165 -0.015165 0.990577]






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220331/c9e43a75/attachment.html>


More information about the petsc-users mailing list