p: the ParamsHierarchicalFact instance to define the algorithm parameters.
p: is a set of factorization parameters. It might be a fully defined instance of parameters (pyfaust.factparams.ParamsHierarchicalFact) or a simplified expression which designates a pre-defined parametrization:
- 'squaremat' to use pre-defined parameters typically used to factorize a Hadamard square matrix of order a power of two (see pyfaust.demo.hadamard).
- ['rectmat', j, k, s] to use pre-defined parameters used for instance in factorization of the MEG matrix which is a rectangular matrix of size m*n such that m < n (see pyfaust.demo.bsl); j is the number of factors, k the sparsity of the main factor's columns, and s the sparsity of rows for all other factors except the residuum (that is the first factor here because the factorization is made toward the left -- is_side_fact_left == true, cf. pyfaust.factparams.ParamsHierarchicalFact).
</br>The residuum has a sparsity of P*rho^(num_facts-1). <br/> By default, rho == .8 and P = 1.4. It's possible to set custom values with for example p == ( ['rectmat', j, k, s], {'rho':.4, 'P':.7 }). <br/>The sparsity is here the number of non-zero elements.
@note - The fully defined parameters (ParamsHierarchicalFact instance) used/generated by the function are available in the return result (so one can consult what precisely mean the simplified parameterizations and possibly adjust the attributes to factorize again).
@note - This function has its shorthand pyfaust.faust_fact(). For convenience you might use it like this:
<code>
from pyfaust import *
F = faust_fact(M, p) % equiv. to FaustFactory.fact_hierarchical(M, p)
</code>
ret_lambda: set to True to ask the function to return the scale factor (False by default).
ret_params: set to True to ask the function to return the
ParamsHierarchicalFact instance used (False by default).
Returns:
The Faust object result of the factorization.
F the Faust object result of the factorization.<br/>
if ret_lambda == True (and ret_params == False), then the function
returns the tuple (F,_lambda) (_lambda is the scale factor at the
end of factorization).<br/>
if ret_params == True (and ret_lambda == False), then the function
returns the tuple (F, p) (p being the ParamsHierarchicalFact
instance really used by the algorithm).<br/>
if ret_lambda == True and ret_params == True, then the function
returns the tuple (F, _lambda, p).
Examples:
<b> 1. Fully Defined Parameters for a Random Matrix Factorization </b>