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
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
faust group
faust
Commits
987da1f9
Commit
987da1f9
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Handle class argument in matfaust.dct/dst.
parent
4dc598c1
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
wrapper/matlab/+matfaust/dct.m
+13
-2
13 additions, 2 deletions
wrapper/matlab/+matfaust/dct.m
wrapper/matlab/+matfaust/dst.m
+10
-0
10 additions, 0 deletions
wrapper/matlab/+matfaust/dst.m
with
23 additions
and
2 deletions
wrapper/matlab/+matfaust/dct.m
+
13
−
2
View file @
987da1f9
...
...
@@ -7,6 +7,7 @@
%> @param n: the order of the DCT (it must be a power of two).
%> @param 'dev', str: 'gpu' or 'cpu' to create the Faust on CPU or GPU ('cpu' is the default).
%> @param 'normed',bool: true (by default) to normalize the returned Faust as if Faust.normalize() was called, false otherwise.
%> @param 'class', str: 'single' or 'double'.
%>
%>
%> @b Example
...
...
@@ -41,10 +42,11 @@
%=========================================
function
D
=
dct
(
n
,
varargin
)
import
matfaust
.
Faust
DFT
=
matfaust
.
dft
(
n
,
varargin
{:},
'normed'
,
false
);
DFT
=
matfaust
.
dft
(
n
,
'normed'
,
false
);
normed
=
true
;
% normalization by default
dev
=
'cpu'
;
argc
=
length
(
varargin
);
class
=
'double'
;
if
(
argc
>
0
)
for
i
=
1
:
2
:
argc
if
(
argc
>
i
)
...
...
@@ -64,8 +66,14 @@ function D = dct(n, varargin)
else
dev
=
tmparg
;
end
case
'class'
if
(
argc
==
i
||
~
strcmp
(
tmparg
,
'double'
)
&&
~
startsWith
(
tmparg
,
'single'
))
error
(
'class keyword argument is not followed by a valid value: single or double.'
)
else
class
=
tmparg
;
end
otherwise
if
((
isstr
(
varargin
{
i
})
||
ischar
(
varargin
{
i
}))
&&
~
strcmp
(
tmparg
,
'cpu'
)
&&
~
startsWith
(
tmparg
,
'gpu'
))
if
((
isstr
(
varargin
{
i
})
||
ischar
(
varargin
{
i
}))
&&
~
any
(
strcmp
(
tmparg
,
{
'cpu'
})
)
&&
~
startsWith
(
tmparg
,
'gpu'
))
error
([
tmparg
' unrecognized argument'
])
end
end
...
...
@@ -101,4 +109,7 @@ function D = dct(n, varargin)
if
(
strcmp
(
dev
,
'gpu'
))
D
=
clone
(
D
,
'dev'
,
'gpu'
);
end
if
(
strcmp
(
class
,
'single'
))
D
=
single
(
D
);
end
end
This diff is collapsed.
Click to expand it.
wrapper/matlab/+matfaust/dst.m
+
10
−
0
View file @
987da1f9
...
...
@@ -44,6 +44,7 @@ function D = dst(n, varargin)
normed
=
true
;
% normalization by default
dev
=
'cpu'
;
argc
=
length
(
varargin
);
class
=
'double'
;
if
(
argc
>
0
)
for
i
=
1
:
2
:
argc
if
(
argc
>
i
)
...
...
@@ -63,6 +64,12 @@ function D = dst(n, varargin)
else
dev
=
tmparg
;
end
case
'class'
if
(
argc
==
i
||
~
strcmp
(
tmparg
,
'double'
)
&&
~
startsWith
(
tmparg
,
'single'
))
error
(
'class keyword argument is not followed by a valid value: single or double.'
)
else
class
=
tmparg
;
end
otherwise
if
((
isstr
(
varargin
{
i
})
||
ischar
(
varargin
{
i
}))
&&
~
strcmp
(
tmparg
,
'cpu'
)
&&
~
startsWith
(
tmparg
,
'gpu'
))
error
([
tmparg
' unrecognized argument'
])
...
...
@@ -104,6 +111,9 @@ function D = dst(n, varargin)
if
(
strcmp
(
dev
,
'gpu'
))
D
=
clone
(
D
,
'dev'
,
'gpu'
);
end
if
(
strcmp
(
class
,
'single'
))
D
=
single
(
D
);
end
end
function
O
=
omega
(
N
)
...
...
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