Mentions légales du service

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

Fix matfaust product M*F (with M a matrix and F a Faust).

(F'*M')' was handled correctly but not M*F (matrix on the left side).

It was raising this kind of error:
==============
Struct contents reference from a non-struct array object.

Error in matfaust.Faust/mtimes_trans (line 713)
                                if (F.isReal)

Error in * (line 657)
                                G = mtimes_trans(F, A, 0);
==============
parent 21d21ff6
No related branches found
No related tags found
No related merge requests found
...@@ -377,6 +377,14 @@ classdef FaustTest < matlab.unittest.TestCase ...@@ -377,6 +377,14 @@ classdef FaustTest < matlab.unittest.TestCase
ref_mat = ref_full_faust*cmat; ref_mat = ref_full_faust*cmat;
test_mat = F*cmat; test_mat = F*cmat;
this.verifyEqual(test_mat,ref_mat, 'RelTol', 10^-3) this.verifyEqual(test_mat,ref_mat, 'RelTol', 10^-3)
% transpose products
tref_mat = rmat'*ref_full_faust';
ttest_mat = rmat'*F';
this.verifyEqual(ttest_mat,tref_mat, 'RelTol', 10^-3)
% against complex matrix
tref_mat = cmat'*ref_full_faust';
ttest_mat = cmat'*F';
this.verifyEqual(ttest_mat,tref_mat, 'RelTol', 10^-3)
disp('test real mul by real scalar') disp('test real mul by real scalar')
r = rand(); r = rand();
test_rF = full(F*r); test_rF = full(F*r);
...@@ -407,6 +415,10 @@ classdef FaustTest < matlab.unittest.TestCase ...@@ -407,6 +415,10 @@ classdef FaustTest < matlab.unittest.TestCase
test_rF = full(F*rF); test_rF = full(F*rF);
ref_rF = ref_full_faust*full(rF); ref_rF = ref_full_faust*full(rF);
this.verifyEqual(test_rF, ref_rF, 'RelTol', 10^-3); this.verifyEqual(test_rF, ref_rF, 'RelTol', 10^-3);
% transpose prod
ttest_rF = full(rF'*F');
tref_rF = full(rF)'*ref_full_faust';
this.verifyEqual(ttest_rF, tref_rF, 'RelTol', 10^-3);
end end
end end
......
...@@ -455,8 +455,12 @@ classdef Faust ...@@ -455,8 +455,12 @@ classdef Faust
% storage matrix, G is also a full matrix storage. % storage matrix, G is also a full matrix storage.
% %
% See also mtimes_trans % See also mtimes_trans
if(isa(A, 'matfaust.Faust') && isscalar(F)) if(isa(A, 'matfaust.Faust'))
G = mtimes_trans(A, F, 0); if(isscalar(F))
G = mtimes_trans(A, F, 0);
elseif(ismatrix(F))
G = mtimes_trans(A', F', 0)';
end
else else
G = mtimes_trans(F, A, 0); G = mtimes_trans(F, A, 0);
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment