Mentions légales du service

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

Update matfaust.lazylinop doc and minorly pyfaust.lazylinop'.

parent 5d28c317
No related branches found
No related tags found
No related merge requests found
Pipeline #834123 skipped
...@@ -31,7 +31,7 @@ if(BUILD_DOCUMENTATION) ...@@ -31,7 +31,7 @@ if(BUILD_DOCUMENTATION)
string(CONCAT DOXYGEN_FILE_PATTERNS "*.cpp *.hpp *.h *.cu *.hu") string(CONCAT DOXYGEN_FILE_PATTERNS "*.cpp *.hpp *.h *.cu *.hu")
endif() endif()
if(BUILD_WRAPPER_MATLAB) 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 rand_bsr.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 is_gpu_mod_enabled.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 create_bsr.m ParamsPalm4msaWHT.m proj_id.m ParamsHierarchicalNoResCons.m ParamsHierarchicalWHTNoResCons.m ParamsHierarchicalRectMatNoResCons.m circ.m anticirc.m toeplitz.m dct.m dst.m rand_butterfly.m opt_butterfly_faust.m bitrev_perm.m LazyLinearOp.m asLazyLinearOp.m isLazyLinearOp.m LazyLinearOpKron.m kron.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 rand_bsr.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 is_gpu_mod_enabled.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 create_bsr.m ParamsPalm4msaWHT.m proj_id.m ParamsHierarchicalNoResCons.m ParamsHierarchicalWHTNoResCons.m ParamsHierarchicalRectMatNoResCons.m circ.m anticirc.m toeplitz.m dct.m dst.m rand_butterfly.m opt_butterfly_faust.m bitrev_perm.m LazyLinearOp.m asLazyLinearOp.m isLazyLinearOp.m LazyLinearOpKron.m kron.m aslazylinearoperator.m LazyLinearOperator.m ") # warning: the space on the end matters
endif() endif()
if(BUILD_WRAPPER_PYTHON) 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 lazylinop.py") string(CONCAT DOXYGEN_FILE_PATTERNS ${DOXYGEN_FILE_PATTERNS} "__init__.py factparams.py demo.py tools.py fact.py proj.py poly.py lazylinop.py")
......
...@@ -518,7 +518,7 @@ EXCLUDE_SYMLINKS = NO ...@@ -518,7 +518,7 @@ EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *faust_MatDense_gpu.h *faust_MatSparse_gpu.h expfiltered* EXCLUDE_PATTERNS = *faust_MatDense_gpu.h *faust_MatSparse_gpu.h expfiltered*
EXCLUDE_SYMBOLS = mtimes_trans subsasgn get_factor_nonopt reshape ABC ParamsPalm4MSAFGFT UpdateCholesky UpdateCholeskyFull UpdateCholeskySparse greed_omp_chol hierarchical_constends palm4msa_constends is_mat_consistent init_facts stop_crit ParamsPalm4MSAFGFT data_num_cols data_num_rows is_fact_side_left stop_crits constraints DISABLED_OPT EXTERNAL_OPT grad_calc_opt_mode init_lambda INTERNAL_OPT is_update_way_R2L is_verbose num_facts IDX_IS_FACT_SIDE_LEFT OPT_ARG_NAMES2 OPT_ARG_NAMES DEFAULT_OPT IDX_USE_CSR IDX_NORM2_MAX_ITER IDX_NORM2_THRESHOLD IDX_GRAD_CALC_OPT_MODE IDX_VERBOSITY IDX_CONSTANT_STEP_SIZE IDX_STEP_SIZE IDX_INIT_LAMBDA IDX_IS_UPDATE_WAY_R2L set_FM_mul_mode set_Fv_mul_mode implements HANDLED_FUNCTIONS __array_ufunc__ __array__ __array_function__ asarray check_dev _eyes_like _poly_arr_py _zeros_like Chebyshev to_mex_struct get_default_init_facts IDX_INIT_FACTS tests calc_coeffs verify_M_N verify_bnnz verify_bdata verify_bcolinds verify_brow_count verify_bsr_format internal_libomp_loading libomp_loading_verbose load_lib_omp inform_user_how_to_install_libomp indexMultiply sliceMultiply bitrev omega mod_fft try_modify_wrapper_lib_on_macos _cplx2real_op cplx2real_op is_array_of_indices is_cell_arrays_of_indices perm_type get_permutation_matrix shared_logits_permutation butterfly_ create_from_op create_from_scalar create_from_funcs EXCLUDE_SYMBOLS = mtimes_trans subsasgn get_factor_nonopt reshape ABC ParamsPalm4MSAFGFT UpdateCholesky UpdateCholeskyFull UpdateCholeskySparse greed_omp_chol hierarchical_constends palm4msa_constends is_mat_consistent init_facts stop_crit ParamsPalm4MSAFGFT data_num_cols data_num_rows is_fact_side_left stop_crits constraints DISABLED_OPT EXTERNAL_OPT grad_calc_opt_mode init_lambda INTERNAL_OPT is_update_way_R2L is_verbose num_facts IDX_IS_FACT_SIDE_LEFT OPT_ARG_NAMES2 OPT_ARG_NAMES DEFAULT_OPT IDX_USE_CSR IDX_NORM2_MAX_ITER IDX_NORM2_THRESHOLD IDX_GRAD_CALC_OPT_MODE IDX_VERBOSITY IDX_CONSTANT_STEP_SIZE IDX_STEP_SIZE IDX_INIT_LAMBDA IDX_IS_UPDATE_WAY_R2L set_FM_mul_mode set_Fv_mul_mode implements HANDLED_FUNCTIONS __array_ufunc__ __array__ __array_function__ asarray check_dev _eyes_like _poly_arr_py _zeros_like Chebyshev to_mex_struct get_default_init_facts IDX_INIT_FACTS tests calc_coeffs verify_M_N verify_bnnz verify_bdata verify_bcolinds verify_brow_count verify_bsr_format internal_libomp_loading libomp_loading_verbose load_lib_omp inform_user_how_to_install_libomp indexMultiply sliceMultiply bitrev omega mod_fft try_modify_wrapper_lib_on_macos _cplx2real_op cplx2real_op is_array_of_indices is_cell_arrays_of_indices perm_type get_permutation_matrix shared_logits_permutation butterfly_ create_from_op create_from_scalar create_from_funcs kron_ matmat_ index_lambda check_lambdas create_from_op create_from_funcs mul_index_lambda vstack_mul vstack_id hstack_mul hstack_id real_mul imag_mul check_meth
# ConstraintGeneric ConstraintMat ConstraintReal ConstraintName ConstraintInt # ConstraintGeneric ConstraintMat ConstraintReal ConstraintName ConstraintInt
# The EXAMPLE_PATH tag can be used to specify one or more files or # The EXAMPLE_PATH tag can be used to specify one or more files or
......
% ======================================================================
%> @brief This class implements a lazy linear operator.
%>
%> The evaluation of any defined operation is delayed until proceeding to a multiplication
%> by a dense matrix/vector, a call of LazyLinearOp.toarray.
%>
%> To instantiate a LazyLinearOp look at matfaust.lazylinop.aslazylinearoperator or matfaust.lazylinop.LazyLinearOperator to instantiate from matmat/matvec functions.
%>
%> @warning This code is in a beta status.
% ======================================================================
classdef LazyLinearOp < handle % needed to use references on objects classdef LazyLinearOp < handle % needed to use references on objects
properties (SetAccess = protected, Hidden = true) properties (SetAccess = protected, Hidden = true)
lambdas; lambdas;
...@@ -14,6 +24,15 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -14,6 +24,15 @@ classdef LazyLinearOp < handle % needed to use references on objects
end end
methods methods
%======================================================================
%> @brief Constructor. Not meant to be used directly.
%>
%> @param lambdas: starting operations.
%> @param shape: the initial shape of the operator.
%> @param root_obj: (optional) the initial object the operator is based on.
%>
%> <p>@b See @b also matfaust.lazylinop.aslazylinearoperator
%======================================================================
function L = LazyLinearOp(lambdas, shape, varargin) function L = LazyLinearOp(lambdas, shape, varargin)
L.lambdas = lambdas; L.lambdas = lambdas;
L.shape = shape; L.shape = shape;
...@@ -72,6 +91,14 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -72,6 +91,14 @@ classdef LazyLinearOp < handle % needed to use references on objects
L = LazyLinearOp.create_from_op(subsref(irows, irowsS)) * L * LazyLinearOp.create_from_op(subsref(icols, icolsS)); L = LazyLinearOp.create_from_op(subsref(irows, irowsS)) * L * LazyLinearOp.create_from_op(subsref(icols, icolsS));
end end
%======================================================================
%> @brief size of L.
%>
%> @param dim: the dimension (1 for rows, 2 for columns) to get the size of.
%>
%> @retval s: by default, an array of two numbers (the number of rows and the number of columns) or the size of only one dimension if dim argument is used.
%>
%======================================================================
function s = size(L, varargin) function s = size(L, varargin)
if length(varargin) == 0 if length(varargin) == 0
s = L.shape; s = L.shape;
...@@ -80,21 +107,35 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -80,21 +107,35 @@ classdef LazyLinearOp < handle % needed to use references on objects
end end
end end
%=============================================================
%> @brief Returns the LazyLinearOp transpose.
%=============================================================
function LT = transpose(L) function LT = transpose(L)
check_meth(L, 'transpose') check_meth(L, 'transpose')
LT = L.lambdas{matfaust.lazylinop.LazyLinearOp.T}(); LT = L.lambdas{matfaust.lazylinop.LazyLinearOp.T}();
end end
%=============================================================
%> @brief Returns the LazyLinearOp ctranspose.
%=============================================================
function LH = ctranspose(L) function LH = ctranspose(L)
check_meth(L, 'ctranspose') check_meth(L, 'ctranspose')
LH = L.lambdas{matfaust.lazylinop.LazyLinearOp.H}(); LH = L.lambdas{matfaust.lazylinop.LazyLinearOp.H}();
end end
%=============================================================
%> @brief Returns the LazyLinearOp conjugate.
%=============================================================
function LC = conj(L) function LC = conj(L)
check_meth(L, 'conj') check_meth(L, 'conj')
LC = (L').'; LC = (L').';
end end
%=============================================================
%> @brief Returns the LazyLinearOp for indexing.
%>
%> @b See @b also: subsref matlab built-in.
%=============================================================
function LS = subsref(L, S) function LS = subsref(L, S)
if (~isfield(S,'type')) | (~isfield(S,'subs')) if (~isfield(S,'type')) | (~isfield(S,'subs'))
...@@ -117,6 +158,12 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -117,6 +158,12 @@ classdef LazyLinearOp < handle % needed to use references on objects
end end
%=============================================================
%> @brief Returns the LazyLinearOp for the multiplication self * op
%> or if op is a full matrix it returns the full matrix (self * op).
%>
%> @param op: an object compatible with self for this binary operation.
%=============================================================
function LM = mtimes(L, A) function LM = mtimes(L, A)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
if LazyLinearOp.isLazyLinearOp(A) if LazyLinearOp.isLazyLinearOp(A)
...@@ -172,6 +219,11 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -172,6 +219,11 @@ classdef LazyLinearOp < handle % needed to use references on objects
end end
%=============================================================
%> @brief Returns the LazyLinearOp L + op.
%>
%> @param op: an object compatible with self for this binary operation.
%=============================================================
function LP = plus(L, op) function LP = plus(L, op)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
check_meth(L, 'plus') check_meth(L, 'plus')
...@@ -192,10 +244,18 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -192,10 +244,18 @@ classdef LazyLinearOp < handle % needed to use references on objects
LP = LazyLinearOp(lambdas, [size(L, 1), size(op, 2)]); LP = LazyLinearOp(lambdas, [size(L, 1), size(op, 2)]);
end end
%=============================================================
%> @brief Returns the LazyLinearOp (+ L).
%=============================================================
function LUP = uplus(L) function LUP = uplus(L)
LUP = L; LUP = L;
end end
%=============================================================
%> @brief Returns the LazyLinearOp L - op.
%>
%> @param op: an object compatible with self for this binary operation.
%=============================================================
function LUP = minus(L, op) function LUP = minus(L, op)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
check_meth(L, 'minus') check_meth(L, 'minus')
...@@ -216,10 +276,18 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -216,10 +276,18 @@ classdef LazyLinearOp < handle % needed to use references on objects
LUP = LazyLinearOp(lambdas, [size(L, 1), size(op, 2)]); LUP = LazyLinearOp(lambdas, [size(L, 1), size(op, 2)]);
end end
%=============================================================
%> @brief Returns the full matrix resulting from L.
%=============================================================
function LF = full(L) function LF = full(L)
LF = L * eye(size(L, 2)); LF = L * eye(size(L, 2));
end end
%=============================================================
%> @brief Returns the LazyLinearOp for the vertical concatenation [L, varargin{:}].
%>
%> @b See @b also: vertcat matlab built-in.
%=============================================================
function LV = vertcat(L, op) function LV = vertcat(L, op)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
if size(L, 2) ~= size(op, 2) if size(L, 2) ~= size(op, 2)
...@@ -282,6 +350,11 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -282,6 +350,11 @@ classdef LazyLinearOp < handle % needed to use references on objects
end end
%=============================================================
%> @brief Returns the LazyLinearOp for the horizontal concatenation [L, varargin{:}].
%>
%> @b See @b also: horzcat matlab built-in.
%=============================================================
function LH = horzcat(L, op) function LH = horzcat(L, op)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
if size(L, 1) ~= size(op, 1) if size(L, 1) ~= size(op, 1)
...@@ -340,6 +413,11 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -340,6 +413,11 @@ classdef LazyLinearOp < handle % needed to use references on objects
LH = LazyLinearOp(lambdas, [size(L, 1), size(L, 2) + size(op, 2)]); LH = LazyLinearOp(lambdas, [size(L, 1), size(L, 2) + size(op, 2)]);
end end
%=============================================================
%> @brief Returns the LazyLinearOp for the concatenation [L, varargin{:}] or [L; varargin{:}].
%>
%> @b See @b also: cat matlab built-in.
%=============================================================
function LC = cat(varargin) function LC = cat(varargin)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
dim = varargin{1}; dim = varargin{1};
...@@ -356,16 +434,21 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -356,16 +434,21 @@ classdef LazyLinearOp < handle % needed to use references on objects
LC = L; LC = L;
end end
%=============================================================
%> @brief Returns the LazyLinearOp for real(L).
%>
%> @b See @b also: real matlab built-in.
%=============================================================
function LR = real(L) function LR = real(L)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
function RM = mul(L, o) function RM = real_mul(L, o)
if LazyLinearOp.isLazyLinearOp(o) && ismatrix(o) && isnumeric(o) && any(size(o) ~= [1, 1]) if LazyLinearOp.isLazyLinearOp(o) && ismatrix(o) && isnumeric(o) && any(size(o) ~= [1, 1])
RM = real(L * real(o)) + real(L * imag(o) * 1j); RM = real(L * real(o)) + real(L * imag(o) * 1j);
else else
RM = real(L * o); RM = real(L * o);
end end
end end
lambdas = {@(o) mul(L, o), ... %MUL lambdas = {@(o) real_mul(L, o), ... %MUL
@() real(L.'), ... % T @() real(L.'), ... % T
@() real(L.'), ... % H @() real(L.'), ... % H
@(S) real(subsref(L, S)) % I @(S) real(subsref(L, S)) % I
...@@ -373,16 +456,21 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -373,16 +456,21 @@ classdef LazyLinearOp < handle % needed to use references on objects
LR = LazyLinearOp(lambdas, size(L)); LR = LazyLinearOp(lambdas, size(L));
end end
%=============================================================
%> @brief Returns the LazyLinearOp for imag(L).
%>
%> @b See @b also: imag matlab built-in.
%=============================================================
function LI = imag(L) function LI = imag(L)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
function IM = mul(L, o) function IM = imag_mul(L, o)
if LazyLinearOp.isLazyLinearOp(o) && ismatrix(o) && isnumeric(o) && any(size(o) ~= [1, 1]) if LazyLinearOp.isLazyLinearOp(o) && ismatrix(o) && isnumeric(o) && any(size(o) ~= [1, 1])
IM = imag(L * real(o)) + imag(L * imag(o) * 1j); IM = imag(L * real(o)) + imag(L * imag(o) * 1j);
else else
IM = imag(L * o) IM = imag(L * o)
end end
end end
lambdas = {@(o) mul(L, o), ... %MUL lambdas = {@(o) imag_mul(L, o), ... %MUL
@() imag(L.'), ... % T @() imag(L.'), ... % T
@() imag(L.'), ... % H @() imag(L.'), ... % H
@(S) imag(subsref(L, S)) % I @(S) imag(subsref(L, S)) % I
...@@ -392,9 +480,13 @@ classdef LazyLinearOp < handle % needed to use references on objects ...@@ -392,9 +480,13 @@ classdef LazyLinearOp < handle % needed to use references on objects
end end
methods(Static = true) methods(Static = true)
%=============================================================
%> Alias of matfaust.lazylinop.isLazyLinearOp.
%=============================================================
function b = isLazyLinearOp(obj) function b = isLazyLinearOp(obj)
b = isa(obj, 'matfaust.lazylinop.LazyLinearOp'); b = isa(obj, 'matfaust.lazylinop.LazyLinearOp');
end end
function lop = create_from_op(obj) function lop = create_from_op(obj)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
lambdas = cell(1, 4); lambdas = cell(1, 4);
......
%=============================================================
%> Returns a LazyLinearOp L defined by shape and at least a matvec or matmat function.
%>
%> @param shape: dimensions of the operator (M, N),
%> @param 'matvec', function_handle: returns L * v (v a vector of size N).
%> @param 'rmatvec', function_handle: (optional) returns L' * v (v a vector of size M).
%> @param 'matmat', function_handle: returns A * V (V a dense matrix of dimensions (N, K)).
%> @param 'rmatmat', function_handle: (optional) returns A' * V (V a dense matrix of dimensions (M, K)).
%> @param dtype, str: (optional) complex, double, single or undefined (by default).
%>
%>
%> @b Example:
%> In this example we create a LazyLinearOp for the DFT using the fft matlab
%> built-in.
%> @code
%> >> import matfaust.lazylinop.LazyLinearOperator
%> >> lfft = LazyLinearOperator([8, 8], 'matvec', @(x) fft(x), 'rmatvec', @(x) 8 * ifft(x))
%> >> x = rand(8, 1);
%> >> norm(lfft * x - fft(x)) < 1e-12
%>
%> ans =
%>
%> logical
%>
%> 1
%> @endcode
%>
%=============================================================
function L = LazyLinearOperator(shape, varargin) function L = LazyLinearOperator(shape, varargin)
import matfaust.lazylinop.LazyLinearOp import matfaust.lazylinop.LazyLinearOp
p = inputParser; p = inputParser;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
%> %>
%> @b Example: %> @b Example:
%> @code %> @code
%>>> A = rand(100, 100); %> >> A = rand(100, 100);
%> >> B = rand(100, 100); %> >> B = rand(100, 100);
%> >> AxB = kron(A, B); %> >> AxB = kron(A, B);
%> >> lAxB = matfaust.lazylinop.kron(A, B) %> >> lAxB = matfaust.lazylinop.kron(A, B)
......
...@@ -108,7 +108,7 @@ class LazyLinearOp(LinearOperator): ...@@ -108,7 +108,7 @@ class LazyLinearOp(LinearOperator):
shape: the initial shape of the operator. shape: the initial shape of the operator.
root_obj: the initial object the operator is based on. root_obj: the initial object the operator is based on.
<b>See also:</b> LazyLinearOp.create, pyfaust.lazylinop.asLazyLinearOp. <b>See also:</b> pyfaust.lazylinop.aslazylinearoperator.
""" """
if root_obj is not None: if root_obj is not None:
if not hasattr(root_obj, 'ndim'): if not hasattr(root_obj, 'ndim'):
...@@ -938,6 +938,16 @@ def LazyLinearOperator(shape, **kwargs): ...@@ -938,6 +938,16 @@ def LazyLinearOperator(shape, **kwargs):
rmatmat: (callable) returns A^H * V (V a dense matrix of dimensions (M, K)). rmatmat: (callable) returns A^H * V (V a dense matrix of dimensions (M, K)).
dtype: data type of the matrix (can be None). dtype: data type of the matrix (can be None).
Example:
>>> # In this example we create a LazyLinearOp for the DFT using the fft from scipy
>>> import numpy as np
>>> from scipy.fft import fft, ifft
>>> from pyfaust.lazylinop import LazyLinearOperator
>>> lfft = LazyLinearOperator((8, 8), matmat=lambda x: fft(x, axis=0), rmatmat=lambda x: 8 * ifft(x, axis=0))
>>> x = np.random.rand(8)
>>> np.allclose(lfft * x, fft(x))
True
""" """
matvec, rmatvec, matmat, rmatmat = [None for i in range(4)] matvec, rmatvec, matmat, rmatmat = [None for i in range(4)]
def callable_err(k): def callable_err(k):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment