~ubuntu-branches/ubuntu/wily/octave-ltfat/wily-proposed

« back to all changes in this revision

Viewing changes to inst/sigproc/pfilt.m

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot, Rafael Laboissiere
  • Date: 2015-07-18 23:36:41 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20150718233641-jhuf3f551a3523qc
Tags: 2.1.0+dfsg-1
* Team upload.

[ Rafael Laboissiere ]
* Imported Upstream version 2.1.0+dfsg
* d/rules: Prevent unit testing on armhf and mips.
  This avoids FTBFS on theses architectures (see Bug#765545).
* Unit testing does not need X-window anymore
  + d/rules: Do not use xfvb-run to run the tests.
  + d/control: Drop xauth, xvfb, and gnuplot-nox from Build-Depends.
    Also, the versioned dependency on octave-pkg-dev is relaxed.
* Drop .jar file from upstream tarball, complying with the Debian Policy
  + d/copyright: Exclude file blockproc.jar
  + d/rules: Add get-orig-source target
  + d/watch: Mangle upstream version to cope with "+dfsg" tag
* Build blockproc.jar, which is deleted from the upstream tarball
  + d/rules: Add commands for building blockproc.jar
  + d/control: Build-depend on default-jdk
  + d/p/fix-path-of-included-makefile.patch: New patch
* Bump Standard-Versions to 3.9.6 (no changes needed)
* d/p/autoload-yes.patch: Remove patch (deprecated upstream)
* Bump Build-Depends on octave to >> 4.0.0~rc4-1 (for sndfile support)
* d/check.m: Avoid verbose output of unit tests
* d/watch: Add the repacksuffix option
* d/p/add-hardening-flags.patch: Drop patch (applied upstream)
* d/p/fix-path-of-included-makefile.patch: Drop patch (applied upstream)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function c=pfilt(f,g,varargin)
 
2
%-*- texinfo -*-
 
3
%@deftypefn {Function} pfilt
 
4
%@verbatim
 
5
%PFILT  Apply filter with periodic boundary conditions
 
6
%   Usage:  h=pfilt(f,g);
 
7
%           h=pfilt(f,g,a,dim);
 
8
%
 
9
%   PFILT(f,g) applies the filter g to the input f. If f is a
 
10
%   matrix, the filter is applied along each column.
 
11
%
 
12
%   PFILT(f,g,a) does the same, but downsamples the output keeping only
 
13
%   every a'th sample (starting with the first one).
 
14
%
 
15
%   PFILT(f,g,a,dim) filters along dimension dim. The default value of
 
16
%   [] means to filter along the first non-singleton dimension.
 
17
%
 
18
%   The filter g can be a vector, in which case the vector is treated
 
19
%   as a zero-delay FIR filter.
 
20
%
 
21
%   The filter g can be a cell array. The following options are
 
22
%   possible:
 
23
%
 
24
%      If the first element of the cell array is the name of one of the
 
25
%       windows from FIRWIN, the whole cell array is passed onto
 
26
%       FIRFILTER.
 
27
%
 
28
%      If the first element of the cell array is 'bl', the rest of the
 
29
%       cell array is passed onto BLFILTER.
 
30
%
 
31
%      If the first element of the cell array is 'pgauss', 'psech',
 
32
%       the rest of the parameters is passed onto the respective
 
33
%       function. Note that you do not need to specify the length L.
 
34
%
 
35
%   The coefficients obtained from filtering a signal f by a filter g are
 
36
%   defined by
 
37
%
 
38
%               L-1
 
39
%      c(n+1) = sum f(l+1) * g(an-l+1)
 
40
%               l=0
 
41
%
 
42
%   where an-l is computed modulo L.
 
43
%
 
44
%@end verbatim
 
45
%@strong{Url}: @url{http://ltfat.github.io/doc/sigproc/pfilt.html}
 
46
%@seealso{pconv}
 
47
%@end deftypefn
 
48
 
 
49
% Copyright (C) 2005-2015 Peter L. Soendergaard <peter@sonderport.dk>.
 
50
% This file is part of LTFAT version 2.1.0
 
51
%
 
52
% This program is free software: you can redistribute it and/or modify
 
53
% it under the terms of the GNU General Public License as published by
 
54
% the Free Software Foundation, either version 3 of the License, or
 
55
% (at your option) any later version.
 
56
%
 
57
% This program is distributed in the hope that it will be useful,
 
58
% but WITHOUT ANY WARRANTY; without even the implied warranty of
 
59
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
60
% GNU General Public License for more details.
 
61
%
 
62
% You should have received a copy of the GNU General Public License
 
63
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
64
 
 
65
  
 
66
% Assert correct input.
 
67
if nargin<2
 
68
  error('%s: Too few input parameters.',upper(mfilename));
 
69
end;
 
70
 
 
71
definput.import={'pfilt'};
 
72
definput.keyvals.a=1;
 
73
definput.keyvals.dim=[];
 
74
[flags,kv,a,dim]=ltfatarghelper({'a','dim'},definput,varargin);
 
75
 
 
76
[f,L,Ls,W,dim,permutedsize,order]=assert_sigreshape_pre(f,[],dim,upper(mfilename));
 
77
 
 
78
[g,info] = comp_fourierwindow(g,L,upper(mfilename));
 
79
 
 
80
 
 
81
outIsReal = isreal(f) &&...
 
82
              (isfield(g,'h') && isreal(g.h) && ~(isfield(g,'fc') && g.fc~=0) || isfield(g,'H') && g.realonly);
 
83
 
 
84
g = comp_filterbank_pre({g},a,L,kv.crossover);
 
85
 
 
86
 
 
87
c = comp_filterbank(f,g,a);
 
88
c = c{1};
 
89
 
 
90
permutedsize(1)=size(c,1);
 
91
  
 
92
c=assert_sigreshape_post(c,dim,permutedsize,order);
 
93
 
 
94
if outIsReal
 
95
   c = real(c);
 
96
end
 
97
 
 
98