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
3d673382
Commit
3d673382
authored
8 years ago
by
Nicolas Bellot
Committed by
hhakim
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Matlab Faust class doc
parent
56dcf6ef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrapper/matlab/Faust.m
+119
-119
119 additions, 119 deletions
wrapper/matlab/Faust.m
with
119 additions
and
119 deletions
wrapper/matlab/Faust.m
+
119
−
119
View file @
3d673382
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
% Nicolas Bellot : nicolas.bellot@inria.fr
% Nicolas Bellot : nicolas.bellot@inria.fr
% Adrien Leman : adrien.leman@inria.fr
% Adrien Leman : adrien.leman@inria.fr
% Thomas Gautrais : thomas.gautrais@inria.fr
% Thomas Gautrais : thomas.gautrais@inria.fr
%
Luc Le Magoarou : luc.le-magoarou@inria.fr
%
Luc Le Magoarou : luc.le-magoarou@inria.fr
%
Remi Gribonval : remi.gribonval@inria.fr
%
Remi Gribonval : remi.gribonval@inria.fr
%
%
%% References:
%% References:
% [1] Le Magoarou L. and Gribonval R., "Flexible multi-layer sparse
% [1] Le Magoarou L. and Gribonval R., "Flexible multi-layer sparse
...
@@ -48,17 +48,17 @@ classdef Faust
...
@@ -48,17 +48,17 @@ classdef Faust
methods
methods
function
F
=
Faust
(
varargin
)
function
F
=
Faust
(
varargin
)
%% FAUST Constructor - build a Faust from various type of input.
%% FAUST Constructor - build a Faust from various type of input.
%
%
% Example of use :
% Example of use :
%
%
% F = Faust(factors,lambda)
% F = Faust(factors,lambda)
% -factor : 1D cell array of matrix (sparse or
% -factor : 1D cell array of matrix (sparse or
% dense) representing the factor of the Faust
% dense) representing the factor of the Faust
% -lambda : (optional) multiplicative scalar
% -lambda : (optional) multiplicative scalar
%
%
% F = Faust(filename)
% F = Faust(filename)
% filename : a filename (mat file) where a Faust is stored with save_Faust
% filename : a filename (mat file) where a Faust is stored with save_Faust
F
.
matrix
=
FaustCore
(
varargin
{:});
F
.
matrix
=
FaustCore
(
varargin
{:});
F
.
transpose_flag
=
0
;
F
.
transpose_flag
=
0
;
...
@@ -70,22 +70,22 @@ classdef Faust
...
@@ -70,22 +70,22 @@ classdef Faust
function
delete
(
F
)
function
delete
(
F
)
%% DELETE Destructor delete the Faust.
%% DELETE Destructor delete the Faust.
% delete(F)
% delete(F)
%
%
% See also Faust
% See also Faust
mexFaust
(
'delete'
,
F
.
objectHandle
);
mexFaust
(
'delete'
,
F
.
objectHandle
);
end
end
function
C
=
mtimes
(
F
,
A
)
function
C
=
mtimes
(
F
,
A
)
%% MTIMES * Faust Multiplication (overloaded Matlab built-in function).
%% MTIMES * Faust Multiplication (overloaded Matlab built-in function).
%
%
% C=mtimes(F,A) is called for syntax 'C=F*A', when F is a Faust matrix and A a full
% C=mtimes(F,A) is called for syntax 'C=F*A', when F is a Faust matrix and A a full
% storage matrix, C is also a full matrix storage.
% storage matrix, C is also a full matrix storage.
%
%
% See also mtimes_trans
% See also mtimes_trans
C
=
mexFaust
(
'multiply'
,
F
.
matrix
.
objectHandle
,
A
,
F
.
transpose_flag
);
C
=
mexFaust
(
'multiply'
,
F
.
matrix
.
objectHandle
,
A
,
F
.
transpose_flag
);
end
end
...
@@ -93,14 +93,14 @@ classdef Faust
...
@@ -93,14 +93,14 @@ classdef Faust
function
C
=
mtimes_trans
(
F
,
A
,
trans
)
function
C
=
mtimes_trans
(
F
,
A
,
trans
)
%% MTIMES_TRANS Multiplication by a Faust or its non-conjugate transposed.
%% MTIMES_TRANS Multiplication by a Faust or its non-conjugate transposed.
%
%
% C = mtimes_trans(F,A,trans) when F is a Faust,A a full storage
% C = mtimes_trans(F,A,trans) when F is a Faust,A a full storage
% matrix and trans a parameter, C a full storage matrix
% matrix and trans a parameter, C a full storage matrix
% if trans == 0, C=F*A is performed (multiplication)
% if trans == 0, C=F*A is performed (multiplication)
% if trans == 1, C=F'*A is performed (multiplication by transposed)
% if trans == 1, C=F'*A is performed (multiplication by transposed)
%
%
% See also mtimes.
% See also mtimes.
if
~
isreal
(
trans
)
if
~
isreal
(
trans
)
error
(
'invalid argument trans, must be equal to 0 or 1'
);
error
(
'invalid argument trans, must be equal to 0 or 1'
);
...
@@ -117,10 +117,10 @@ classdef Faust
...
@@ -117,10 +117,10 @@ classdef Faust
function
A
=
full
(
F
)
function
A
=
full
(
F
)
%% FULL Convert Faust matrix to full matrix (overloaded Matlab
%% FULL Convert Faust matrix to full matrix (overloaded Matlab
% built-in function).
% built-in function).
%
%
% A=full(F) converts a Faust matrix F to full storage matrix A.
% A=full(F) converts a Faust matrix F to full storage matrix A.
A
=
mexFaust
(
'full'
,
F
.
matrix
.
objectHandle
,
F
.
transpose_flag
);
A
=
mexFaust
(
'full'
,
F
.
matrix
.
objectHandle
,
F
.
transpose_flag
);
...
@@ -129,26 +129,26 @@ classdef Faust
...
@@ -129,26 +129,26 @@ classdef Faust
function
F_trans
=
transpose
(
F
)
function
F_trans
=
transpose
(
F
)
%% TRANSPOSE .' Non-conjugate transposed Faust (overloaded Matlab built-in function).
%% TRANSPOSE .' Non-conjugate transposed Faust (overloaded Matlab built-in function).
%
%
% F_trans = transpose(F) is called for the syntax F.' when F is Faust.
% F_trans = transpose(F) is called for the syntax F.' when F is Faust.
%
%
% WARNING : currently Faust is a real matrix, so the conjugate transposition is the same as the real one
% WARNING : currently Faust is a real matrix, so the conjugate transposition is the same as the real one
%
%
% See also ctranspose.
% See also ctranspose.
F_trans
=
ctranspose
(
F
);
F_trans
=
ctranspose
(
F
);
end
end
function
F_ctrans
=
ctranspose
(
F
)
function
F_ctrans
=
ctranspose
(
F
)
%% CTRANSPOSE ' Complex conjugate transposed Faust (overloaded Matlab built-in function).
%% CTRANSPOSE ' Complex conjugate transposed Faust (overloaded Matlab built-in function).
%
%
% F_trans = ctranspose(F) is called for syntax F' (complex conjugate transpose) when F is a Faust.
% F_trans = ctranspose(F) is called for syntax F' (complex conjugate transpose) when F is a Faust.
%
%
% WARNING : currently Faust is a real matrix, so the conjugate transposition is the same as the real one
% WARNING : currently Faust is a real matrix, so the conjugate transposition is the same as the real one
%
%
% See also transpose.
% See also transpose.
F_ctrans
=
F
;
% trans and F point share the same C++ underlying object (objectHandle)
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
F_ctrans
.
transpose_flag
=
xor
(
1
,
F
.
transpose_flag
);
% inverse the transpose flag
...
@@ -158,15 +158,15 @@ classdef Faust
...
@@ -158,15 +158,15 @@ classdef Faust
function
varargout
=
size
(
F
,
varargin
)
function
varargout
=
size
(
F
,
varargin
)
%% SIZE Size of a Faust (overloaded Matlab built-in function).
%% SIZE Size of a Faust (overloaded Matlab built-in function).
%
%
% D = size(F), for a Faust F, returns the two-element row vector
% D = size(F), for a Faust F, returns the two-element row vector
% D = [M,N] containing the number of rows and columns in the Faust.
% D = [M,N] containing the number of rows and columns in the Faust.
%
%
% M = size(F,DIM) returns the length of the dimension specified
% M = size(F,DIM) returns the length of the dimension specified
% by the scalar DIM. For example, size(X,1) returns the number
% by the scalar DIM. For example, size(X,1) returns the number
% of rows and size(F,2) returns the number of columns in the Faust.
% of rows and size(F,2) returns the number of columns in the Faust.
% If DIM > 2, M will be 1.
% If DIM > 2, M will be 1.
...
@@ -219,14 +219,14 @@ classdef Faust
...
@@ -219,14 +219,14 @@ classdef Faust
function
end_dim
=
end
(
F
,
k
,
n
)
function
end_dim
=
end
(
F
,
k
,
n
)
%% END (useful for slicing) serve as the last index in an indexing expression (overloaded Matlab built-in function).
%% END (useful for slicing) serve as the last index in an indexing expression (overloaded Matlab built-in function).
%
%
% Examples of use for slicing a Faust F are
% Examples of use for slicing a Faust F are
% F(3:end,1) : in this case, end=size(F,1)
% F(3:end,1) : in this case, end=size(F,1)
% i.e end equals to the number of row of the Faust F.
% i.e end equals to the number of row of the Faust F.
% F(1,1:2:end-1) : in this case, end=size(F,2)
% F(1,1:2:end-1) : in this case, end=size(F,2)
% end equals to the number of column fo the Faust F.
% end equals to the number of column fo the Faust F.
%
%
% See also subsref, size.
% See also subsref, size.
if
(
n
~=
2
)
if
(
n
~=
2
)
error
(
'invalid slicing : Faust is a 2D array i.e matrix'
);
error
(
'invalid slicing : Faust is a 2D array i.e matrix'
);
...
@@ -242,15 +242,15 @@ classdef Faust
...
@@ -242,15 +242,15 @@ classdef Faust
function
factor
=
get_fact
(
F
,
id
)
function
factor
=
get_fact
(
F
,
id
)
%% GET_FACT Ith factor of the Faust.
%% GET_FACT Ith factor of the Faust.
%
%
% A=get_fact(F,id) return the id factor A of the Faust F as a full storage matrix.
% A=get_fact(F,id) return the id factor A of the Faust F as a full storage matrix.
%
%
% Example of use :
% Example of use :
% A=get_fact(F,1) returns the 1st factor of the Faust F.
% A=get_fact(F,1) returns the 1st factor of the Faust F.
% A=get_fact(F,4) returns the 4th factor of the Faust F.
% A=get_fact(F,4) returns the 4th factor of the Faust F.
%
%
% See also get_nb_factor.
% See also get_nb_factor.
if
(
~
isa
(
id
,
'double'
))
if
(
~
isa
(
id
,
'double'
))
error
(
'get_fact second argument (indice) must either be real positive integers or logicals.'
);
error
(
'get_fact second argument (indice) must either be real positive integers or logicals.'
);
...
@@ -275,11 +275,11 @@ classdef Faust
...
@@ -275,11 +275,11 @@ classdef Faust
function
nb_factor
=
get_nb_factor
(
F
)
function
nb_factor
=
get_nb_factor
(
F
)
%% GET_NB_FACTOR Number of factor of the Faust.
%% GET_NB_FACTOR Number of factor of the Faust.
%
%
% nb_factor = get_nb_factor(F) return the number of factor of the
% nb_factor = get_nb_factor(F) return the number of factor of the
% Faust F.
% Faust F.
%
%
% See also get_fact.
% See also get_fact.
nb_factor
=
mexFaust
(
'get_nb_factor'
,
F
.
matrix
.
objectHandle
);
nb_factor
=
mexFaust
(
'get_nb_factor'
,
F
.
matrix
.
objectHandle
);
end
end
...
@@ -287,9 +287,9 @@ classdef Faust
...
@@ -287,9 +287,9 @@ classdef Faust
function
save
(
F
,
filename
)
function
save
(
F
,
filename
)
%% SAVE Save a Faust into a matfile.
%% SAVE Save a Faust into a matfile.
%
%
% save(F,filename) save the Faust F into the .mat file specified by
% save(F,filename) save the Faust F into the .mat file specified by
% filename.
% filename.
...
@@ -311,19 +311,19 @@ classdef Faust
...
@@ -311,19 +311,19 @@ classdef Faust
function
submatrix
=
subsref
(
F
,
S
)
function
submatrix
=
subsref
(
F
,
S
)
%% SUBSREF Subscripted reference (overloaded Matlab built-in function).
%% SUBSREF Subscripted reference (overloaded Matlab built-in function).
%
%
% F(I,J) is an array formed from the elements of the rectangular
% F(I,J) is an array formed from the elements of the rectangular
% submatrix of the Faust F specified by the subscript vectors I and J. The
% submatrix of the Faust F specified by the subscript vectors I and J. The
% resulting array has LENGTH(I) rows and LENGTH(J) columns. A colon used
% resulting array has LENGTH(I) rows and LENGTH(J) columns. A colon used
% as a subscript, as in F(I,:), indicates all columns of those rows
% as a subscript, as in F(I,:), indicates all columns of those rows
% indicated by vector I. Similarly, F(:,J) = B means all rows of columns
% indicated by vector I. Similarly, F(:,J) = B means all rows of columns
%J.
%J.
%
%
% Example of use :
% Example of use :
% A(i,j) A(:,j) A(3:4,2:5) A(1:end,5:end-1)
% A(i,j) A(:,j) A(3:4,2:5) A(1:end,5:end-1)
%
%
% See also end.
% See also end.
if
(
~
isfield
(
S
,
'type'
))
|
(
~
isfield
(
S
,
'subs'
))
if
(
~
isfield
(
S
,
'type'
))
|
(
~
isfield
(
S
,
'subs'
))
...
@@ -401,12 +401,12 @@ classdef Faust
...
@@ -401,12 +401,12 @@ classdef Faust
function
norm_Faust
=
norm
(
F
,
varargin
)
function
norm_Faust
=
norm
(
F
,
varargin
)
%% NORM Faust norm (overloaded Matlab built-in function).
%% NORM Faust norm (overloaded Matlab built-in function).
%
%
% norm(F,2) when F is Faust returns the 2-norm of F
% norm(F,2) when F is Faust returns the 2-norm of F
% norm(F) is the same as norm(F)
% norm(F) is the same as norm(F)
%
%
% WARNING : norm(F,typenorm) is only supported when typenorm equals 2
% WARNING : norm(F,typenorm) is only supported when typenorm equals 2
nb_input
=
length
(
varargin
);
nb_input
=
length
(
varargin
);
if
(
nb_input
>
1
)
if
(
nb_input
>
1
)
...
@@ -429,11 +429,11 @@ classdef Faust
...
@@ -429,11 +429,11 @@ classdef Faust
function
nz
=
nnz
(
F
)
function
nz
=
nnz
(
F
)
%% NNZ Number of nonzero elements in a Faust (overloaded Matlab built-in function).
%% NNZ Number of nonzero elements in a Faust (overloaded Matlab built-in function).
%
%
% nz = nnz(F) is the number of nonzero elements in the Faust F.
% nz = nnz(F) is the number of nonzero elements in the Faust F.
%
%
% See also density, RCG.
% See also density, RCG.
nz
=
mexFaust
(
'nnz'
,
F
.
matrix
.
objectHandle
);
nz
=
mexFaust
(
'nnz'
,
F
.
matrix
.
objectHandle
);
...
@@ -441,15 +441,15 @@ classdef Faust
...
@@ -441,15 +441,15 @@ classdef Faust
function
dens
=
density
(
F
)
function
dens
=
density
(
F
)
%% DENSITY Density of the Faust.
%% DENSITY Density of the Faust.
%
%
% dens = density(F) when F is a Faust returns the
% dens = density(F) when F is a Faust returns the
% percentage of nonzero elements of F,
% percentage of nonzero elements of F,
% dens is a number between 0 and 1.
% dens is a number between 0 and 1.
% In some degenerated case, dens can be greater than 1.
% In some degenerated case, dens can be greater than 1.
% If the Faust is empty, return -1.
% If the Faust is empty, return -1.
%
%
% See also RCG, nnz.
% See also RCG, nnz.
prod_dim
=
prod
(
size
(
F
));
prod_dim
=
prod
(
size
(
F
));
if
(
prod_dim
~=
0
)
if
(
prod_dim
~=
0
)
...
@@ -461,14 +461,14 @@ classdef Faust
...
@@ -461,14 +461,14 @@ classdef Faust
function
speed_up
=
RCG
(
F
)
function
speed_up
=
RCG
(
F
)
%% RCG Relative Complexity Gain (inverse of the density)
%% RCG Relative Complexity Gain (inverse of the density)
%
%
% speed_up = RCG(F) when F is Faust, returns the
% speed_up = RCG(F) when F is Faust, returns the
% inverse of density of the Faust (i.e the theoretical gain
% inverse of density of the Faust (i.e the theoretical gain
% both for storage and multiplication computation time between the Faust and its full storage
% both for storage and multiplication computation time between the Faust and its full storage
% equivalent full(F)).
% equivalent full(F)).
%
%
% See also density, nnz.
% See also density, nnz.
dens
=
density
(
F
);
dens
=
density
(
F
);
if
(
dens
>
0
)
if
(
dens
>
0
)
...
...
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