In this directory we will test the speed and accuracy of several variants,
of the shift-through operator.

We test on the operator ST.f90, since this one is performed the most.

BUG DISCOVERY: 
we discovered a serious implementation bug, affecting perhaps the accuracy of the results.
Instead of basing the if loop on H1 and H3 (the input), we did it based on G1 and G3, 
these are to be overwritten!!!!

We check the impact of changing this again to the correct setting!
The new results are depicted in the brackets after the tests.

For reconsidering the tests see the subdirs.


1. Standard Shift-Through
   if -> based on the norm
   O -> created outside the if
   operations -> all performed explicitly
   G1 by Givens
   G2 by Givens
   G3 immediate assign
   if statement >
   P1: iter: 2124
       speed: 0.5260
       acc: 0.668E-12
   P2: iter: 2298
       speed: 0.6100
       acc: 0.14E-7
   if statement < (expected to be worse)
   P1: iter: 2119
       speed: 0.5420
       acc: 0.332E-11 (worse as expected)
   P2: iter: 2295
       speed: 0.6080
       acc: 0.14E-7


2. Type II 
   operations -> all performed explicitly
   G1 by Givens
   G2 by Givens
   G3 immediate assign
   if -> based on s_1 > s_3
   P1: iter: 2124
       speed: 0.5200
       acc: 0.3398E-12 (better than for type I)
            (correct if: 0.1057E-10 ==> BAD)
   P2: iter: 2293
       speed: 0.6020
       acc: 0.14E-7
   if -> based on s_1 < s_3 
   P1: iter: 2124
       speed: 0.5200
       acc: 0.14670E-10 (Much worse)
            (correct if: 0.332E-12 ==> BETTER, BEST untill now)
   P2: iter: 2294
       speed: 0.6010
       acc: 0.14E-7


3a. Type III (part (a), G2 determined by a Givens)
   operations -> partially performed explicitly (many removed)
   G1 by Givens
   G2 by Givens
   G3 immediate assign
   if -> based on s_1 > s_3
   P1: iter: 2124
       speed: 0.5120
       acc: 0.287E-10 
            (correct if: 0.4405E-12)
   P2: iter: 2294
       speed: 0.5990
       acc: 0.14E-7
   if -> based on s_1 < s_3 
   P1: iter: 2124
       speed: 0.5110
       acc: 0.400E-12
            (correct if: 0.2187E-12 BEST untill now)
   P2: iter: 2290
       speed: 0.5880
       acc: 0.14E-7


3b. Type III (part (b), G2 determined by immediate assign)
   operations -> partially performed explicitly (many removed)
   G1 by Givens
   G2 immediate assign
   G3 immediate assign
   if -> based on s_1 > s_3
   P1: iter: 2124
       speed: 0.4200 (MUCH FASTER)
       acc: 0.558E-12 (approx the same)
            (correct if: 0.37E-12)
   P2: iter: 2289
       speed: 0.4820 (MUCH FASTER)
       acc: 0.14E-7
   if -> based on s_1 < s_3
   P1: iter: 2124
       speed: 0.4220
       acc: 0.3470E-12 (even more accurate ?????, should be worse)
            (correct if: 0.3145E-12, approx the same, a little worse)
   P2: iter: 2290
       speed: 0.4880
       acc: 0.14E-7


4. Type IV (based on the results of above)
   Adaptation of Type  
   The matrix O is created inside the loops, few operations are saved
   if -> based on s_1 > s_3
   if -> based on s_1 < s_3
   --> Timings do not differ that much.


5. Type V (Paul Van Dooren)
   The matrix O is not constructed anymore
   G1 by Givens
   G2 by immediate assign
   G3 by Givens
   --> The results are quite accurate. However, it seems that when no selection based
   on the Givens transformation is made, hence always the same construction is followed, that
   the results are more accurate.
   Various forms are stored in the STpvdx.f90 (x=digit)
   Hence, we report timings based constructing G2 from G1
   (perhaps for other examples we need to import the if again, try extra with numerical exp.)
   P1: iter: 2124
       speed: 0.4520
       acc: 0.893E-13 (As accurate as luca)
   P2: iter: 2290
       speed: 0.5210
       acc: 0.14E-7

   ---> The routine is however a little little bit slower than the standard shift-through implementation.
   
