Skip to content

Commit 46793d4

Browse files
committed
adds explicit mention that relative residual norm is defined with respect to |b|
1 parent 1e5665f commit 46793d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/iterative.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,9 @@ int IterativeSolver(const enum iter method_in,const enum incpol which)
15191519
* D - symmetric interaction matrix of Green's tensor
15201520
* we solve system (I+S.D.S).(S.x)=(S.b), S=sqrt(C), then total interaction matrix is symmetric and
15211521
* Jacobi-preconditioned for any distribution of refractive index.
1522+
*
1523+
* Relative residual is defined by dividing by the norm of the righ-hand-side, i.e. |S.Einc|. This is more robust,
1524+
* when various non-zero initial guesses are used.
15221525
*/
15231526
/* p=b=(S.Einc) is right part of the linear system; used only here. In iteration methods themselves p is completely
15241527
* different vector. To avoid confusion this is done before any other initializations, specific to iterative solvers
@@ -1528,7 +1531,7 @@ int IterativeSolver(const enum iter method_in,const enum incpol which)
15281531
matvec_ready=false; // can be set to true only in CalcInitField (if !load_chpoint)
15291532
if (!load_chpoint) {
15301533
nMult_mat(pvec,Einc,cc_sqrt);
1531-
temp=nNorm2(pvec,&Timing_InitIterComm); // |r_0|^2 when x_0=0
1534+
temp=nNorm2(pvec,&Timing_InitIterComm); // |S.Einc|^2, but also equal to |r_0|^2 when x_0=0
15321535
resid_scale=1/temp;
15331536
epsB=iter_eps*iter_eps*temp;
15341537
// Calculate initial field

0 commit comments

Comments
 (0)