-
3.39.12
|
The FAuST Matlab Wrapper More...
Namespaces | |
demo | |
The matfaust demo namespace. | |
fact | |
The matfaust factorization module. | |
factparams | |
The module for the parametrization of FAuST's algorithms (Palm4MSA and Hierarchical Factorization) | |
poly | |
The matfaust module for polynomial basis as Faust objects. | |
proj | |
This module provides matrix projectors. | |
tools | |
The matfaust tools namespace. | |
Classes | |
class | Faust |
FAuST Matlab wrapper main class for using multi-layer sparse transforms. More... | |
class | FaustMulMode |
Enumeration class of all matrix chain multiplication methods available to multiply a Faust to a matrix or to compute Faust.full(). These methods are used by Faust.optimize_time(). More... | |
Functions | |
function | anticirc (c, varargin) |
Returns an anticirculant Faust A defined by the vector c (which is the last column of full(A)). More... | |
function | bitrev_perm (n) |
Bitreversal permutation. More... | |
function | circ (c, varargin) |
Returns a circulant Faust C defined by the vector c (which is the first column of full(C)). More... | |
function | create_bsr (M, N, bnnz, bdata, bcolinds, brow_count) |
This function is an helper to create a FAµST BSR matrix (kind of matrix that is not natively supported by Matlab). More... | |
function | dct (n, varargin) |
Constructs a Faust implementing the Direct Cosine Transform (Type II) Faust of order n. More... | |
function | dft (n, varargin) |
Constructs a Faust F implementing the Discrete Fourier Transform (DFT) of order n. More... | |
function | dst (n, varargin) |
Constructs a Faust implementing the Direct Sine Transform (Type II) Faust of order n. More... | |
function | enable_gpu_mod (varargin) |
This function loads explicitely the gpu_mod library in memory. More... | |
function | eye (varargin) |
Identity Faust. More... | |
function | faust_fact (varargin) |
This function is a shorthand for matfaust.fact.hierarchical(). More... | |
function | is_gpu_mod_enabled () |
Returns true if the gpu_mod plug-in has been loaded correctly, false otherwise. More... | |
function | is_gpu_mod_working () |
This function returns true if the gpu_mod is working properly false otherwise. More... | |
function | isFaust (obj) |
Package alias of Faust.isFaust. More... | |
function | license () |
Prints the FAuST license. More... | |
function | opt_butterfly_faust (F) |
See matfaust.Faust.opt_butterfly alias. More... | |
function | rand (M, N, varargin) |
Generates a random Faust. More... | |
function | rand_bsr (M, N, BM, BN, varargin) |
Generates a random Faust composed only of BSR matrices. More... | |
function | rand_butterfly (n, varargin) |
Constructs a Faust corresponding to the product of log2(n) square factors of size n with butterfly supports and random nonzero coefficients. More... | |
function | toeplitz (c, varargin) |
Constructs a toeplitz Faust whose first column is c and first row r. More... | |
function | version () |
Returns the FAuST package version. More... | |
function | wht (n, varargin) |
Constructs a Faust implementing the Walsh-Hadamard Transform (WHT) of order n. More... | |
The FAuST Matlab Wrapper
function matfaust::anticirc | ( | c | , |
varargin | |||
) |
Returns an anticirculant Faust A defined by the vector c (which is the last column of full(A)).
c | the vector to define the anticirculant Faust. |
'dev',str | 'gpu' or 'cpu' to create the Faust on CPU or GPU ('cpu' is the default). |
'diag_opt',logical | cf. matfaust.circ. |
Example
A =
Faust size 8x8, density 1.5, nnz_sum 96, 6 factor(s):
See also matfaust.circ, matfaust.toeplitz
function matfaust::bitrev_perm | ( | n | ) |
Bitreversal permutation.
n | the size of the permutation, it must be a power of two. P dimensions will be n x n. |
P | a sparse matrix defining the bit-reversal permutation. |
See also matfaust.dft
function matfaust::circ | ( | c | , |
varargin | |||
) |
Returns a circulant Faust C defined by the vector c (which is the first column of full(C)).
c | the vector to define the circulant Faust. |
'dev',str | 'gpu' or 'cpu' to create the Faust on CPU or GPU ('cpu' is the default). |
'diag_opt',logical | if true then the returned Faust is optimized using matfaust.opt_butterfly_faust (because the DFT is used to implement circ). |
Example:
C =
Faust size 8x8, density 1.5, nnz_sum 96, 6 factor(s):
See also matfaust.anticirc, matfaust.toeplitz
function matfaust::create_bsr | ( | M | , |
N | , | ||
bnnz | , | ||
bdata | , | ||
bcolinds | , | ||
brow_count | |||
) |
This function is an helper to create a FAµST BSR matrix (kind of matrix that is not natively supported by Matlab).
In fact it doesn't directly create a BSR matrix but rather an encoding to create the matrix later through the matfaust.Faust constructor.
M | The number of rows of the BSR matrix. |
N | The number of columns of the BSR matrix. |
bnnz | The number of nonzero blocks of the BSR matrix. |
bdata | The horizontal concatenation of the matrix nonzero blocks taken in rowmajor order. Note that all the nonzero blocks have the same size. |
bcolinds | The block column indices corresponding (in the same order) to the blocks in bdata. A block column index is not a column index, for example if your matrix contains N columns and each nonzero block contains BN columns, the block column indices must lay in {1, …, N/BN}. |
brow_count | The number of nonzero blocks in each block-row of the matrix (a vector of size M/BM, where brow_count(i) is the number of nonzero blocks in the i-th block-row). |
Examples
function matfaust::dct | ( | n | , |
varargin | |||
) |
Constructs a Faust implementing the Direct Cosine Transform (Type II) Faust of order n.
The analytical formula of DCT II used here is: \(2 \sum_{i=0}^{n-1} x_i cos \left( {\pi k (2i + 1)} \over {2n} \right)\)
n | the order of the DCT (it must be a power of two). |
'dev',str | 'gpu' or 'cpu' to create the Faust on CPU or GPU ('cpu' is the default). |
'normed',bool | true (by default) to normalize the returned Faust as if Faust.normalize() was called, false otherwise. |
'class',str | 'single' or 'double'. |
D | the DCT Faust. |
Example
See also matfaust.dft, matfaust.dst, matfaust.Faust.density
function matfaust::dft | ( | n | , |
varargin | |||
) |
Constructs a Faust F implementing the Discrete Fourier Transform (DFT) of order n.
The factorization corresponds to the butterfly structure of the Cooley-Tukey FFT algorithm. The resulting Faust is complex and has (log2(n)+1) sparse factors. The log2(n) first has 2 nonzeros per row and per column. The last factor is a bit-reversal permutation matrix.
Usage
F = dft(n)
F = dft(n, normed)
n | the power of two for a FFT of order n and a factorization in log2(n)+1 factors. |
'normed',bool | true (by default) to normalize the returned Faust as if Faust.normalize() was called, false otherwise. |
'dev',str | 'gpu or 'cpu' to create the Faust on CPU or GPU ('cpu' by default). |
'diag_opt',bool | if true then the returned Faust is optimized using matfaust.opt_butterfly_faust. |
F | the Faust implementing the FFT transform of dimension n. |
Example
F =
Faust size 1024x1024, density 0.0205078, nnz_sum 21504, 11 factor(s):
See also: bitrev_perm, matfaust.wht, matfaust.dct, matfaust.dst, fft, matfaust.rand_butterfly, matfaust.fact.butterfly
function matfaust::dst | ( | n | , |
varargin | |||
) |
Constructs a Faust implementing the Direct Sine Transform (Type II) Faust of order n.
The analytical formula of DST II used here is: \(2 \sum_{i=0}^{n-1} x_i sin \left( {\pi (k+1) (2i + 1)} \over {2n} \right)\)
n | the order of the DST (it must be a power of two). |
'dev',str | 'gpu' or 'cpu' to create the Faust on CPU or GPU ('cpu' is the default). |
'normed',bool | true (by default) to normalize the returned Faust as if Faust.normalize() was called, false otherwise. |
'class',str | 'single' or 'double'. |
D | the DST Faust. |
Example
See also matfaust.dft, matfaust.dct, matfaust.Faust.density
function matfaust::enable_gpu_mod | ( | varargin | ) |
This function loads explicitely the gpu_mod library in memory.
Normally it's not required to load the library manually, but it could be useful to set a non-default path or to diagnose a loading issue.
libpath | the absolute or relative path where to find the dynamic library (gm) to load. By default, it's none to auto-find the library (if possible). |
backend | the GPU backend to use, only 'cuda' is available for now. |
silent | if True nothing or almost will be displayed on loading, otherwise all messages are visible. |
function matfaust::eye | ( | varargin | ) |
Identity Faust.
Usage
eye(m,n) or eye([m,n]) forms a M-by-N Faust F = Faust(speye(M,N)).
eye(m) is a short for eye(m,m).
eye(S, 'complex') with S the size, does the same as above but returns a complex Faust.
eye(S, 'complex', 'dev', 'gpu') or eye(S, 'dev', 'gpu') same as above but creates the Faust on GPU.
'dev',str | 'gpu or 'cpu' to create the Faust on CPU or GPU (by default on CPU). |
'class',str | 'double' (by default) or 'single' to select the scalar type used for the Faust generated. |
Example
function matfaust::faust_fact | ( | varargin | ) |
This function is a shorthand for matfaust.fact.hierarchical().
See also matfaust.fact.hierarchical
function matfaust::is_gpu_mod_enabled | ( | ) |
Returns true if the gpu_mod plug-in has been loaded correctly, false otherwise.
See also matfaust.is_gpu_mod_working
function matfaust::is_gpu_mod_working | ( | ) |
This function returns true if the gpu_mod is working properly false otherwise.
is_gpu_mod_working comes as a complement of matfaust.is_gpu_mod_enabled. The latter ensures that gpu_mod shared library/plugin is properly loaded in memory but doesn't ensure that the GPU is available (for example, the NVIDIA driver might not be installed). The former ensures both that the gpu_mod is loaded and the GPU (device 0) is properly available for computing.
function matfaust::isFaust | ( | obj | ) |
Package alias of Faust.isFaust.
See also Faust.Faust, Faust.isFaust
function matfaust::license | ( | ) |
Prints the FAuST license.
function matfaust::opt_butterfly_faust | ( | F | ) |
See matfaust.Faust.opt_butterfly alias.
function matfaust::rand | ( | M | , |
N | , | ||
varargin | |||
) |
Generates a random Faust.
Usage
rand(M,N) generates a M-by-N Faust object. The numbers of rows and columns of intermediary factors are all randomly chosen between M and N (included). The number of factors is 5. The factors are sparse and real. The nnz per row of factors is 5.
rand(M, N, 'num_factors', NF, 'dim_sizes', S) with NF and S two integers, generates a M-by-N Faust of NF factors. The factor size is S for both dimensions (except the first factor number of rows and the last factor number of columns which are respectively M and N). The factors are sparse and real.
rand(M, N, 'num_factors', [N1, N2], 'dim_sizes', S) same as above except that here the number of factors is randomly chosen between N1 and N2 inclusively.
rand(M, N, 'num_factors', [N1, N2], [S1, S2]) or rand(M, N, 'num_factors', NF, 'dim_sizes', [S1, S2]) same as above except that here the intermediary factor dimension sizes are random; the number of rows and columns are both randomly chosen between S1 and S2 inclusively.
rand(M, N, 'num_factors', NF, 'dim_sizes', S, 'density', D) or rand(M, N, 'num_factors', [N1, N2], 'dim_sizes', [S1, S2], 'density', D) same as above but specifying D the approximate density of each factor.
rand(M, N, 'num_factors', NF, 'dim_sizes', S, 'density', D, 'per_row', true) or rand(M, N, 'num_factors', [N1, N2], 'dim_sizes', [S1, S2], 'density',D, 'per_row', true) same as above but specifying D, the density of each factor per row ('per_row', true) or per column ('per_row', false).
rand(M, N, 'num_factors', NF, 'dim_sizes', S, 'density', D, 'fac_type', 'dense') or rand(M, N, 'num_factors', [N1, N2], 'dim_sizes', [S1, S2], 'density', D, 'fac_type', 'dense') same as above but generating only dense matrices as factors.
rand(M, N, 'num_factors', NF, 'dim_sizes', S, 'density', D, 'mixed') or rand(M, N, 'num_factors', [N1, N2], 'dim_sizes', [S1, S2], 'density', D, 'fac_type', 'sparse') same as above but generating either sparse or dense matrices as factors.
rand(M, N, 'num_factors', NF, 'dim_sizes', S, 'density', D, 'fac_type', 'sparse', 'field' , 'complex'), rand(M, N, 'num_factors', [N1, N2], 'dim_sizes', [S1, S2], 'density', D, 'fac_type', 'sparse', 'per_row', false), rand(M, N, 'num_factors', NF, 'dim_sizes', S, 'density', D, 'fac_type', 'dense', 'field' , 'complex') or rand(M, N, 'num_factors', [N1, N2], 'dim_sizes', [S1, S2], D, 'fac_type', 'dense', 'field', 'complex') same as above but generating a complex Faust, that is, matrices defined over the complex field.
M | the Faust number of rows. |
N | the Faust number of columns. |
'num_factors',NF | if it's an integer it is the number of random factors to set in the Faust. If NF is a vector of 2 integers then the number of factors is set randomly between NF(1) and NF(2) (inclusively). Defaultly, a 5 factors long Faust is generated. |
'dim_sizes',S | if it's an integer all Faust factors are square matrices (except maybe the first and last ones, depending on M and N). The size of the intermediary square factors is S**2. If it's a vector of 2 integers then the number of rows and columns are both a random number between size_dims(1) and size_dims(2) (inclusively). Defaultly, dim_sizes is [M, N]. |
'density',D | the approximate density of generated factors. D must be a floating point number greater than 0 and lower of equal to 1. The default value is such that each factor gets 5 non-zero elements per row, if per_row is true, or per column otherwise. A density of zero is equivalent to the default case. |
'per_row',bool | this argument is to specify the density per row or per column. By default the density is set per row and is such that the Faust's factors will have 5 non-zero elements per row. |
fac_type,str | the storage representation of factors. str must be 'sparse', 'dense' or 'mixed'. The latter designates a mix of dense and sparse matrices in the generated Faust (the choice is made according to a uniform distribution). The default value is 'sparse'. |
'field',str | str is either 'real' or 'complex' (the Faust field). The default value is 'real'. |
'dev',str | 'gpu or 'cpu' to create the random Faust on CPU or GPU (by default on CPU). |
'class',str | 'double' (by default) or 'single' to select the scalar type used for the Faust generated. |
'seed',int | seed to initialize the PRNG used to generate the Faust factors. If 0 (default) the seed will be initialized with a random value depending of the time clock. |
F | the random Faust. |
Example 1
Example 2
Example 3
See also Faust.Faust, matfaust.rand_bsr.
function matfaust::rand_bsr | ( | M | , |
N | , | ||
BM | , | ||
BN | , | ||
varargin | |||
) |
Generates a random Faust composed only of BSR matrices.
M | the number of rows of the random Faust. |
N | the number of columns of the random Faust. |
BM | the nonzero block number of rows (must divide M). |
BN | the nonzero block number of columns (must divide N). |
'num_factors',NF | if it's an integer it will be the number of random factors to set in the Faust. If NF is a vector of 2 integers then the number of factors will be set randomly between NF(1) and NF(2) (inclusively). |
'density',D | the approximate density of generated factors. D must be a floating point number between 0 and 1. |
'field',str | str is either 'real' or 'complex' to set the Faust field. The default value is 'real'. |
'dev',str | 'cpu' or 'gpu' to create the random Faust on CPU or GPU (by default on CPU). |
'class',str | 'double' (by default) or 'single' to select the scalar type used for the generated Faust. |
F | the random Faust. |
Example 1
Example 2
See also Faust.Faust, matfaust.rand.
function matfaust::rand_butterfly | ( | n | , |
varargin | |||
) |
Constructs a Faust corresponding to the product of log2(n) square factors of size n with butterfly supports and random nonzero coefficients.
The random coefficients are drawn i.i.d. according to a standard Gaussian (real or complex circular according to the type).
n | order of the butterfly (must be a power of two). |
diag_opt,logical | if true then the returned Faust is optimized using matfaust.opt_butterfly_faust. |
'dev',str | 'gpu or 'cpu' to create the Faust on CPU or GPU ('cpu' by default). |
'field',str | str is either 'real' or 'complex' (the Faust field). The default value is 'real'. |
'class',str | 'double' (by default) or 'single' to select the scalar type used for the Faust generated. |
F | a random butterfly support Faust. |
See also: matfaust.fact.butterfly, matfaust.rand_butterfly, matfaust.dft, matfaust.opt_butterfly_faust
function matfaust::toeplitz | ( | c | , |
varargin | |||
) |
Constructs a toeplitz Faust whose first column is c and first row r.
Usage
T = toeplitz(c), T is a symmetric Toeplitz Faust whose the first column is c.
T = toeplitz(c, r), T is a Toeplitz Faust whose the first column is c and the first row is [c(1), r(2:)]
c | the first column of the toeplitz Faust. |
r | (2nd argument) the first row of the toeplitz Faust. Defaulty r = conj(c). r(1) is ignored, the first row is always [c(1), r(2:)]. |
'dev',str | 'gpu' or 'cpu' to create the Faust on CPU or GPU ('cpu' is the default). |
'diag_opt',logical | cf. matfaust.circ. |
T | the toeplitz Faust. |
Example
Faust size 10x10, density 5.52, nnz_sum 552, 10 factor(s):
T2 =
Faust size 10x10, density 5.52, nnz_sum 552, 10 factor(s):
See also matfaust.circ, matfaust.anticirc
function matfaust::version | ( | ) |
Returns the FAuST package version.
function matfaust::wht | ( | n | , |
varargin | |||
) |
Constructs a Faust implementing the Walsh-Hadamard Transform (WHT) of order n.
The resulting Faust has log2(n) sparse factors of order n, each one having 2 nonzeros per row and per column.
Usage
H = wht(n)
H = wht(n, 'normed', bool)
H = wht(n, 'normed', bool, 'dev', str) str might be 'cpu' or 'gpu'.
n | order of the WHT (must be a power of two). |
'normed',bool | (optional) true (by default) to normalize the returned Faust as if Faust.normalize() was called, false otherwise. |
'dev',str | (optional) 'cpu' to create a CPU Faust (default choice) and 'gpu' for a GPU Faust. |
'dtype',str | (optional) 'double' (default choice) or 'float' to select the scalar type of the generated Faust. |
H | the Faust implementing the Hadamard transform of dimension n. |
Example
H =
Faust size 1024x1024, density 0.0195312, nnz_sum 20480, 10 factor(s):
FACTOR 9 (real) SPARSE, size 1024x1024, density 0.00195312, nnz 2048
See also: hadamard, matfaust.dft, matfaust.rand_butterfly, matfaust.fact.butterfly