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.4.
Show more breadcrumbs
faust group
faust
Commits
aa9f822f
Commit
aa9f822f
authored
3 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Update matfaust.wht to support CPU and GPU float type.
parent
ce811c09
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/+matfaust/wht.m
+20
-4
20 additions, 4 deletions
wrapper/matlab/+matfaust/wht.m
with
20 additions
and
4 deletions
wrapper/matlab/+matfaust/wht.m
+
20
−
4
View file @
aa9f822f
...
...
@@ -13,6 +13,7 @@
%> @param n the power of two exponent for a Hadamard matrix of order n and a factorization into log2(n) factors.
%> @param 'normed',bool: (optional) true (by default) to normalize the returned Faust as if Faust.normalize() was called, false otherwise.
%> @param 'dev',str: (optional) 'cpu' to create a CPU Faust (default choice) and 'gpu' for a GPU Faust.
%> @param 'dtype', 'double' (by default) or 'float' (optional) to select the scalar type used for the Faust generated.
%>
%> @retval H the Faust implementing the Hadamard transform of dimension n.
%>
...
...
@@ -54,6 +55,7 @@ function H = wht(n, varargin)
end
normed
=
true
;
% normalization by default
dev
=
'cpu'
;
dtype
=
'double'
;
argc
=
length
(
varargin
);
if
(
argc
>
0
)
for
i
=
1
:
2
:
argc
...
...
@@ -74,22 +76,36 @@ function H = wht(n, varargin)
else
dev
=
tmparg
;
end
case
'dtype'
if
(
argc
==
i
||
~
strcmp
(
tmparg
,
'float'
)
&&
~
strcmp
(
tmparg
,
'double'
))
error
(
'dtype keyword argument is not followed by a valid value: float, double.'
)
else
dtype
=
tmparg
;
end
otherwise
if
((
isstr
(
varargin
{
i
})
||
ischar
(
varargin
{
i
}))
&&
~
strcmp
(
tmparg
,
'cpu'
)
&&
~
startsWith
(
tmparg
,
'gpu'
))
if
((
isstr
(
varargin
{
i
})
||
ischar
(
varargin
{
i
}))
&&
~
strcmp
(
tmparg
,
'cpu'
)
&&
~
startsWith
(
tmparg
,
'gpu'
)
&&
~
strcmp
(
tmparg
,
'float'
)
&&
~
strcmp
(
tmparg
,
'double'
)
)
error
([
tmparg
' unrecognized argument'
])
end
end
end
end
if
(
strcmp
(
dev
,
'cpu'
))
core_obj
=
mexFaustReal
(
'hadamard'
,
log2n
,
normed
);
if
(
strcmp
(
dtype
,
'double'
))
core_obj
=
mexFaustReal
(
'hadamard'
,
log2n
,
normed
);
else
% float
core_obj
=
mexFaustRealFloat
(
'hadamard'
,
log2n
,
normed
);
end
else
core_obj
=
mexFaustGPUReal
(
'hadamard'
,
log2n
,
normed
);
if
(
strcmp
(
dtype
,
'double'
))
core_obj
=
mexFaustGPUReal
(
'hadamard'
,
log2n
,
normed
);
else
% float
core_obj
=
mexFaustGPURealFloat
(
'hadamard'
,
log2n
,
normed
);
end
end
is_real
=
true
;
e
=
MException
(
'FAUST:OOM'
,
'Out of Memory'
);
if
(
core_obj
==
0
)
throw
(
e
)
end
H
=
matfaust
.
Faust
(
core_obj
,
is_real
,
dev
);
H
=
matfaust
.
Faust
(
core_obj
,
is_real
,
dev
,
dtype
);
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