Mentions légales du service

Skip to content
Snippets Groups Projects
Commit a579cbde authored by hhakim's avatar hhakim
Browse files

Verify matfaust.toeplitz r and c arguments and allow to pass indifferently a...

Verify matfaust.toeplitz r and c arguments and allow to pass indifferently a row-vector or a column-vector.
parent 999ecd41
No related branches found
No related tags found
No related merge requests found
......@@ -14,18 +14,28 @@
%> @b See also matfaust.circ, matfaust.anticirc
%=========================================
function T = toeplitz(c, varargin)
if (length(varargin) > 0)
r = varargin{1};
if(~ ismatrix(r) || size(r, 1) ~= 1 && size(r, 2) ~= 1)
error('The second argument must be a vector')
end
else
r = c; % default r
end
m = numel(c);
n = numel(r);
N = 2 ^ ceil(log2(max(m, n)));
c_ = [c, zeros(1, N-m+1+N-n), r(end:-1:2)];
C = matfaust.circ(c_);
T = C(1:m, 1:n);
if (length(varargin) > 0)
r = varargin{1};
if(~ ismatrix(r) || size(r, 1) ~= 1 && size(r, 2) ~= 1)
error('The second argument must be a vector')
end
else
r = c; % default r
end
if size(c, 2) == 1
c = c.';
elseif size(c, 1) ~= 1
error('c must be a vector')
end
if size(r, 2) == 1
r = r.';
elseif size(r, 1) ~= 1
error('r must be a vector')
end
m = numel(c);
n = numel(r);
N = 2 ^ ceil(log2(max(m, n)));
c_ = [c, zeros(1, N-m+1+N-n), r(end:-1:2)];
C = matfaust.circ(c_);
T = C(1:m, 1:n);
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment