Mentions légales du service

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

Impl. for matfaust the multiplication of a real Faust by a complex Faust and add unit test.

Asked by #27.
parent b5c87e8f
No related branches found
No related tags found
No related merge requests found
......@@ -336,7 +336,15 @@ classdef FaustTest < matlab.unittest.TestCase
this.verifyNotEqual(test_commu_rF, ref_full_faust*(r+1))
this.assertLessThan(norm(full(F'*r)-full(F)'*r)/norm(full(F)'*r), eps(1.))
this.assertLessThan(norm(full(F.'*r)-full(F).'*r)/norm(full(F).'*r), eps(1.))
disp('test mul of two Fausts')
r_fausts = {matfaust.FaustFactory.rand(randi(100), size(F,2)),
matfaust.FaustFactory.rand(randi(100), size(F,2), .5, 'complex')};
for ii=1:length(r_fausts)
rF = r_fausts{ii};
test_rF = full(F*rF);
ref_rF = ref_full_faust*full(rF);
this.verifyEqual(test_rF, ref_rF, 'RelTol', 10^-3);
end
end
function testcat(this)
......
......@@ -401,7 +401,11 @@ classdef Faust
error('Faust multiplication to a sparse matrix isn''t supported.')
elseif(isa(A,'matfaust.Faust'))
if (F.isReal)
C = matfaust.Faust(F, mexFaustReal('mul_faust', F.matrix.objectHandle, A.matrix.objectHandle));
if(isreal(A))
C = matfaust.Faust(F, mexFaustReal('mul_faust', F.matrix.objectHandle, A.matrix.objectHandle));
else
C = mtimes_trans(complex(F), A, trans);
end
else
C = matfaust.Faust(F, mexFaustCplx('mul_faust', F.matrix.objectHandle, A.matrix.objectHandle));
end
......@@ -410,8 +414,7 @@ classdef Faust
if(isreal(A))
C = matfaust.Faust(F, mexFaustReal('mul_scalar', F.matrix.objectHandle, A));
else
cF = complex(F)
C = mtimes_trans(cF, A, trans)
C = mtimes_trans(complex(F), A, trans);
end
else
C = matfaust.Faust(F, mexFaustCplx('mul_scalar', F.matrix.objectHandle, A));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment