<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1465220133106_28280">I am learning petsc and using the following code to insert values into my matrix:</div><div id="yui_3_16_0_ym19_1_1465220133106_28298"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1465220133106_28299">ierr = MatSetValue(A, row, col, value,INSERT_VALUES);<br id="yui_3_16_0_ym19_1_1465220133106_28304">ierr = MatSetValue(A, col, row, value,INSERT_VALUES);<br id="yui_3_16_0_ym19_1_1465220133106_28305"></div><div id="yui_3_16_0_ym19_1_1465220133106_28339" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1465220133106_28327" dir="ltr">Since my matrix is symmetric, I want to speed things up only calling MatSetValue once. I tried setting: <br></div><div id="yui_3_16_0_ym19_1_1465220133106_28341" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1465220133106_28371" dir="ltr"> ierr = MatSetOption(A,MAT_SYMMETRIC,PETSC_TRUE);<br id="yui_3_16_0_ym19_1_1465220133106_28344"></div><div id="yui_3_16_0_ym19_1_1465220133106_28372" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1465220133106_28374" dir="ltr">However, whenver I solve Ax=b, I get a wrong solution for x ( almost all zeroes ). I am guessing MAT_SYMMETRIC is not automatically creating the lower triangular matrix from the upper triangular matrix?<br></div><div id="yui_3_16_0_ym19_1_1465220133106_28382" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1465220133106_28328" dir="ltr"><br></div></div></body></html>