In this directory we are transforming the code from the unitary case to the 
case in which everything works again with Givens transformations, stored in a
2x(n-1) matrix.


------------------------- FASE I -----------------------------------------------

Remarks
---------
For the accuracy of the final code, perhaps set the giv-weight back to a matrix, 
and then use lapack for computing the eig of this for comparison with the method??
I do not know if this will be better?

NC: not changed (the variable uni is not present)
A: altered (replaced uni by giv)

main.f90 -> NC 
chebcom.f90 -> NC
eig_giv_weight
  - generate_representation -> A
       givens -> A
  - qrstep 
       computeshift -> A
       retrievecolumn -> A
       initialstep -> A
            constructwindow -> A
            ST2 -> NOT OK, computation need to be changed
                -> OK, same comments as for ST.f90 remain
            performgivensright -> A
            determinechasing -> A
                ST -> NOT OK, computation need to be changed
                   -> OK now, computation is altered
                   -> My notes contain a faster version
            updaterepresentation -> A
        determine_chasing_GivI -> A
        penultgiv -> A
        lastgivens -> A
   - deflate -> A
   - findpq -> NC
   - retrieveeigenvalues -> A

---------------------------- FASE II -----------------------------------------------
As expected, the code does not provide a correct answer.
We compare with the code from SPEEDUP, in this directory we put in the subdir: 
comparison
-> Tests are run an a 10x10, with alpha=1;

We test after the following files are executed:
if not ok, we go into the file

The following contains a timeline of what is investigated
generate_representation --> Outcome identical
qrstep --> Not ok
   computshift --> ok
   chasingUni --> ok
   initialstep --> Not ok
       constructwindow --> Corrected (ERROR)
   initialstep --> ok (in the first run)
qrstep --> Not ok (error in fifth Givens transformation)
   windowB and chasingUni --> Ok after initialstep       
       constructwindow --> Corrected (2 more errors)

--------------------------- FASE III --------------------------------------
Extra tuning of the software, this is done in correspondance with the code
from the Unitary transformations based directory in SPEEDUP.
1. rewrite some functions corresponding to the changes in SPEEDUP
   performgivensright2.f90 is created and qrstep is altered -> OK
   eig_giv_weight: a little bit the output
   main.f90: a little bit the output
   fastqreig: a little bit the output
2. enhance retrievecolumn.f90 (rewritten)
   -> Ok, works
3. enhance ST.f90
   P1: iter: 2124
       speed: 0.4520
       acc: 0.893E-13 (As accurate as luca)
   P2: iter: 2290
       speed: 0.5210
       acc: 0.14E-7
4. change now also ST2.f90 
   Accuracy tests for applying ST2.f90
   Always th for G2 based on G1 -> 0.55 E-13
   Always th for G2 based on G3 -> 0.39 E-13
   Depending on > (STversie2): 0.39E-13
   Depending on < (STversie3): 0.55E-13
   --> So we always take it based on G3
   Speed: did not change much.

5. Passing Work variables to ST and ST2 --> Speedup
   P1: iter: 2124
       speed: 0.4490 (faster than original ST)
       acc: 0.397E-13 (More accurate than luca)
   P2: iter: 2290
       speed: 0.5190 (faster than original ST)
       acc: 0.14E-7 (as accurate as luca)

6. Get rid of FullChaGiv
   --> Performs a little slower.
   
7. Get rid of vwg
   --> Performance did not change much.

8. constructwindow
   Considering the tests, it is clear that part can be reconstructed,
   moreover, we do not need to update all values of B, in the update representation.
   a) carefully check the construction of windowB, 
      removal of redundant operations for constructing auxB
      time: 0.4440
   b) removal of auxB
      time: 0.4410



9. Get rid of various subroutines:
   qrstep is removed
   constructwindow is removed
   ST is removed
   ST2 is removed
   time: 0.3260
   luca: 0.3050

10. reuse information from constructwindow
    time: 0.3270
    --> Not much gain, only about 5 operations.
    The software can be found in before11

11. Continue with before10, here we removed some unnecessary operations.







--> IMplement pvd's shift-through operator -> currently being used, since 
    it is more accurate and still quite fast.


EXTRA TO BE DONE
1. Reshape operator in constructwindow! 
   --> DONE Corrected, operator is removed.
2. Assign of O in the ST.f90 function, can be much faster.
   --> DONE
3. Determinechasing--> 
   does the accuracy change when other lines of code are taken in hte last few lines.
   lastgivens: same question?
4. Rewrite ST.f90 first in the directory SPEEDUP, to check that the new version works.
   --> DONE
5. Check that operations on vectors (1:2) are faster than individual operations.
   In this way we can rewrite many of the multiplications as operaitons on cols.
7. Can't we recover part from the window, before building constructwindow completely from scratch.
