%%%%%
% Gabor Code, Version 6
%
% Salvador Moreno, Francesc J. Ferri, 2016-2018
%
% Efficient Analysis and Synthesis using a New Factorization of the Gabor Frame Matrix
%
%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main functions to implement the proposed DGE algorithm (Algorithm 2 in the paper):


idgtID.m          (* proposed algorithm to compute the DGE using the analysis window   )
                  (* this is a general DGE algorithm that needs no dual window         )
                  
gGblock.m         (* Step 1. Puts the analysis window in block matrix form: gG         )
InitS.m           (* Step 2. Computes P,V blocks                                       )
BasicRecurrence.m (* Step 3. Solves the recurrence in Eq. 5                            )
estimaJordan.m    (* Step 4. Estimates No and canonical dual support from Q. Lgd=2NoKs )
idgtP.m           (* Step 5. DGE (Portnoff). This is a general DGE algorithm           )
Steps678.m        (* Steps 678. Core of the proposed algorithm                         )

% Auxiliar functions used in the proposed algorithm

blockSize.m       (* computes Ks from Lg,a,M                       )
expandSignal.m    (* zero-pads signal so that L=aN=bM or L=KsNs=bM )


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Other quite general functions

dgtP.m            (* DGT (Portnoff). This is a general DGT algorithm           )
essSupport.m      (* computes essential support and gives a compact window     )
startGaborCode.m  (* sets the path to use ltfat toolbox. Put your own inside!  )


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Illustrative functions (FIGURE 1)

toyGabor.m        (  Compute S, E and D from P, V, A, B and Q and show them graphically
                     The analysis window and its canonical dual are also shown.
                     Several parameters can be changed inside.
                     Figure 1 in the paper has been generated as: 

                     toyGabor(36,3,4,14,1,false)                                          ) 


% Auxiliar functions used by toyGabor:

fullMats.m        (  computes full matrices S, E and D from blocks. Even for Ns=2 )
showMatrix.m      (  displays a matrix as an image                                )
imagescMat        (  modified imagesc used by showMatrix                          )


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Functions used for the numerical experiments (TABLE II, FIGURES 2 and 3)


runOne.m          (x runs different DGT/DGE options for a given Gabor frame and
                     saves/displays CPU times, reconstruction errors, dual sizes, etc
                     Data in Table II was obtained by

                     [Outs, Ins] = runOne(30,60,120,1,10*44100);
                     [Outs, Ins] = runOne(30,60,120,1,20*44100);

                     Timing of Portnoff using a short dual was simulated as:

                     [Outs, Ins] = runOne(30,60,120,1,'dualMax',120)


showBars.m        (x shows CPU times as bars. Used by runOne )


runLgs.m 
runMa.m           
runLgM.m          (x runs series of experiments varying one or several parameters )
                     Figures 2a,2b and 3ab were generated as:

                     [Outs, Ins] = runLgs(30,60,60:30:300,10*44100);
                     [Outs, Ins] = runLgM(30,40:15:200,2,10*44100);
                     [Outs, Ins] = runMa(40:40:240,2,2,10*44100);
                     [Outs, Ins] = runMa(40:40:240,2.2,2,10*44100);

showExp.m         (x displays results from the above series of experiments:       )
                     showExp(Ins,Outs,1)

mystyles.m        (x auxiliar function used by showExp                            )


paper_figures.m   (x script that runs/shows experiments corresponding to          )
                  (  FIGURES 2, 3 and gives some more information                 )

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


