File: gabmul.m

package info (click to toggle)
octave-ltfat 2.3.1%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,712 kB
  • sloc: ansic: 30,379; cpp: 8,808; java: 1,499; objc: 345; makefile: 248; xml: 182; python: 124; sh: 18; javascript: 12
file content (120 lines) | stat: -rw-r--r-- 3,213 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
function h=gabmul(f,c,p3,p4,p5)
%-*- texinfo -*-
%@deftypefn {Function} gabmul
%@verbatim
%GABMUL  Apply Gabor multiplier
%   Usage:  h=gabmul(f,c,a);
%           h=gabmul(f,c,g,a);
%           h=gabmul(f,c,ga,gs,a);
%
%   Input parameters:
%         f     : Input signal
%         c     : symbol of Gabor multiplier
%         g     : analysis/synthesis window
%         ga    : analysis window
%         gs    : synthesis window
%         a     : Length of time shift.
%   Output parameters:
%         h     : Output signal
%
%   GABMUL has been deprecated. Please use construct a frame multiplier
%   and use FRAMEMUL instead.
%
%   A call to GABMUL(f,c,ga,gs,a) can be replaced by :
%
%     [Fa,Fs]=framepair('dgt',ga,gs,a,M);
%     fout=framemul(f,Fa,Fs,s);
%
%   Original help:
%   --------------
%
%   GABMUL(f,c,g,a) filters f by a Gabor multiplier determined by
%   the symbol c over the rectangular time-frequency lattice determined by
%   a and M, where M is deduced from the size of c. The rows of c*
%   correspond to frequency, the columns to temporal sampling points.  The
%   window g will be used for both analysis and synthesis.
%
%   GABMUL(f,c,a) does the same using an optimally concentrated, tight
%   Gaussian as window function.
%
%   GABMUL(f,c,ga,gs,a) does the same using the window ga for analysis
%   and gs for synthesis.
%
%   The adjoint operator of GABMUL(f,c,ga,gs,a) is given by
%   GABMUL(f,conj(c),gs,ga,a).
%
%@end verbatim
%@strong{Url}: @url{http://ltfat.github.io/doc/deprecated/gabmul.html}
%@seealso{dgt, idgt, gabdual, gabtight}
%@end deftypefn

% Copyright (C) 2005-2016 Peter L. Soendergaard <peter@sonderport.dk>.
% This file is part of LTFAT version 2.3.1
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.

warning(['LTFAT: GABMUL has been deprecated, please use FRAMEMUL ' ...
         'instead. See the help on GABMUL for more details.']);   

complainif_argnonotinrange(nargin,3,5,mfilename);

M=size(c,1);
N=size(c,2);

if nargin==3
  a=p3;
  L=a*N;
  ga=gabtight(a,M,L);
  gs=ga;
end;

if nargin==4;
  ga=p3;
  gs=p3;
  a=p4;
 end;

if nargin==5;  
  ga=p3;
  gs=p4;
  a=p5;
end;

if numel(c)==1
  error('Size of symbol is too small. You probably forgot to supply it.');
end;


assert_squarelat(a,M,'GABMUL',0);

% Change f to correct shape.
[f,Ls,W,wasrow,remembershape]=comp_sigreshape_pre(f,'DGT',0);

[coef,Ls]=dgt(f,ga,a,M);

if(~strcmp(class(c),'double'))
   coef = cast(coef,class(c));
end

for ii=1:W
  coef(:,:,ii)=coef(:,:,ii).*c;
end;


h=idgt(coef,gs,a,Ls);

% Change h to have same shape as f originally had.
h=comp_sigreshape_post(h,Ls,wasrow,remembershape);