<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div><br></div><div>It seems that <br></div><div><span><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><em>MatZeroRows(mat,numRows,rows,diag,<strong>NULL</strong>,<strong>NULL</strong>)</em></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span data-mce-bogus="true">also works.<br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span data-mce-bogus="true"><br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span data-mce-bogus="true">Is it better to pass NULL instead of 0?<br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span data-mce-bogus="true"><br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;" data-mce-style="font-family: times new roman,new york,times,serif;"><span data-mce-bogus="true">Cédric<br></span></span></span></span></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Cedric Doucet" <cedric.doucet@inria.fr><br><b>À: </b>petsc-users@mcs.anl.gov<br><b>Envoyé: </b>Mercredi 13 Août 2014 10:09:40<br><b>Objet: </b>[petsc-users] Optional arguments of MatZeroRows<br><div><br></div><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Hello,<br></div><div><br></div><div>I want to use MatZeroRows function (<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatZeroRows.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatZeroRows.html</a>).<br></div><div><br></div><div>It is said in the documentation that the last two arguments are optional, i.e. x and b vectors:</div><div><em><span style="font-family: times new roman,new york,times,serif;">PetscErrorCode  MatZeroRows(Mat mat,PetscInt numRows,const PetscInt rows[],PetscScalar diag,<strong>Vec x</strong>,<strong>Vec</strong></span></em><span style="font-family: times new roman,new york,times,serif;"><strong> b</strong></span><span style="font-family: times new roman,new york,times,serif;">)</span></div><div><span><span style="font-family: times new roman,new york,times,serif;">However, a call to </span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><em>MatZeroRows(mat,numRows,rows,diag)</em> </span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;">does not seem to work because the last two input arguments are required.<br></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><br></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;">In examples, e.g. <a href="http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex3.c.html" target="_blank">src/ksp/ksp/examples/tutorials/ex3.c.html</a>, it seems that optional arguments are passed by putting some zero values instead of vectors:<br></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><em>MatZeroRows(mat,numRows,rows,diag,<strong>0</strong>,<strong>0</strong>)</em></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span><br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span>Is this the right way to use MatZeroRows function when one does not want to pass x and b vectors as input arguments?</span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span><br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span>Best,<br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span><br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span>Cédric<br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span><br></span></span></span></span></div><div><span><span style="font-family: times new roman,new york,times,serif;"><span style="font-family: times new roman,new york,times,serif;"><span><br></span></span></span></span></div></div></blockquote><div><br></div></div></body></html>