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
12e43aa1
Commit
12e43aa1
authored
9 years ago
by
Nicolas Bellot
Committed by
hhakim
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
wrapper matlab faust plus de copie memoire lors de la transposition
parent
9a2f086a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
wrapper/matlab/CMakeLists.txt
+8
-2
8 additions, 2 deletions
wrapper/matlab/CMakeLists.txt
wrapper/matlab/tools/matlab_faust.m
+13
-28
13 additions, 28 deletions
wrapper/matlab/tools/matlab_faust.m
wrapper/matlab/tools/matlab_faust_core.m
+55
-0
55 additions, 0 deletions
wrapper/matlab/tools/matlab_faust_core.m
with
76 additions
and
30 deletions
wrapper/matlab/CMakeLists.txt
+
8
−
2
View file @
12e43aa1
...
...
@@ -2,8 +2,14 @@
#
#INCLUDE("${PROJECT_SOURCE_DIR}/CMake/define_variables.cmake")
configure_file
(
${
FAUST_MATLAB_TOOLS_SRC_DIR
}
/matlab_faust.m.in
${
FAUST_MATLAB_TOOLS_BIN_DIR
}
/matlab_faust.m COPYONLY
)
install
(
FILES
${
FAUST_MATLAB_TOOLS_BIN_DIR
}
/matlab_faust.m DESTINATION
${
FAUST_MATLAB_TOOLS_INSTALL_DIR
}
)
# copy and install the matlab wrapping the underlying C++ class
foreach
(
MATLAB_FILE matlab_faust matlab_faust_core
)
configure_file
(
${
FAUST_MATLAB_TOOLS_SRC_DIR
}
/
${
MATLAB_FILE
}
.m
${
FAUST_MATLAB_TOOLS_BIN_DIR
}
/
${
MATLAB_FILE
}
.m COPYONLY
)
install
(
FILES
${
FAUST_MATLAB_TOOLS_BIN_DIR
}
/
${
MATLAB_FILE
}
.m DESTINATION
${
FAUST_MATLAB_TOOLS_INSTALL_DIR
}
)
endforeach
()
file
(
GLOB CPP_MEXTOOLS_FILES
"
${
FAUST_MATLAB_TOOLS_SRC_DIR
}
/*.cpp"
)
# include directory
...
...
This diff is collapsed.
Click to expand it.
wrapper/matlab/tools/matlab_faust.m
.in
→
wrapper/matlab/tools/matlab_faust.m
+
13
−
28
View file @
12e43aa1
...
...
@@ -6,9 +6,9 @@
%
For
more
information
on
the
FAuST
Project
,
please
visit
the
website
of
%
the
project
:
<
http
://
faust
.
gforge
.
inria
.
fr
>
classdef matlab_faust
< handle
properties (SetAccess = p
rivate
, Hidden =
tru
e)
objectHandle
; % Handle to the underlying C++ class instance
classdef
matlab
_
faust
properties
(
SetAccess
=
p
ublic
,
Hidden
=
fals
e
)
matrix
;
%
Handle
to
the
underlying
C
++
class
instance
transpose
_
flag
;
%
boolean
to
know
if
the
matlab
_
faust
is
transpose
or
not
end
methods
...
...
@@ -18,22 +18,8 @@ classdef matlab_faust < handle
%
1
st
input
:
1
D
cell
array
of
matrix
(
sparse
or
dense
)
%
2
nd
input
:
(
optional
)
multiplicative
scalar
%
-
or
from
a
filename
(
mat
file
)
where
a
faust
is
stored
with
save
_
faust
if (nargin == 1) && ischar(varargin{1})
filename=varargin{1};
load(filename);
if (~exist('faust_factors','var') || ~exist('transpose_flag','var'))
error('matlab_faust : invalid file');
end
this=matlab_faust(faust_factors);
else
% if(length(varargin{:}) == 3)
% transpose_flag = varargin{end};
% varargin = varargin(1:end-1);
% end
this.objectHandle = mexFaust('new',varargin{:});
this.transpose_flag = 0;
end
this
.
matrix
=
matlab
_
faust
_
core
(
varargin
{
:
})
;
this
.
transpose
_
flag
=
0
;
end
...
...
@@ -56,7 +42,7 @@ classdef matlab_faust < handle
trans='N';
end
y = mexFaust('multiply', this.objectHandle,x,trans);
y = mexFaust('multiply', this.
matrix.
objectHandle,x,trans);
end
...
...
@@ -71,7 +57,7 @@ classdef matlab_faust < handle
trans='N';
end
y = mexFaust('multiply', this.objectHandle,x,trans);
y = mexFaust('multiply', this.
matrix.
objectHandle,x,trans);
end
...
...
@@ -83,7 +69,7 @@ classdef matlab_faust < handle
else
trans='N';
end
y=mexFaust('get_product',this.objectHandle,trans);
y=mexFaust('get_product',this.
matrix.
objectHandle,trans);
end
...
...
@@ -97,9 +83,8 @@ classdef matlab_faust < handle
function trans=ctranspose(this)
%ctranspose - overloading of the matlab transpose operator (')
trans = matlab_faust({});
trans.objectHandle = mexFaust('copy',this.objectHandle);
trans.transpose_flag = mod(this.transpose_flag+1,2);
trans=this; % trans and this point share the same C++ underlying object (objectHandle)
trans.transpose_flag = mod(this.transpose_flag+1,2); % inverse the transpose flag
end
...
...
@@ -120,7 +105,7 @@ classdef matlab_faust < handle
end
Size=mexFaust('size',this.objectHandle);
Size=mexFaust('size',this.
matrix.
objectHandle);
%% if the faust is tranposed, inverse the dimension
if(this.transpose_flag)
...
...
@@ -169,7 +154,7 @@ classdef matlab_faust < handle
id = get_nb_factor(this)+1-id;
end
factor = mexFaust('get_fact',this.objectHandle,id);
factor = mexFaust('get_fact',this.
matrix.
objectHandle,id);
if (this.transpose_flag)
factor = factor';
...
...
@@ -180,7 +165,7 @@ classdef matlab_faust < handle
%% get_nb_factor : return the number of factor of the faust
function nb_factor = get_nb_factor(this)
% get_nb_factor : return the number of factor of the faust
nb_factor = mexFaust('get_nb_factor',this.objectHandle);
nb_factor = mexFaust('get_nb_factor',this.
matrix.
objectHandle);
end
%% save a faust into a matfile
...
...
This diff is collapsed.
Click to expand it.
wrapper/matlab/tools/matlab_faust_core.m
0 → 100644
+
55
−
0
View file @
12e43aa1
%class MATLAB_FAUST
% representing a given dense matrix by a product of sparse matrix (i.e faust)
% in order to speed-up multiplication by this matrix,
% matlab wrapper class implemented in C++
%
% For more information on the FAuST Project, please visit the website of
% the project : <http://faust.gforge.inria.fr>
classdef
matlab_faust_core
<
handle
properties
(
SetAccess
=
public
,
Hidden
=
false
)
objectHandle
;
% Handle to the underlying C++ class instance
end
methods
%% Constructor - Create a new C++ class instance
function
this
=
matlab_faust_core
(
varargin
)
% Constructor - build a faust from a cell array of matrix and a scalar (optional)
% 1st input : 1D cell array of matrix (sparse or dense)
% 2nd input : (optional) multiplicative scalar
% - or from a filename (mat file) where a faust is stored with save_faust
if
(
nargin
==
1
)
&&
ischar
(
varargin
{
1
})
filename
=
varargin
{
1
};
load
(
filename
);
if
(
~
exist
(
'faust_factors'
,
'var'
)
||
~
exist
(
'transpose_flag'
,
'var'
))
error
(
'matlab_faust : invalid file'
);
end
this
=
matlab_faust_core
(
faust_factors
);
else
this
.
objectHandle
=
mexFaust
(
'new'
,
varargin
{:});
end
end
%% Destructor - Destroy the C++ class instance
function
delete
(
this
)
% destructor delete the faust
mexFaust
(
'delete'
,
this
.
objectHandle
);
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