Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
faust group
faust
Commits
51520cac
Commit
51520cac
authored
9 years ago
by
Nicolas Bellot
Committed by
hhakim
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
classe matlab ajout operator A(i,j)
parent
d2f4ee75
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
misc/test/src/test_matlab_faust.m
+43
-4
43 additions, 4 deletions
misc/test/src/test_matlab_faust.m
wrapper/matlab/tools/matlab_faust.m
+37
-1
37 additions, 1 deletion
wrapper/matlab/tools/matlab_faust.m
with
80 additions
and
5 deletions
misc/test/src/test_matlab_faust.m
+
43
−
4
View file @
51520cac
...
...
@@ -4,10 +4,10 @@
nb_fact
=
3
;
dim1
=
5
;
dim2
=
3
;
dim2
=
4
;
dim3
=
10
;
int_max
=
100
;
threshold
=
10
^
(
-
15
);
% equality test
disp
(
'****** TEST MATLAB_FAUST ******* '
);
%% creation du faust
disp
(
' TEST CONSTRUCTOR : '
);
...
...
@@ -65,7 +65,7 @@ disp('Ok');
disp
(
'TEST LOAD AND SAVE : '
);
filename
=
[
'@FAUST_BIN_TEST_OUTPUT_DIR@'
filesep
'faust.mat'
];
disp
([
'save faust into the file : '
filename
]);
save
_faust
(
F
,
filename
);
save
(
F
,
filename
);
F_loaded
=
matlab_faust
(
filename
);
[
dim1_loaded
,
dim2_loaded
]
=
size
(
F_loaded
);
...
...
@@ -90,7 +90,7 @@ disp('Ok');
%% get_product test
disp
(
'TEST GET_PRODUCT : '
);
F_dense
=
get_product
(
F
)
;
F_dense
=
get_product
(
F
)
[
dim1_dense
,
dim2_dense
]
=
size
(
F_dense
);
if
((
dim1_dense
~=
dim1
)
|
(
dim2_dense
~=
dim2
))
...
...
@@ -99,9 +99,48 @@ end
disp
(
'Ok'
);
%% slicing test
disp
(
'TEST SLICING : '
);
for
i
=
1
:
dim1
for
j
=
1
:
dim2
F_i_j
=
F
(
i
,
j
);
if
(
size
(
F_i_j
)
~=
[
1
1
])
error
(
'invalid size of F(i,j)'
);
end
if
(
F_i_j
~=
F_dense
(
i
,
j
))
error
(
'F(i,j) ~= F_dense(i,j)'
);
end
end
end
F_slice_slice
=
F
(:,:);
if
(
size
(
F_slice_slice
,
1
)
~=
dim1
)
|
(
size
(
F_slice_slice
,
2
)
~=
dim2
)
error
(
'invalid dimension'
);
end
if
(
F_slice_slice
~=
F_dense
)
error
(
'F(:,:) ~= F_dense'
);
end
F_slice_slice_2
=
F
(
1
:
dim1
,
1
:
dim2
);
if
(
size
(
F_slice_slice_2
,
1
)
~=
dim1
)
|
(
size
(
F_slice_slice_2
,
2
)
~=
dim2
)
error
(
'invalid dimension'
);
end
if
(
F_slice_slice_2
~=
F_dense
)
error
(
'F(1:dim1,1:dim2) ~= F_dense'
);
end
F_inv
=
F
(
dim1
:
-
1
:
1
,
dim2
:
-
1
:
1
);
if
(
size
(
F_inv
,
1
)
~=
dim1
)
|
(
size
(
F_inv
,
2
)
~=
dim2
)
error
(
'invalid dimension'
);
end
if
(
F_inv
~=
F_dense
(
dim1
:
-
1
:
1
,
dim2
:
-
1
:
1
))
error
(
'F(1:dim1,1:dim2) ~= F_dense(dim1:-1:1,dim2:-1:1)'
);
end
disp
(
'Ok'
);
%%% transpose test
disp
(
'TEST TRANSPOSE : '
);
...
...
This diff is collapsed.
Click to expand it.
wrapper/matlab/tools/matlab_faust.m
+
37
−
1
View file @
51520cac
...
...
@@ -169,7 +169,7 @@ classdef matlab_faust
end
%% save a faust into a matfile
function save
_faust
(this,filename)
function save(this,filename)
% save a faust into a matfile
if (~ischar(filename))
error('second argument must contains a string (a filename)');
...
...
@@ -187,6 +187,42 @@ classdef matlab_faust
end
%% overloading of the slicing method only for reading the value of the coeff
function submatrix=subsref(this,S)
if (~isfield(S,'type')) | (~isfield(S,'subs'))
error(' subsref invalid structure S missing field type or subs');
end
if (~ischar(S.type)) | (~iscell(S.subs))
error(' subsref invalid structure S, S.type must be a char, S.subs must be a cell-array');
end
if ~strcmp(S.type,'()')
error(' subsref is only overloaded for () operator');
end
if (length(S.subs) ~=2)
invalid(' subsref invalid slicing must have 2 index since this is a 2D-array');
end
slicing_row=S.subs{1};
slicing_col=S.subs{2};
nbcol=size(this,2);
identity=eye(nbcol);
if ~ischar(slicing_col)
identity=identity(:,slicing_col);
end
submatrix=this*identity;
if ~ischar(slicing_row)
submatrix=submatrix(slicing_row,:);
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment