Description
xORBDB5 and xORBDB6 compute vector norms differently causing disagreement on when a vector is numerically zero.
Given an isometric matrix Q and a vector x, xORBDB5 computes a vector x' that is orthogonal to the span of the columns of Q. (Q isometric means that the following two properties hold: Q has at most as many columns as rows and Q^* Q = I). Internally xORBDB5 calls xORBDB6. Given an isometric matrix Q and a vector x, xORBDB6 projects x onto the complement of the column span of Q. The code contains only the ominous comment that
Kahan's "twice is enough" criterion
is applied. Probably this means that xORBDB6 uses at most two iterations of classical Gram-Schmidt orthogonalization to compute its results. This approach is known as CGS2, see BarlowS2011 or GiraudLR2002 and it matches the matrix-vector multiplications inside this function. The problem are the computation of the vector norm.
For a xORBDB5, the norm of the vector computed by xORBDB6 is computed with SNRM2:
|
IF( SNRM2(M1,X1,INCX1) .NE. ZERO |
|
$ .OR. SNRM2(M2,X2,INCX2) .NE. ZERO ) THEN |
|
RETURN |
|
END IF |
For xORBDB6, the vector norm is computed as follows:
|
SCL1 = REALZERO |
|
SSQ1 = REALONE |
|
CALL SLASSQ( M1, X1, INCX1, SCL1, SSQ1 ) |
|
SCL2 = REALZERO |
|
SSQ2 = REALONE |
|
CALL SLASSQ( M2, X2, INCX2, SCL2, SSQ2 ) |
|
NORMSQ2 = SCL1**2*SSQ1 + SCL2**2*SSQ2 |
Consider the input to xORBDB6 below:
c := 2^-45
μ := c ε
| 0 1 -μ |
Q = | 0 0 +μ |
| 1 0 0 |
| 0 μ 1 |
With x = e_2 (i.e., the second standard basis vector), the xORBDB6 variable NORMSQ2 is zero whereas SNRM2 is nonzero causing xORBDB5 to return an incorrect vector.
Checklist
Description
xORBDB5 and xORBDB6 compute vector norms differently causing disagreement on when a vector is numerically zero.
Given an isometric matrix
Qand a vectorx, xORBDB5 computes a vectorx'that is orthogonal to the span of the columns ofQ. (Qisometric means that the following two properties hold:Qhas at most as many columns as rows andQ^* Q = I). Internally xORBDB5 calls xORBDB6. Given an isometric matrixQand a vectorx, xORBDB6 projectsxonto the complement of the column span ofQ. The code contains only the ominous comment thatis applied. Probably this means that xORBDB6 uses at most two iterations of classical Gram-Schmidt orthogonalization to compute its results. This approach is known as CGS2, see BarlowS2011 or GiraudLR2002 and it matches the matrix-vector multiplications inside this function. The problem are the computation of the vector norm.
For a xORBDB5, the norm of the vector computed by xORBDB6 is computed with
SNRM2:lapack/SRC/sorbdb5.f
Lines 223 to 226 in 5d4180c
For xORBDB6, the vector norm is computed as follows:
lapack/SRC/sorbdb6.f
Lines 241 to 247 in 5d4180c
Consider the input to xORBDB6 below:
With
x = e_2(i.e., the second standard basis vector), the xORBDB6 variableNORMSQ2is zero whereasSNRM2is nonzero causing xORBDB5 to return an incorrect vector.Checklist