Mentions légales du service

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

Add unit tests for matfaust.circ/anticirc/toeplitz.

parent b7d44dd6
No related branches found
No related tags found
No related merge requests found
......@@ -494,6 +494,32 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
this.assertEqual(full(dft(n, 'normed', false)), full(F), 'AbsTol', 10^-7)
end
function testCircAntiCirc(this)
c = [1 2 3 4];
C = [[1 4 3 2]
[2 1 4 3]
[3 2 1 4]
[4 3 2 1]];
self.assertEqual(C, real(full(matfaust.circ(c))))
A = [[2 3 4 1]
[3 4 1 2]
[4 1 2 3]
[1 2 3 4]]
self.assertEqual(C, real(full(matfaust.anticirc(c))))
end
function testToeplitz(this)
c = [1 2 3 4]
r = [1 7 8]
T = [[1., 7., 8.]
[2., 1., 7.]
[3., 2., 1.]
[4., 3., 2.]]
self.assertEqual(T, real(full(matfaust.toeplitz(c, r))))
self.assertEqual(toeplitz(c, r), real(full(matfaust.toeplitz(c, r))))
self.assertEqual(toeplitz(c), real(full(matfaust.toeplitz(c))))
end
function test_sp(this)
import matfaust.proj.sp;
min_n = 5;
......
......@@ -18,6 +18,7 @@ function T = toeplitz(c, varargin)
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment