<div dir="ltr"><div dir="ltr"><div>Hi, <br><br></div>If I have a linear time dependent equation I'm trying to solve using TS, I can use :<br>TSSetProblemType(ts,TS_LINEAR);<br>TSSetRHSFunction(ts,NULL,TSComputeRHSFunctionLinear,NULL);<br>TSSetRHSJacobian(ts,A,A,YourComputeRHSJacobian, &appctx); <br><br></div><div>If the matrix that's being evaluated by YourComputeRHSJacobian is such that the non-zero structure stays the same and only the diagonal changes with time, is there a way to optimize the function so that it doesn't create the whole matrix from scratch each time ? <br><br></div><div>Naively I can make a dummy matrix and store the copy from t=0 and change the diagonal at each iteration but that unnecessarily doubles the memory consumption, is there a better way? <br> </div><div dir="ltr"><br clear="all"><div><div><br></div><div>Thank You,<br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div style="font-size:12.8px">Sajid Ali<br></div><div style="font-size:12.8px">Applied Physics<br></div><div style="font-size:12.8px">Northwestern University</div></div></div></div></div></div></div>