-
3.41.0
|
FAuST Matlab wrapper main class for using multi-layer sparse transforms. More...
Public Member Functions | |
function | Faust (varargin) |
Creates a Faust from a list of factors or alternatively from a file. More... | |
function | delete (F) |
Deletes the Faust object F (destructor). More... | |
function | uplus (F) |
Returns + F. More... | |
function | uminus (F) |
Returns - F. More... | |
function | plus (varargin) |
Plus. More... | |
function | minus (varargin) |
Minus. More... | |
function | mrdivide (F, s) |
/ Slash or right Faust divide. More... | |
function | mtimes (F, A) |
Multiplies the Faust F by A which is a full matrix, a Faust object or a scalar. More... | |
function | full (F) |
The full matrix implemented by F. More... | |
function | isreal (F) |
Indicates if F is a real Faust or a complex Faust. More... | |
function | real (F) |
Returns the real part of the Faust F. More... | |
function | imag (F) |
Returns the imaginary part of the Faust F. More... | |
function | single (F) |
Returns a new Faust whose class is single. It allows to convert all the factors to single precision. More... | |
function | double (F) |
Returns a new Faust whose class is double. It allows to convert all the factors to double precision. More... | |
function | transpose (F) |
The transpose of F. More... | |
function | ctranspose (F) |
The conjugate transpose of F. More... | |
function | conj (F) |
The complex conjugate of F. More... | |
function | pruneout (F, varargin) |
Returns a Faust optimized by removing useless zero rows and columns as many times as needed. More... | |
function | optimize_memory (F) |
Optimizes a Faust by changing the storage format of each factor in order to optimize the memory size. More... | |
function | optimize (F, varargin) |
Returns a Faust optimized with Faust.pruneout, Faust.optimize_memory and Faust.optimize_time. More... | |
function | optimize_time (F, varargin) |
Returns a Faust configured with the quickest Faust-matrix multiplication mode (benchmark ran on the fly). More... | |
function | size (F, varargin) |
The size of F. More... | |
function | numel (F) |
The number of elements in F. More... | |
function | nbytes (F) |
Gives the memory size of the Faust in bytes. More... | |
function | end (F, k, n) |
The last index when slicing or indexing a Faust. More... | |
function | factors (F, ids, varargin) |
Returns the i-th factor or a new Faust composed of F factors whose indices are listed in indices. More... | |
function | left (F, i, varargin) |
Returns the left hand side factors of F from index 1 to i included (in 1-base index). More... | |
function | right (F, i, varargin) |
Returns the right hand side factors of F from index i to end (in 1-base index). More... | |
function | numfactors (F) |
The number of factors of F. More... | |
function | length (F) |
The number of factors of F. More... | |
function | replace (F, i, new_factor) |
Replaces the factor of index i by new_factor in a new Faust copy of F. More... | |
function | insert (F, i, new_factor) |
Inserts new_factor at index i in a new Faust copy of F. More... | |
function | issparse (F, varargin) |
Returns true if F factors are all sparse matrices false otherwise. More... | |
function | isdense (F) |
Returns true if F factors are all dense matrices/arrays false otherwise. More... | |
function | save (F, filepath) |
Saves the Faust F into a file. More... | |
function | subsref (F, S) |
Subscripted reference of a Faust. More... | |
function | disp (F) |
Displays information about F. More... | |
function | norm (F, varargin) |
The matrix norm of F. More... | |
function | power_iteration (F, varargin) |
Performs the power iteration algorithm to compute the greatest eigenvalue of the Faust. More... | |
function | normalize (F, varargin) |
Returns the normalized F. More... | |
function | nnz_sum (F) |
The total number of nonzeros in the factors of F. More... | |
function | density (F) |
The density of F such that nnz_sum(F) == density(F) * numel(F). More... | |
function | rcg (F) |
The Relative Complexity Gain of F. More... | |
function | cat (varargin) |
Concatenates F with n Faust objects or full/sparse matrices. More... | |
function | horzcat (varargin) |
Horizontal concatenation [F,A, B, … ] where F is a Faust and A, B, … are Faust objects or sparse/full matrix. More... | |
function | vertcat (varargin) |
Vertical concatenation [F;A;B;…] where F is a Faust and A, B, … are Faust objects or sparse/full matrices. More... | |
function | imagesc (F, varargin) |
Displays image of F full matrix and its factors. More... | |
function | mldivide (F, B) |
\ Backslash or left full(F) divide. More... | |
function | pinv (F) |
Pseudoinverse matrix of full(F). More... | |
function | complex (F) |
Converts F to a new complex Faust. More... | |
function | clone (F, varargin) |
Clones the Faust (in a new memory space). More... | |
function | device (F) |
Returns the Faust device ('cpu' or 'gpu'). More... | |
function | class (F) |
Returns the Faust class ('single' or 'double'). More... | |
function | get_handle (F) |
Returns the Faust F C++ native object pointer as an integer. More... | |
Static Public Member Functions | |
static function | opt_butterfly (F) |
Optimizes any Faust composed of butterfly factors. More... | |
static function | isFaust (obj) |
Returns true if obj is a Faust object, false otherwise. More... | |
static function | load (filepath, varargin) |
Loads a Faust from a .mat file. More... | |
static function | load_native (filepath) |
Loads a Faust from a .mat file (native C++ version). More... | |
Protected Attributes | |
Property | matrix |
Underlying Faust native object handle. More... | |
Property | is_real |
See Faust.isreal. More... | |
Property | dev |
See Faust.device. More... | |
Property | dtype |
See Faust.class. More... | |
FAuST Matlab wrapper main class for using multi-layer sparse transforms.
This class provides a Matlab array-like interface for operations with FAuST data structures, which correspond ideally to matrices that can be written exactly as the product of sparse matrices.
The Faust class is designed to allow fast matrix-vector multiplications together with reduced memory storage compared to what would be obtained by manipulating directly the corresponding (dense) Matlab array.
A particular example is the matrix associated to the discrete Fourier transform, which can be represented exactly as a Faust, leading to a fast and compact implementation (see matfaust.dft()).
Although sparse matrices are more interesting for optimization it's not forbidden to define a Faust as a product of dense matrices or a mix of dense and sparse matrices.
The matrices composing the Faust product, also called the factors, are defined on complex or real fields. Hence a Faust can be a complex Faust or a real Faust.
Several Matlab builtins have been overloaded to ensure that a Faust is almost handled as a native Matlab matrix.
The main exception is that contrary to a Matlab native array a Faust is immutable. It means that you cannot modify elements of a Faust using the assignment operator ‘=’ as made with a Matlab matrix (e.g. ‘M(i,j) = 2’). That limitation is the reason why the Matlab built-in ‘SUBSASGN()’ is not implemented in this class. Note however that you can optionally contravene the immuability in certain functions (e.g. with the inplace
argument of the Faust.optimize_time).
Other noticeable limitations are that one cannot:
Mainly for convenience and test purposes, a Faust can be converted into the corresponding full matrix using the function Faust.full.
In this documentation, the expression 'full matrix' designates the Matlab array Faust.full() obtained by the multiplication of the Faust factors.
List of functions that are memory costly:
For more information about FAuST take a look at https://faust.inria.fr.
function matfaust::Faust::Faust | ( | varargin | ) |
Creates a Faust from a list of factors or alternatively from a file.
Other easy ways to create a Faust is to call one of the following functions: matfaust.rand(), matfaust.dft() or matfaust.wht().
Usage
Faust(factors) creates a Faust from a list of factors (1D cell array).
Faust(filepath) creates a Faust from a previously saved Faust file (filepath is a character array).
factors | (varargin{1}, first argument) the 1D cell array of factors to initialize the Faust with. The factors must respect the dimensions needed for the product to be defined (for i=1 to size(factors,2), size(factors{i},2) == size(factors{i+1},1)). The factors can be sparse, dense or BSR matrices. It might be real matrices in single or double precision but also complex matrices. The created Faust will be consequently a single, double or complex Faust. To create a BSR matrix you must use the matfaust.create_bsr function. Passing a single matrix to the constructor instead of a cell array is equivalent to passing a singleton cell array. |
filepath | (varargin{1}, first argument) the file from which a Faust is created. It must be a character array. The format is Matlab version 5 (.mat extension). The file must have been saved before with Faust.save(). |
'dev',str | 'gpu or 'cpu' to create the Faust on CPU or GPU (by default on CPU). Examples |
See also Faust.delete, Faust.save, matfaust.rand, matfaust.dft, matfaust.wht
function matfaust::Faust::cat | ( | varargin | ) |
Concatenates F with n Faust objects or full/sparse matrices.
This function overloads a Matlab built-in function.
The resulting Faust C = cat(DIM,F,G,…) verifies that:
Usage
C=CAT(DIM,F,G) concatenates the Faust F and G, which is a Faust or a matrix, along the dimension DIM. The result is the Faust C.
CAT(2,F,G) is the same as [F,G].
CAT(1,F,G) is the same as [F;G].
CAT(DIM, F, G,…) concatenates an arbitrary number of Fausts and matrices along the DIM-th dimension.
DIM | (1st arg.) the dimension along which to concatenate. DIM==1 means vertical concatenation, DIM==2 means horizontal concatenation. |
F | (2nd arg.) the first Faust object. |
G,… | (3rd to n+3 args) the Faust objects or matrices to concatenate to F. The matrices can be sparse or full. |
C | the concatenation result as a new Faust. |
Example
Errors
See also Faust.vertcat, Faust.horzcat.
function matfaust::Faust::class | ( | F | ) |
function matfaust::Faust::clone | ( | F | , |
varargin | |||
) |
Clones the Faust (in a new memory space).
'dev',str | 'gpu or 'cpu' to clone the Faust on CPU or GPU (by default on CPU). |
Example
Fc | the Faust clone. |
function matfaust::Faust::complex | ( | F | ) |
Converts F to a new complex Faust.
This function overloads a Matlab built-in function.
Usage
cF = COMPLEX(F) for real Faust F returns the complex result cF with real part F and zero matrix as imaginary part of all cF's factors.
Example:
See also Faust.isreal, Faust.conj
function matfaust::Faust::conj | ( | F | ) |
The complex conjugate of F.
This function overloads a Matlab built-in function.
Usage
F_conj = conj(F)
F | the Faust object. |
F_conj | a Faust object implementing the conjugate of full(F), such that:full(F_conj) == conj(full(F)) |
Example
See also Faust.transpose, Faust.ctranspose, Faust.complex
function matfaust::Faust::ctranspose | ( | F | ) |
The conjugate transpose of F.
This function overloads a Matlab built-in function/operator.
Usage
F_ctrans = ctranspose(F)
F_ctrans = F'
F | the Faust object. |
F_ctrans | a Faust object implementing the conjugate transpose of full(F), such that:full(F_ctrans) == full(F)' == ctranspose(full(F)) |
Example
See also Faust.transpose, Faust.conj, Faust.complex
function matfaust::Faust::delete | ( | F | ) |
Deletes the Faust object F (destructor).
Usage
F | the Faust to delete. |
Example
See also Faust.Faust, clear (built-in)
function matfaust::Faust::density | ( | F | ) |
The density of F such that nnz_sum(F) == density(F) * numel(F).
Usage
dens = density(F)
F | the Faust object. |
dens | density of F. |
Example
See also Faust.nnz_sum, Faust.rcg, Faust.size, Faust.numel
function matfaust::Faust::device | ( | F | ) |
Returns the Faust device ('cpu' or 'gpu').
dev | the Faust device. |
Example:
function matfaust::Faust::disp | ( | F | ) |
Displays information about F.
This function overloads a Matlab built-in function.
Usage
disp(F)
F
F | the Faust object. |
Example
See also Faust.nnz_sum, Faust.density, Faust.size, Faust.factors, Faust.numfactors
function matfaust::Faust::double | ( | F | ) |
Returns a new Faust whose class is double. It allows to convert all the factors to double precision.
Usage
dF = double(F)
sF | the double class/precision Faust. |
Example:
See also Faust.class, Faust.single
function matfaust::Faust::end | ( | F | , |
k | , | ||
n | |||
) |
The last index when slicing or indexing a Faust.
size(F, K) == end
when indexing the K-th dimension of F \((K \in {1, 2})\).
This function overloads a Matlab built-in function.
Example
See also Faust.subsref, Faust.size
function matfaust::Faust::factors | ( | F | , |
ids | , | ||
varargin | |||
) |
Returns the i-th factor or a new Faust composed of F factors whose indices are listed in indices.
Usage
factor = factors(F, i) returns the i-th factor of F.
factor = factors(F, i:j) returns a new Faust formed of the F's factors from the i-th to the j-th included.
F | the Faust object. |
ids | the factor indices. |
'as_faust',logical | (optional): true to return a Faust even if a single factor is asked (length(ids) == 1), otherwise (as_faust == false) and a dense or sparse matrix is returned. |
factors | a matrix copy of the i-th factor if i is a single index or a new Faust composed of i-th to the j-th factors of F. The factors copies keep the storage organization of the source matrix (full or sparse). |
Example
See also Faust.numfactors
function matfaust::Faust::full | ( | F | ) |
The full matrix implemented by F.
This function overloads a Matlab built-in function.
Usage
A = full(F)
A | the Matlab native matrix such that A*x == F*x for any vector x. |
Example
function matfaust::Faust::get_handle | ( | F | ) |
Returns the Faust F C++ native object pointer as an integer.
H | handle (address as an integer). |
Example
function matfaust::Faust::horzcat | ( | varargin | ) |
Horizontal concatenation [F,A, B, … ] where F is a Faust and A, B, … are Faust objects or sparse/full matrix.
It's equivalent to cat(2, F, A, B, …).
This function overloads a Matlab built-in function.
Usage
C=HORZCAT(F,A) concatenates the Faust F and A horizontally. A is a Faust or a sparse/full matrix. The result is the Faust C. HORZCAT(F,A) is the same as [F,G].
C=HORZCAT(F,A,B,…) concatenates horizontally F to A, B, etc. HORZCAT(F,A, B,…) is the same as [F,A,B,…].
See also Faust.vertcat, Faust.cat.
function matfaust::Faust::imag | ( | F | ) |
Returns the imaginary part of the Faust F.
Example:
See also Faust.real
function matfaust::Faust::imagesc | ( | F | , |
varargin | |||
) |
Displays image of F full matrix and its factors.
This function overloads a Matlab built-in function.
Usage
imagesc(F)
imagesc(F, 'faust_name') to name the Faust on the plotted figure.
faust_name | (varargin{1}) The Faust name shown in the figure title (defaultly it's 'F'). |
Data is scaled to use the full colormap.
Example
See also Faust.disp.
function matfaust::Faust::insert | ( | F | , |
i | , | ||
new_factor | |||
) |
Inserts new_factor at index i in a new Faust copy of F.
i,int | the index of insertion. |
new_factor,matrix | the factor to insert as the i-th factor of F. |
G | a copy of F with new_factor inserted at index i. |
Example
See also Faust.factors, Faust.left, Faust.right, Faust.replace
function matfaust::Faust::isdense | ( | F | ) |
Returns true if F factors are all dense matrices/arrays false otherwise.
Example
See also Faust.issparse, matfaust.rand, matfaust.rand_bsr
|
static |
function matfaust::Faust::isreal | ( | F | ) |
Indicates if F is a real Faust or a complex Faust.
This function overloads a Matlab built-in function.
Usage
bool = isreal(F)
Example:
See also Faust.complex
function matfaust::Faust::issparse | ( | F | , |
varargin | |||
) |
Returns true if F factors are all sparse matrices false otherwise.
What a sparse factor is, depends on csr and bsr arguments. Defaultly, only a Faust full of CSR matrices is taken as a sparse Faust.
csr,bool | true to consider a CSR matrix as a sparse matrix, false otherwise (true by default). |
bsr,bool | true to consider a BSR matrix as a sparse matrix, false otherwise (false by default). |
Example:
See also Faust.isdense, matfaust.rand, matfaust.rand_bsr
function matfaust::Faust::left | ( | F | , |
i | , | ||
varargin | |||
) |
Returns the left hand side factors of F from index 1 to i included (in 1-base index).
F | the Faust object. |
i | the bound factor index. |
'as_faust',logical | (optional): true to return a Faust even if a single factor is asked (length(ids) == 1), otherwise (as_faust == false) and a dense or sparse matrix is returned. |
a | Faust if the number of factors to be returned is greater than 1, an array or a sparse matrix otherwise. |
Example
See also Faust.factors, Faust.right
function matfaust::Faust::length | ( | F | ) |
The number of factors of F.
Usage
A = length(F)
F | the Faust object. |
num_factors | the number of factors. |
Example
See also Faust.numfactors
|
static |
Loads a Faust from a .mat file.
Example
See also Faust.Faust, Faust.save
|
static |
Loads a Faust from a .mat file (native C++ version).
Example
See also Faust.Faust, Faust.save
function matfaust::Faust::minus | ( | varargin | ) |
Minus.
This function overloads a Matlab built-in function.
Usage
minus(F,G) or F-G subtracts the Faust G from F, sizes must be compatible.
minus(F,A) or F-A subtracts a matrix A from F, sizes must be compatible.
minus(F,s) or F-s subtracts a scalar s from F, such that full(F-s) == full(F)-s.
F | (first arg.) The Faust object. |
G,A,s,… | (2nd to n-th args) The variables to subtract from F; Fausts, matrices or scalars. |
M | the difference as a Faust object. |
Example:
See also Faust.plus
function matfaust::Faust::mldivide | ( | F | , |
B | |||
) |
\ Backslash or left full(F) divide.
Usage
X = F\ B is the matrix division of full(F) into B, which is roughly the same as Faust.pinv(F)*B.
See also Faust.pinv, mldivide Matlab built-in.
function matfaust::Faust::mrdivide | ( | F | , |
s | |||
) |
/ Slash or right Faust divide.
Usage
G = F/s is the division of the Faust F by the scalar s, such that full(F)/s == full(F/s)
G = MRDIVIDE(F,s) is called for the syntax 'F / s' when s is a scalar.
F | The Faust object to divide. |
s | The scalar to divide F with. |
G | the division result as a Faust object. |
See also Faust.mtimes
function matfaust::Faust::mtimes | ( | F | , |
A | |||
) |
Multiplies the Faust F by A which is a full matrix, a Faust object or a scalar.
This function overloads a Matlab built-in function.
The primary goal of this function is to implement “fast” multiplication by a Faust, which is the operation performed when A is a full matrix.
In the best case, F*A is rcg(F) times faster than performing the equivalent full(F)*A.
Other use cases are available for this function:
Usage
G = mtimes(F, A)
G = F*A with A and G being full matrices. A could also be a sparse matrix but note that often the Faust-sparse matrix multiplication is slower than performing F*full(A) multiplication. In some cases though, it stays quicker: moreover when the Faust is composed of a small number of factors.
G = F*s with s a scalar and G a Faust.
G = s*F with s a scalar and G a Faust.
G = s*F' with s a scalar multiplying the conjugate-transpose of F.
G = F'*s with s a scalar multiplying the conjugate-transpose of F.
G | the multiplication result: |
Example
See also Faust.Faust, Faust.rcg, Faust.ctranspose, Faust.complex
function matfaust::Faust::nbytes | ( | F | ) |
function matfaust::Faust::nnz_sum | ( | F | ) |
The total number of nonzeros in the factors of F.
The function sums together the number of nonzeros of each factor and returns the result. Note that for efficiency the sum is computed at Faust creation time and kept in cache.
Usage
nz = nnz_sum(F)
F | the Faust object. |
nz | the number of non-zeros. |
Example:
See also Faust.rcg, Faust.density.
function matfaust::Faust::norm | ( | F | , |
varargin | |||
) |
The matrix norm of F.
This function overloads a Matlab built-in function.
Several types of norm are available: 1-norm, 2-norm, inf-norm and Frobenius norm.
The norm of F is equal to the norm of full(F).
n = norm(F, 2) the 2-norm or maximum singular value of F: approximately norm(full(F),2) == max(svd(full(F))).
n = norm(F, 2, 'threshold', 0.001, 'max_num_its', 1000).
n = norm(F) the same as norm(F, 2).
n = norm(F, 1) the 1-norm of F: norm(full(F), 1) == max(sum(abs(full(F))))
n = norm(F, inf) the inf-norm of F: norm(full(F), inf) == max(sum(abs(full(F)')))
n = norm(F, 'fro') the Frobenius norm of F: norm(full(F), 'fro').
F | the Faust object. |
p | (optional) the norm order or type. Respectively 1, 2 or inf for the 1-norm, 2-norm and inf-norm or 'fro' for the Frobenius norm (by default the 2-norm is computed). |
'threshold',real | (optional) power iteration algorithm threshold (default to .001). Used only for norm(2). It's passed in a key-value pair fashion: 'threshold', .001 |
'max_num_its',int | (optional) maximum number of iterations for power iteration algorithm. Used only for norm(2). It's passed in a key-value pair fashion: 'max_num_its', 1000. |
'full_array',bool | (optional) this argument applies only for 1-norm, inf-norm and Frobenius norm. If true the Faust full array is computed before computing the norm otherwise it is not. By default it is set to false. Many configurations exist in which full_array == False can be more efficient but it needs to finetune the batch_size argument. |
'batch_size',int | (optional) this argument applies only when the full_array argument is set to false (for the 1-norm, inf-norm and Frobenius norm). It determines the number of Faust columns (resp. rows) that are built in memory in order to compute the Frobenius norm and the 1-norm (resp. the inf-norm). This parameter is primary in the efficiency of the computation and memory consumption. By default, it is set to 1 (which is certainly not the optimal configuration in many cases in matter of computation time but always the best in term of memory cost). |
n | the norm (real). |
Example
See also Faust.normalize
function matfaust::Faust::normalize | ( | F | , |
varargin | |||
) |
Returns the normalized F.
Usage
normalize(F,'norm') normalizes columns with vector 2-norm.
normalize(F,'norm',p) normalizes columns with vector p-norm (see Faust.norm).
normalize(F,DIM,'norm', 2) normalizes rows (DIM=1) or columns (DIM=2, default) with vector 2-norm.
normalize(F,DIM,'norm',p) normalizes rows (DIM=1) or columns (DIM=2, default) with vector p-norm.
Examples:
See also Faust.norm
function matfaust::Faust::numel | ( | F | ) |
function matfaust::Faust::numfactors | ( | F | ) |
The number of factors of F.
Usage
A = numfactors(F)
F | the Faust object. |
num_factors | the number of factors. |
Example
See also Faust.factors
|
static |
Optimizes any Faust composed of butterfly factors.
The returned Faust will be more efficient if multiplied by a vector or a matrix. This optimization is based on the diagonals of each butterfly factor. Multiplying a butterfly factor B by a vector x (y = B*x) is equivalent to forming two diagonals D1 and D2 from B and compute y' = D1*x + D2*x(I) where I is set in the proper order to obtain y' = y.
F | The Faust to optimize. If the factors of F are not set according to a butterfly structure, the result is not defined. |
G | the optimized Faust. |
Example:
See also: matfaust.fact.butterfly, matfaust.dft, matfaust.rand_butterfly.
function matfaust::Faust::optimize | ( | F | , |
varargin | |||
) |
Returns a Faust optimized with Faust.pruneout, Faust.optimize_memory and Faust.optimize_time.
Usage
OF = optimize_time(F) returns an optimized Faust object.
OF = optimize_time(F, 'transp', true) see Faust.optimize_time
'transp',bool | (optional) default to false. if true optimize the Faust according to its transpose. |
OF | The optimized Faust. |
Example:
See also Faust.optimize_time, Faust.optimize_memory, Faust.pruneout, Lives Script about Faust optimizations
function matfaust::Faust::optimize_memory | ( | F | ) |
Optimizes a Faust by changing the storage format of each factor in order to optimize the memory size.
OF | The optimized Faust. |
Example:
See also Faust.optimize
function matfaust::Faust::optimize_time | ( | F | , |
varargin | |||
) |
Returns a Faust configured with the quickest Faust-matrix multiplication mode (benchmark ran on the fly).
The evaluated methods in the benchmark are listed in matfaust.FaustMulMode. Although depending on the package you installed and the capability of your hardware the methods based on Torch library can be used.
Usage
OF = optimize_time(F) returns a new object with the best product method enabled.
OF = optimize_time(F, 'inplace', true) modifies directly F instead of creating a new Faust (i.e. OF references the same object as F).
OF = optimize_time(F, 'transp', true) tries to optimize the Faust transpose instead of the Faust itself.
OF = optimize_time(F, 'nsamples', 10) benchmarks the product methods by computing 10 products instead of one by default.
F | the Faust object. |
'inplace',bool | default to false. If true the current Faust is modified directly. |
'transp',bool | default to false. If true optimize the Faust according to its transpose. |
'nsamples',int | default to 1.The number of Faust-Dense matrix products calculated in order to measure time taken by each method (it could matter to discriminate methods when the performances are similar). By default, only one product is computed to evaluate the method. |
'mat',matrix | Use this argument to run the benchmark on the Faust multiplication by the matrix mat instead of Faust.full(). Note that mat must be of the same scalar type as F. |
OF | The optimized Faust. |
Example:
See also Faust.optimize, matfaust.FaustMulMode
function matfaust::Faust::pinv | ( | F | ) |
Pseudoinverse matrix of full(F).
This function overloads a Matlab built-in function.
Usage
X = PINV(F) produces the matrix X of the same dimensions as F' so that F*(F'*X')' == full(F) (or approximately).
Example:
See also Faust.mldivide, pinv Matlab built-in, matfaust.fact.pinvtj
function matfaust::Faust::plus | ( | varargin | ) |
Plus.
This function overloads a Matlab built-in function.
Usage
plus(F,G) or F+G adds two Faust together, sizes must be compatible.
plus(F,A) or F+A adds a Faust and a matrix A, sizes must be compatible.
plus(F,s) or F+s, with s being a scalar, such that full(F+s) == full(F)+s.
F | (first arg.) The Faust object. |
G,A,s,… | (2nd to n-th args) The variables to add to F; Fausts, matrices or scalars. |
S | the sum as a Faust object. |
Examples:
See also Faust.minus
function matfaust::Faust::power_iteration | ( | F | , |
varargin | |||
) |
Performs the power iteration algorithm to compute the greatest eigenvalue of the Faust.
For the algorithm to succeed the Faust should be diagonalizable (similar to a digonalizable Faust), ideally, a symmetric positive-definite Faust.
'threshold',real | (optional) the precision required on the eigenvalue. Default value is 1e-3. |
'maxiter',integer | (optional) the number of iterations above what the algorithm will stop anyway. Default value is 100. |
lambda | the greatest eigenvalue approximate. |
Example:
function matfaust::Faust::pruneout | ( | F | , |
varargin | |||
) |
Returns a Faust optimized by removing useless zero rows and columns as many times as needed.
F | the Faust to optimize. |
'thres',int | (optional) the threshold of number of nonzeros under what the rows/columns are removed. |
G | The optimized Faust. |
Example:
See also Faust.optimize, Faust.nbytes
function matfaust::Faust::rcg | ( | F | ) |
The Relative Complexity Gain of F.
The RCG is the theoretical gain brought by the Faust representation relatively to its dense matrix equivalent.
The higher is the RCG, the more computational savings are made. This gain applies both for storage space and computation time.
Usage
gain = rcg(F)
F | the Faust object. |
gain | the RCG value (real). |
Example
See also Faust.density, Faust.nnz_sum, Faust.size.
function matfaust::Faust::real | ( | F | ) |
Returns the real part of the Faust F.
Example:
See also Faust.imag
function matfaust::Faust::replace | ( | F | , |
i | , | ||
new_factor | |||
) |
Replaces the factor of index i by new_factor in a new Faust copy of F.
i,int | the factor index to replace. |
new_factor,matrix | the factor replacing the i-th factor of F. |
G | a copy of F with the i-th factor replaced by new_factor. |
Example
See also Faust.factors, Faust.left, Faust.right, Faust.insert
function matfaust::Faust::right | ( | F | , |
i | , | ||
varargin | |||
) |
Returns the right hand side factors of F from index i to end (in 1-base index).
F | the Faust object. |
i | the bound factor index. |
'as_faust',logical | (optional): true to return a Faust even if a single factor is asked (length(ids) == 1), otherwise (as_faust == false) and a dense or sparse matrix is returned. |
a | Faust if the number of factors to be returned is greater than 1, an array or a sparse matrix otherwise. |
Example
See also Faust.factors, Faust.left
function matfaust::Faust::save | ( | F | , |
filepath | |||
) |
Saves the Faust F into a file.
The file is saved in Matlab format version 5 (.mat extension).
Usage
F | the Faust object. |
filepath | the path for saving the Faust. The filename should end with .mat and it must be a character array. |
Example
See also Faust.Faust, Faust.rcg, Faust.load, Faust.load_native
function matfaust::Faust::single | ( | F | ) |
Returns a new Faust whose class is single. It allows to convert all the factors to single precision.
Usage
sF = single(F)
sF | the single class/precision Faust. |
Example:
See also Faust.class, Faust.double
function matfaust::Faust::size | ( | F | , |
varargin | |||
) |
The size of F.
The size is a pair of numbers: the number of rows and the number of columns of full(F).
Usage
[nrows, ncols] = size(F)
n = size(F,dim) with n being the size of the dim-th dimension of F.
In other words n == nrows if dim == 1, n == ncols if dim == 2.
F | the Faust object. |
dim | (optional) the index of the dimension to get the size of. |
Example
See also Faust.nnz_sum, Faust.numel
function matfaust::Faust::subsref | ( | F | , |
S | |||
) |
Subscripted reference of a Faust.
The function returns a Faust representing a submatrix of full(F) or a scalar element if that Faust can be reduced to a single element.
This function overloads a Matlab built-in.
Usage
G = F(I,J) the Faust representing the sub-matrix of full(F) defined by the subscript vectors I and J (see examples below).
F | the Faust object. |
S | the structure defining the Faust to extract like a submatrix (it's not supposed to be used directly ; usage and examples show how subscript should be used). |
The | Faust object requested or just the corresponding scalar if that Faust has a size equal to [1,1]. |
Example
See also Faust.end.
function matfaust::Faust::transpose | ( | F | ) |
The transpose of F.
This function overloads a Matlab built-in function/operator.
Usage
F_trans = transpose(F)
F_trans = F.'
F | the Faust object. |
F_trans | a Faust object implementing the transpose of full(F) such that: full(F_trans) == full(F).' == transpose(full(F)). |
Example
See also Faust.conj, Faust.ctranspose
function matfaust::Faust::uminus | ( | F | ) |
Returns - F.
This function overloads a Matlab built-in function.
Example:
See also Faust.sum, Faust.mtimes
function matfaust::Faust::uplus | ( | F | ) |
Returns + F.
This function overloads a Matlab built-in function.
Example:
See also Faust.plus
function matfaust::Faust::vertcat | ( | varargin | ) |
Vertical concatenation [F;A;B;…] where F is a Faust and A, B, … are Faust objects or sparse/full matrices.
It's equivalent to cat(1, F, A, B, …).
This function overloads a Matlab built-in function.
Usage
C=VERTCAT(F,A) concatenates the Faust F and A vertically. A is a Faust or a sparse/full matrix. The result is the Faust C. VERTCAT(F,A) is the same as [F;G].
C=VERTCAT(F, A, B,…) concatenates vertically F to A, B etc. VERTCAT(F, A, B,…) is the same as [F;A;B;…].
See also Faust.horzcat, Faust.cat.
|
protected |
See Faust.device.
|
protected |
See Faust.class.
|
protected |
See Faust.isreal.
|
protected |
Underlying Faust native object handle.