Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 396f41ee authored by hhakim's avatar hhakim
Browse files

Add matfaust.factparams.ParamsHierarchicalDFT simplified parameter structure...

Add matfaust.factparams.ParamsHierarchicalDFT simplified parameter structure to factorize a DFT matrix with matfaust.fact.hierarchical.

Use case:

import matfaust.dft
import matfaust.fact.hierarchical
import matfaust.factparams.ParamsHierarchicalDFT

d = 32
p = ParamsHierarchicalDFT(log2(d))
DFT = full(dft(d))
F = hierarchical(DFT, p)
norm(full(F)-DFT)/norm(DFT)

% or simply:
F = hierarchical(DFT, 'dft')
norm(full(F)-DFT)/norm(DFT)
parent 76cf1517
Branches
Tags 3.3.0
No related merge requests found
Pipeline #834095 skipped
......@@ -31,7 +31,7 @@ if(BUILD_DOCUMENTATION)
string(CONCAT DOXYGEN_FILE_PATTERNS "*.cpp *.hpp *.h *.cu *.hu")
endif()
if(BUILD_WRAPPER_MATLAB)
string(CONCAT DOXYGEN_FILE_PATTERNS ${DOXYGEN_FILE_PATTERNS} " Faust.m FaustMulMode.m StoppingCriterion.m ConstraintGeneric.m ConstraintMat.m ConstraintReal.m ConstraintInt.m ConstraintName.m ParamsFact.m ParamsHierarchical.m ParamsPalm4MSA.m FaustFactory.m hadamard.m quickstart.m fft.m bsl.m runtimecmp.m runall.m version.m faust_fact.m ParamsHierarchicalSquareMat.m ParamsHierarchicalRectMat.m license.m omp.m wht.m dft.m eye.m rand.m eigtj.m hierarchical.m fact.m palm4msa.m fgft_givens.m fgft_palm.m svdtj.m splin.m spcol.m proj_gen.m sp.m const.m supp.m hankel.m toeplitz.m circ.m normcol.m normlin.m splincol.m blockdiag.m skperm.m enable_gpu_mod.m isFaust.m poly.m basis.m next.m expm_multiply.m FaustPoly.m MHTPParams.m palm4msa_mhtp.m hierarchical_mhtp.m butterfly.m ") # warning: the space on the end matters
string(CONCAT DOXYGEN_FILE_PATTERNS ${DOXYGEN_FILE_PATTERNS} " Faust.m FaustMulMode.m StoppingCriterion.m ConstraintGeneric.m ConstraintMat.m ConstraintReal.m ConstraintInt.m ConstraintName.m ParamsFact.m ParamsHierarchical.m ParamsPalm4MSA.m FaustFactory.m hadamard.m quickstart.m fft.m bsl.m runtimecmp.m runall.m version.m faust_fact.m ParamsHierarchicalSquareMat.m ParamsHierarchicalRectMat.m license.m omp.m wht.m dft.m eye.m rand.m eigtj.m hierarchical.m fact.m palm4msa.m fgft_givens.m fgft_palm.m svdtj.m splin.m spcol.m proj_gen.m sp.m const.m supp.m hankel.m toeplitz.m circ.m normcol.m normlin.m splincol.m blockdiag.m skperm.m enable_gpu_mod.m isFaust.m poly.m basis.m next.m expm_multiply.m FaustPoly.m MHTPParams.m palm4msa_mhtp.m hierarchical_mhtp.m butterfly.m ParamsHierarchicalDFT.m ") # warning: the space on the end matters
endif()
if(BUILD_WRAPPER_PYTHON)
string(CONCAT DOXYGEN_FILE_PATTERNS ${DOXYGEN_FILE_PATTERNS} "__init__.py factparams.py demo.py tools.py fact.py proj.py poly.py")
......
......@@ -138,7 +138,7 @@ function varargout = hierarchical(M, p, varargin)
if(~ p.is_mat_consistent(M))
error('M''s number of columns must be consistent with the last residuum constraint defined in p. Likewise its number of rows must be consistent with the first factor constraint defined in p.')
end
mex_params = p.to_mex_struct()
mex_params = p.to_mex_struct();
backend = 2016;
nargin = length(varargin);
gpu = false;
......
......@@ -174,7 +174,7 @@ classdef (Abstract) ParamsFact
p.is_verbose = is_verbose;
p.constant_step_size = constant_step_size;
p.grad_calc_opt_mode = grad_calc_opt_mode;
p.factor_format = ParamsFact.factor_format_str2int(factor_format)
p.factor_format = ParamsFact.factor_format_str2int(factor_format);
p.packing_RL = packing_RL;
p.norm2_max_iter = norm2_max_iter;
p.norm2_threshold = norm2_threshold;
......@@ -203,7 +203,7 @@ classdef (Abstract) ParamsFact
end
elseif(isreal(factor_format) && factor_format >= 0 && factor_format <=2)
% already a int or real to truncate
ff_int = floor(factor_format)
ff_int = floor(factor_format);
else
error('factor_format should be a char array: ''dense'', ''sparse'' or ''dynamic''')
end
......
......@@ -2,10 +2,12 @@ classdef ParamsFactFactory
properties(Constant)
SIMPLIFIED_PARAMS = {
{'squaremat', 'hadamard'},
{'rectmat', 'meg'}
{'rectmat', 'meg'},
{'dft'}
};
SQRTMAT_ID = 1;
RECTMAT_ID = 2;
DFTMAT_ID = 3;
end
methods(Static)
function sp = createParams(M, p)
......@@ -24,6 +26,8 @@ classdef ParamsFactFactory
sp = ParamsHierarchicalSquareMat.createParams(M, p);
elseif(strcmp_anycell(param_id, ParamsFactFactory.SIMPLIFIED_PARAMS{ParamsFactFactory.RECTMAT_ID}))
sp = ParamsHierarchicalRectMat.createParams(M, p);
elseif(strcmp_anycell(param_id, ParamsFactFactory.SIMPLIFIED_PARAMS{ParamsFactFactory.DFTMAT_ID}))
sp = ParamsHierarchicalDFT.createParams(M, p);
else
error('p is not a known simplified parametrization')
end
......
% =========================================================
%> @brief The simplified parameterization class for factorizing a square matrix (of order a power of two) with the hierarchical factorization algorithm.
%> @brief The simplified parameterization class for factorizing a Hadamard matrix using the hierarchical factorization algorithm.
%>
%> This type for parameters is typically used for Hadamard matrix factorization.
%>
%> <p>@b See @b also matfaust.demo.hadamard, matfaust.FaustFactory.fact_hierarchical</p>
%> <p>@b See @b also matfaust.demo.hadamard, matfaust.fact.hierarchical</p>
% =========================================================
classdef ParamsHierarchicalSquareMat < matfaust.factparams.ParamsHierarchical
methods
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment