With a modest amount of random testing on a work station, it is possible
to detect the loss of orthogonality caused by the old early termination
criterion.
Do not assume that the vector x passed to these subroutines has
Euclidean norm one (the norm is almost surely smaller than one when
xORBDB5/xUNBDB5 calls this subroutine for the first time).
This commit fixes the occasional inaccurate results computed by
xORCSD2BY1/xUNCSD2BY1.
The commits listed below updated xORBDB6/xUNBDB6 with the aim of
improving numerical stability by avoiding the use of squared values.
With the exception of SORBDB6 these commits did not properly up a magic
constant called `ALPHA` in the code. SORBDB6 was initially updated
correctly before commit a015b21445
inserted an incorrect value again.
The incorrect magic constant may lead to early returns with only
partially orthogonalized output vectors.
Relevant commits:
* 54b3964b0f
* 6479e0f531
* 94419e8bfa
* Require unit-norm vector X for otherwise the following computations
might underflow
* Avoid over- and underflows in the computation of the Euclidean norm of
X
* Fix the Euclidean norm computation after the second Gram-Schmidt
iteration
* Consider round-off errors when checking for zero vectors
* Update identifiers
Note that the caller DORBDB5 always passed unit-norm vectors X.
This is really old school, but a lot of times we have users sending us
copy pasting of codes, and that is the only way to know the version of
the code.
This is mostly a long term maintenance improvement.
Many coding styles require elimination of trailing whitespace, and
many editors and source code management configurations automatically
gobble up whitespace. When these tools gobble up whitespace, it
complicates reviewing the meaningful code changes.
By removing whitespace on one patch, it makes future
code reviews much easier.
=SCRIPT====================================================================
if which tempfile &>/dev/null; then
TEMPMAKER=tempfile
elif which mktemp &>/dev/null; then
TEMPMAKER=mktemp
else
echo "Cannot find tempfile program." 2>&1
exit 1
fi
MYTEMP=$($TEMPMAKER)
trap 'rm -f $MYTEMP' SIGINT SIGTERM
stripit() {
echo "stripping $1"
sed 's/[ \t]*$//' "$1" > $MYTEMP
cp $MYTEMP "$1"
}
if [ $# -gt 0 ]; then
while [ "$1" != "" ]; do
stripit $1
shift
done
else
while read -t 2; do
stripit $REPLY
done
fi
rm $MYTEMP
=================================================
All the routines from the SRC folder have been updated to integrate the current Doxygen layout.
Everything seems to be fine, all tests passed without problem.