Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 56c08f9b authored by Nicolas Bellot's avatar Nicolas Bellot Committed by hhakim
Browse files

wrapper matlab operator .' not implemented

parent 1a55a9a0
Branches
Tags
No related merge requests found
......@@ -369,6 +369,69 @@ disp('Ok');
%%% ctranspose test
if (isreal(F))
disp('TEST CTRANSPOSE : ');
disp('operation F_ctrans = F'' ');
F_ctrans=F';
[dim1_ctrans,dim2_ctrans]=size(F_ctrans);
if ((dim1_ctrans ~= dim2) | (dim2_ctrans ~= dim1))
error(['transpose : invalid dimension']);
end
F_dense_ctrans = full(F_ctrans);
%(F_dense_ctrans ~= F_dense')
if (~isequal(F_dense_ctrans,F_dense'))
error(['transpose : invalid transpose matrix']);
end
%% verification de la non modification du faust
[new_dim1,new_dim2]=size(F);
if ((new_dim1 ~= dim1) | (dim2 ~= new_dim2))
error(['transpose : modification du faust de depart']);
end
new_F_dense=full(F);
%((new_F_dense ~= F_dense))
if (~isequal(new_F_dense,F_dense))
error('transpose : modification du faust de depart');
end
disp('operation F_ctrans_ctrans = F_ctrans'' ');
F_ctrans_ctrans=F_ctrans';
[dim1_ctrans_ctrans,dim2_ctrans_ctrans]=size(F_ctrans_ctrans);
if ((dim1_ctrans_ctrans ~= dim1) | (dim2_ctrans_ctrans ~= dim2))
error(['transpose : invalid dimension']);
end
F_dense_ctrans_ctrans = full(F_ctrans_ctrans);
%(F_dense_trans_trans ~= F_dense)
if (~isequal(F_dense_ctrans_ctrans,F_dense))
error(['transpose : invalid transpose matrix']);
end
%% verification de la non modification du faust
[new_dim1_ctrans,new_dim2_ctrans]=size(F_ctrans);
if ((new_dim1_ctrans ~= dim1_ctrans) | (new_dim2_ctrans ~= new_dim2_ctrans))
error(['transpose : modification du faust de depart']);
end
new_F_dense_ctrans=full(F_ctrans);
%((new_F_dense_ctrans ~= F_dense_ctrans))
if (~isequal(new_F_dense_ctrans,F_dense_ctrans))
error('transpose : modification du faust de depart');
end
disp('Ok');
end
......
......@@ -74,6 +74,7 @@ end
disp('Ok');
disp('test 2 : invalid factor empty');
test_pass = 0;
expected_err_message='concatMatGeneric : empty matlab matrix';
......@@ -102,7 +103,7 @@ disp('Ok');
disp('test 3 : invalid factor type (cell)');
test_pass = 0;
expected_err_message='getFaustMat :input matrix format must be single or double';
expected_err_message='Unknown matlab type.';
factors=cell(1,1);
factors{1}=cell(1); % contains a character and not a matrix
......@@ -145,72 +146,30 @@ end
disp('Ok');
disp('test 5 : multiplication scalar compatibility (real/complex)');
% real scalar Faust
test_pass = 0;
expected_err_message='Multiply : Wrong scalar compatibility (real/complex)';
nbRowF = 3;
nbColF = 4;
F_real = Faust({rand(nbRowF,nbColF)});
% complex scalar vector
nbColVec = 7;
%% avoid use of the variable i for imaginary unit to avoid conflict with the i of a loop for instance
%% prefer the expression 1i (imaginary unit)
complex_vector = rand(nbColF,nbColVec)+ 1i * rand(nbColF,nbColVec);
try
y = F_real * complex_vector;
catch ME
if strcmp(ME.message,expected_err_message)
test_pass = 1;
else
error([ 'error with a wrong message : ' ME.message ' must be : ' expected_err_message ]);
end
end
disp('Ok');
disp('test 6 : invalid dense factor (scalar complex)');
disp('test 5 : ctranspose is not yet implemented for complex scalar Faust');
test_pass = 0;
nbRowF = 3;
nbColF = 4;
expected_err_message='getFaustMat scalar type (complex/real) are not compatible';
factor_complex = rand(nbColF,nbColVec)+ 1i * rand(nbColF,nbColVec);
expected_err_message='ctranspose is not yet implemented for complex scalar Faust';
F=Faust({ones(5,4),ones(4,7)+1i*ones(4,7)});
try
F_real = Faust({factor_complex});
F_ctrans = F';
catch ME
if strcmp(ME.message,expected_err_message)
test_pass = 1;
else
disp(ME.message);
error([ 'error with a wrong message : ' ME.message ' must be : ' expected_err_message ]);
end
end
end
if(~test_pass)
error('failure');
end
disp('Ok');
disp('test 7 : invalid sparse factor (scalar complex)');
test_pass = 0;
nbRowF = 3;
nbColF = 4;
expected_err_message='getFaustspMat scalar type (complex/real) are not compatible';
factor_complex = sparse(rand(nbColF,nbColVec)+ 1i * rand(nbColF,nbColVec));
try
F_real = Faust({factor_complex});
catch ME
if strcmp(ME.message,expected_err_message)
test_pass = 1;
else
disp(ME.message);
error([ 'error with a wrong message : ' ME.message ' must be : ' expected_err_message ]);
end
end
disp('Ok');
......
......@@ -80,6 +80,7 @@ end
% expected value for the different multiplication
Y_expected_trans = F_dense.'*x_F_trans;
Y_expected = F_dense*x;
Y_expected_ctrans = F_dense'*x_F_trans;
istransposed=1;
......@@ -102,6 +103,13 @@ if (~isequal(Y_expected_trans,Y_star_trans))
end
if(isreal(F))
Y_star_ctrans = F'*x_F_trans;
if (~isequal(Y_expected_ctrans,Y_star_ctrans))
error(['multiplication faust with conjugate-transposition : invalid result ' ]);
end
end
Y_mtimes_trans = mtimes_trans(F,x_F_trans,istransposed);
%(Y_expected_trans ~= Y_mtimes_trans)
if (~isequal(Y_expected_trans,Y_mtimes_trans))
......@@ -131,4 +139,9 @@ end
end
......@@ -198,7 +198,8 @@ classdef Faust
% WARNING : currently Faust is a real matrix, so the conjugate transposition is the same as the real one
%
% See also ctranspose.
F_trans=ctranspose(F);
F_trans=F; % trans and F point share the same C++ underlying object (objectHandle)
F_trans.transpose_flag = xor(1,F.transpose_flag); % inverse the transpose flag
end
......@@ -210,9 +211,12 @@ classdef Faust
% WARNING : currently Faust is a real matrix, so the conjugate transposition is the same as the real one
%
% See also transpose.
F_ctrans=F; % trans and F point share the same C++ underlying object (objectHandle)
F_ctrans.transpose_flag = xor(1,F.transpose_flag); % inverse the transpose flag
if (isreal(F))
F_ctrans=transpose(F);
else
error('ctranspose is not yet implemented for complex scalar Faust');
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment