.. _demo-sobi: Using advanced Tensorlab features for ICA ========================================== **Tags**: ``lagged covariance matrices``, ``sdf``, ``nonnegativity``, ``symmetry``, ``missing elements``, ``Toeplitz structure``, ``imposing structure`` Many signals can be modeled as a mixture of independent components. In its most basic form, independent component analysis (ICA) tries to estimate the independent components from such mixtures without prior knowledge of the signals or mixing coefficients. Though many methods for ICA use higher-order statistics to solve this problem, this demo will focus on approaches using second-order statistics. More information on methods for ICA can for instance be found in :cite:`comon2010handbook`. For basic ICA techniques, we refer to the demo :ref:`Using basic Tensorlab features for ICA`. In this demo, we will consider variants of second-order statistics based ICA that illustrate more advanced Tensorlab features. A Matlab implementation of this demo is given in the ``demo_advancedica.m`` file, which can be found in the demo folder of Tensorlab or downloaded `here `_. Instantaneous mixtures ---------------------- An instantaneous mixture :math:`\vec{x}(t) \in \R^{Q}` of :math:`R` independent components :math:`\vec{s}(t) \in \R^{R}` can be written as .. math:: \vec{x}(t) = \mat{M} \cdot \vec{s}(t) + \vec{n}(t), in which :math:`\mat{M}` contains the mixing coefficients. Temporally i.i.d. noise is captured by the additive noise term :math:`\vec{n}(t)`. Here, the sources are assumed to be temporally coherent. All results below are computed for a mixture of three sources with five observed signals. Each signal has :math:`10^4` samples and the signal-to-noise ratio is :math:`10` dB. In our examples, the temporally coherent sources are generated by passing :math:`10^4` i.i.d. samples from a standard normal distribution through a finite impulse response filter. The filter coefficients, the entries of the mixing matrix :math:`M` and the additive noise are taken from a standard normal distribution as well. The noise is scaled to obtain the desired signal-to-noise ratio. In Matlab, this is done as follows: .. code-block:: tensorlab % Parameters Q = 5; % nb outputs R = 3; % nb sources K = 20; % nb slices N = 1e4; % nb samples SNR = 10; % Signal to noise ratio in dB filterlength = 21; % Filter length for sources % Generate signals s = randn(N,R); filt = randn(filterlength,R); for r = 1:R s(:,r) = conv(s(:,r),filt(:,r),'same'); % temporally coherent sources end M = randn(Q,R); x = s*M.'; % create mixture x = noisy(x,SNR); % Additive Gaussian noise By stacking lagged covariance matrices of the observations :math:`E\left\lbrace\vec{x}(t)\vec{x}(t+\tau)^{\T}\right\rbrace`, the tensor :math:`\ten{C}^{(2)}_{\vec{x}}` shown in :num:`Figure #sobifig1` is obtained. Because the source covariance matrices are close to diagonal, the figure actually shows the approximate :docurl:`canonical polyadic decomposition ` (CPD) of :math:`\ten{C}^{(2)}_{\vec{x}}`. If this CPD is unique, its computation will return an estimate of the mixing matrix :math:`\mat{M}`. Since the mixture is overdetermined, the mixing matrix estimate can subsequently be used to estimate the original source signals as .. math:: \hat{\vec{s}}(t) = \mat{M}^{\dagger} \cdot \vec{y}(t). The rest of this section will show how this CPD can be computed using advanced Tensorlab features. We focus on the implementation of the different types of structure, for which we use Tensorlab's structured data fusion framework. .. As described in :cite:`sobi`, we can exploit this temporal coherence to identify the independent components that make up the mixture. To do this, we have to compute various lagged covariance matrices :math:`\mat{C}_{\vec{x}}(\tau)` of the measurements, which leads to .. math:: \mat{C}_{\vec{x}}(\tau) &= E\left\lbrace\vec{x}(t)\vec{x}(t+\tau)^{\T}\right\rbrace\\ &= \mat{M} \cdot \mat{C}_{\vec{s}}(\tau) \cdot \mat{M}^{\T} + \delta_{\tau} \mat{C}_{\vec{n}}(0). For the last equation, we used the relation :math:`\vec{x}(t) = \mat{M} \cdot \vec{s}(t) + \vec{n}(t)` and some basic properties of the covariance. Since the various inputs are assumed to be independent and coherent, the matrix :math:`\mat{C}_{\vec{s}}(\tau)` will theoretically be diagonal. Because the noise is i.i.d. (i.e., not coherent), it will only have an influence when :math:`\tau = 0` (hence the Kronecker delta). Let us now stack the covariance matrices for various shifts (:math:`20` in our case) into a tensor :math:`\ten{C}^{(2)}_{\vec{x}}`: .. _sobifig1: .. figure:: img/sobi-ica-basic.* :alt: SOBI :align: center :width: 60% Tensorizing the data by stacking lagged covariance matrices. Without first slice ^^^^^^^^^^^^^^^^^^^ If infinitely many samples are available, the noise will only influence the diagonal of the covariance matrix with shift :math:`\tau = 0`, which is the diagonal of the first frontal slice. We could simply set this noisy diagonal to missing, as explained in the :ref:`second-order statistics and missing values ` section in the :ref:`basic ICA ` demo. Here, we will gradually build up an approach that uses more advanced Tensorlab features. .. we start by stacking slices for :math:`\tau = \left\lbrace1,\ldots,K\right\rbrace`. For our :math:`M`-dimensional output, this is implemented as .. code-block:: tensorlab T = zeros(M,M,K); for k = 1:K T(:,:,k) = scov(x,k); end Our first approach is to drop the entire first slice and compute the CPD of the remaining tensor with lags :math:`\tau = \left\lbrace1,\ldots,K-1\right\rbrace` instead of :math:`\tau = \left\lbrace 0,\ldots,K-1\right\rbrace`. First we compute this CPD without imposing any structure: .. code-block:: tensorlab C2x = scov(x,1:K-1); U = cpd(C2x,R); cpderr(M,U{1}) which yields a relative error on :math:`\mat{M}` of ``2.347691e-02``. :num:`Figure #sobifig1` shows that the factor matrices in the first and second mode are both equal to :math:`\mat{M}`. This symmetry can be imposed in the :docurl:`structured data fusion ` framework. First, the variables of the SDF algorithm need to be properly initialized. This can be done using the result of the unconstrained CPD, which has already been computed: .. code-block:: tensorlab model.variables.M = U{1}; model.variables.C = U{3}; These variables can now be used to compose the factors that will appear in the decomposition: .. code-block:: tensorlab model.factors.M = 'M'; model.factors.C = 'C'; In a next step, the tensor and the type of decomposition have to be specified. At this point, the symmetry is exploited by imposing that the factor matrices in the first two modes are both equal to ``M``. .. code-block:: tensorlab model.factorizations.example_cpdsym.data = C2x; model.factorizations.example_cpdsym.cpd = {'M','M','C'}; It may be useful to verify the syntax and consistency of the model. This can be done using ``sdf_check``, which indicates the correctness. The ``print`` option can be used to see the conversions made between variables, factors and factorizations: .. code-block:: tensorlab sdf_check(model,'print') .. code-block:: none :caption: sobi-1 Factor Size Comment ------------------------------------------------------------------------ M [5x3] C [19x3] Factorization Type Factors Comments ------------------------------------------------------------------------ example_cpdsym (id = 1) cpd M,M,C Finally, the model is computed using numerical optimization (we choose a nonlinear least squares method) and the relative estimation error of the result is determined: .. code-block:: tensorlab sol = sdf_nls(model); cpderr(M,sol.factors.M) This approach leads to a relative error of ``1.594028e-02``, which is a slight improvement on the previous result. Note that, by default, the syntax and consistency of the model is always verified automatically when using the SDF algorithms such as ``sdf_nls`` and ``sdf_minf``. With first slice ^^^^^^^^^^^^^^^^ In the previous approaches, the first tensor slice was dropped to get rid of the noisy values on its diagonal. Here, the first slice will be kept and the noise effects will be explicitly modeled. In this case, computation of a simple unconstrained CPD leads to suboptimal results: .. code-block:: tensorlab C2x = scov(x,0:K-1); U = cpd(C2x,R); cpderr(M,U{1}) This yields a relative error of ``2.095566e-02``. Since only the diagonal of the first slice is perturbed, and actually not much, the effect on the result is limited. Explicit modeling of the noise contributions may perhaps improve this result. Such additional modeling allows us to further illustrate Tensorlab's SDF framework. First, the variables need to be initialized. Prior information can be used for this purpose, if it is available. Here, the results of the unconstrained CPD are re-used. To capture the standard deviations of the noise, an extra variable ``noise`` is added, initialized with random positive values. .. code-block:: tensorlab model.variables.M = U{1}; model.variables.C = U{3}; model.variables.noise = rand(Q,1); Construction of the factors requires some mathematical insight into the problem. The goal is to add a diagonal matrix holding noise variances to the first frontal slice of the tensor. Mathematically, we would like to construct .. math:: \mat{C}_{\vec{x}}^{(2)} = \mat{M} \mat{C}_{\vec{s}}^{(2)} \mat{M}^T + \Sigma_n^2 as the first frontal slice of :math:`\ten{C}_{\vec{x}}^{(2)}`. One can start by placing the variable ``noise``, containing the noise standard deviations :math:`\sigma_{n_q}`, in a diagonal matrix: .. math:: \mat{\Sigma}_n = \begin{bmatrix} \sigma_{n_1} & 0 & 0\\ 0 & \ddots & 0\\ 0 & 0 & \sigma_{n_Q}\end{bmatrix}. To obtain a matrix with variances on the diagonal, the matrix above can be used as factor matrix in the first and second mode, leading to .. math:: \begin{bmatrix} \sigma_{n_1} & 0 & 0\\ 0 & \ddots & 0\\ 0 & 0 & \sigma_{n_Q}\end{bmatrix} \cdot \begin{bmatrix} \sigma_{n_1} & 0 & 0\\ 0 & \ddots & 0\\ 0 & 0 & \sigma_{n_Q}\end{bmatrix}^{\T} = \begin{bmatrix} \sigma^2_{n_1} & 0 & 0\\ 0 & \ddots & 0\\ 0 & 0 & \sigma^2_{n_Q}\end{bmatrix} To integrate this diagonal perturbation in the decomposition, the factors in the first two modes can be concatenated, i.e., instead of the factor matrix :math:`\mat{M}`, the matrix :math:`[\mat{M}, \mat{\Sigma}_n]` is used. However, the perturbation must only appear in the first frontal slice. This can be achieved by appending a matrix with ones in the first row and zeros elsewhere to the factor matrix in the third mode, yielding .. math:: \begin{bmatrix} c_{11} & c_{12} & \cdots & c_{1R} & 1 & 1 & \cdots & 1\\ c_{21} & c_{22} & \cdots & c_{2R} & 0 & 0 & \cdots & 0\\ \vdots & \vdots & & \vdots & \vdots & \vdots & & \vdots\\ c_{K1} & c_{K2} & \cdots & c_{KR} & 0 & 0 & \cdots & 0 \end{bmatrix} as factor matrix in the third mode. .. the matrix .. math:: \begin{bmatrix} 1 & 1 & 1\\ 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & 0\\ \end{bmatrix} to the factor matrix in the third mode (in this case we assume there are :math:`4` frontal slices). The Matlab implementation of the explanation above is quite straightforward. To construct a diagonal factor (sub)matrix from the variable ``noise``, the ``struct_diag``-function can be used: .. code-block:: tensorlab diagmat = @(z,task)struct_diag(z,task); model.factors.M = {'M',{'noise',diagmat}}; model.factors.C = {'C',[ones(1,Q); zeros(K-1,Q)]}; Note that concatenating in SDF is similar as in standard Matlab notation: a comma represents horizontal concatenation and a semicolon represents vertical concatenation. The rest of the procedure is the same as above: the data and the decomposition are specified, and the model is fitted using a nonlinear least squares method. .. code-block:: tensorlab model.factorizations.example_cpdnoisemodel.data = C2x; model.factorizations.example_cpdnoisemodel.cpd = {'M','M','C'}; sol = sdf_nls(model,'MaxIter',500); cpderr(M,sol.factors.M) At the cost of a more complicated model, a more accurate estimate with a relative error of ``1.044207e-02`` is obtained in this case. An alternative approach is to denote possibly unreliable values as missing. As mentioned earlier, the i.i.d. noise only affects the diagonal of the first frontal slice of the tensor :math:`\ten{C}^{(2)}_{\vec{x}}` for long enough data sets. It thus suffices to denote these elements on the first diagonal as missing: .. code-block:: tensorlab C2xmiss = C2x; for q = 1:Q C2xmiss(q,q,1) = NaN; end .. Note that the (unstructured) decomposition can also be computed using basic Tensorlab commands, as illustrated in the :ref:`second-order statistics and missing values ` section in the :ref:`basic ICA ` demo. Here, we will also impose symmetry, which calls for more advanced Tensorlab features: Constrained CPDs of incomplete tensors can be computed in the same way as those of full tensors. For instance, symmetry can be imposed as follows: .. code-block:: tensorlab model.variables.M = U{1}; model.variables.C = U{3}; model.factors.M = {'M'}; model.factors.C = {'C'}; model.factorizations.example_cpdmissing.data = C2xmiss; model.factorizations.example_cpdmissing.cpd = {'M','M','C'}; sol = sdf_minf(model,'MaxIter',500); cpderr(M,sol.factors.M) This results in a relative estimation error of ``2.021610e-02``. With prewhitening ^^^^^^^^^^^^^^^^^ In the original SOBI-method, the covariance of the observed signals without shift is used to prewhiten the data :cite:`sobi`. .. code-block:: tensorlab [E,D] = eig(cov(x)); z = (E*abs(D)^(-1/2)*E.'*(x.')).'; After this transformation, the tensor with covariance slices has orthogonal factor matrices in the first and second mode. In the SDF-framework, this orthogonality can be imposed as well. First, the variables are initialized: .. code-block:: tensorlab model.variables.M = randn(R*(Q - (R-1)/2),1); model.variables.C = randn(K,R); Columnwise orthonormal matrices of size :math:`Q \times R` are fully determined by :math:`R(Q - (R-1)/2)` variables, hence the size of the initialization vector. In a next step, the variables are mapped to a columnwise orthonormal factor matrix, using the ``struct_orth`` function: .. code-block:: tensorlab ortho = @(z,task)struct_orth(z,task,[Q R]); model.factors.M = {'M',ortho}; model.factors.C = {'C'}; Next, the data and factorization are specified and the model is computed: .. code-block:: tensorlab model.factorizations.example_cpdprewhit.data = C2x; model.factorizations.example_cpdprewhit.cpd = {'M','M','C'}; sol = sdf_nls(model,'MaxIter',500); Taking into account the prewhitening, it is found that the relative estimation error is ``3.009932e-02``. .. code-block:: tensorlab Mest = E*abs(D)^(1/2)*E.'*sol.factors.M; cpderr(M,Mest) Nonstationary sources --------------------- .. In the examples above, we only imposed some basic symmetry and diagonality to the CPD. However, Tensorlab is capable of much more advanced constraints. To illustrate this, we will look at the blind identification of an instantaneous mixtures of nonstationary independent sources. We now consider an instantaneous mixture of nonstationary independent source signals .. math:: \vec{x}(t) = \mat{M} \cdot \vec{s}(t), in which :math:`\vec{x}(t)` are the observed mixtures, :math:`\mat{M}` contains the mixing coefficients, and :math:`\vec{s}(t)` represent the nonstationary independent sources. For simplicity, we assume that there is no additive noise. Here, we do not assume that the sources are temporally coherent, but that they are nonstationary. .. A nonstationary signal is defined as a signal of which the statistics change throughout time. For instance, we will use these sources for the mixture: .. figure:: img/nonstat.* :alt: nonstat :align: center :width: 100% It is clear that the covariances of these signals change every :math:`2000` samples, implying that these sources are indeed nonstationary. To identify mixtures of such nonstationary source signals, the nonstationarity can be exploited in a similar way as the temporal coherence in the example before. To do this, a tensor-based version of the method presented in :cite:`nonstat` will be used. First, the observed signals are divided into segments, assuming that the source statistics can approximately be considered constant over each segment. For the :math:`k` th segment, computing the covariance yields .. In our case, the sources have been created to be stationary within each slot of :math:`2000` samples, which makes the choice of segmentation length easy. In practice, one would have to rely on some reasonable guess or domain knowledge to determine the appropriate segmentation length. .. math:: \mat{C}_{\vec{x}_k} = \mat{M} \cdot \mat{C}_{\vec{s}_k} \cdot \mat{M}^{\T}. The matrices :math:`\mat{C}_{\vec{s}_k}` are diagonal due to the independence of the inputs. By stacking the observed covariance matrices, a third-order tensor is obtained. .. code-block:: tensorlab % Segment signals and compute covariances Xs = segmentize(x,'segsize',N/K); C2x = dcov(Xs,'dims',[1 3],'perm',true); The factor matrices of the CPD in the first and second mode are again both equal to :math:`\mat{M}`. The factor matrix in the third mode contains the source variances. Since these are always positive, it makes sense to impose nonnegativity on this factor matrix. In Tensorlab, nonnegativity can be imposed on a variable using the ``struct_nonneg`` structure: .. We can now stack the covariances for different segments into a third-order tensor, leading to a very similar tensor as in the SOBI case. If the total number of samples is equal to :math:`N` and :math:`K` segments are used, this is done in Matlab by .. code-block:: tensorlab T = zeros(M,M,K); subset = 1:N/K; for k = 1:K T(:,:,k) = cov(x((k-1)*N/K + subset,:)); end By looking at the model, we see that if we compute the CPD of this tensor, the factor matrices in the first two modes will be identical, as was the case for SOBI. In Tensorlab, this can be easily done as follows (on the fourth line): .. code-block:: tensorlab model.variables.M = randn(Q,R); model.variables.C = rand(K,R); model.factors.M = 'M'; model.factors.C = {'C',@struct_nonneg}; model.factorizations.example_cpdnonneg.data = C2x; model.factorizations.example_cpdnonneg.cpd = {'M','M','C'}; sol = sdf_nls(model,'MaxIter',500,'TolFun',1e-8); cpderr(M,sol.factors.M) This procedure leads to an estimation error of ``1.186503e-01`` for a mixture of three sources with five observed signals and with signals of length :math:`10^4` samples and a signal-to-noise ratio of :math:`10` dB. Convolutive mixtures -------------------- .. Let us take it even further. In both examples above, the mixture was instantaneous, yielding very basic models with limited structure. However, in applications such as telecommunications and speech analysis, convolutive mixtures are frequently observed. Since the sources are the signals of interest in these applications, they have to be blindly estimated from the convolutive mixture. Due to the convolutive nature of the mixture, matrices with Toeplitz structure emerge. We will show here how to deal with these using Tensorlab. .. Just as in the previous examples, we will assume that the sources are mutually independent and we will turn to second order statistics to solve the problem. In :cite:`csobi`, the convolutive extension of SOBI was presented, which we will use here. This also implies that our sources must be temporally coherent. A convolutive mixture of :math:`R` sources :math:`s_r(t)` in :math:`M` measurements :math:`x_m(t)` can be written as .. math:: x_m(t) = \sum_{r = 1}^{R} \sum_{l = 0}^{L} h_{mr}(l) s_r(t-l) \qquad \text{for } m = 1,\ldots,M, in which :math:`h_{mr}(l)` represents the convolutive mixing filter from input :math:`r` to output :math:`m` and :math:`L` is the maximum filter delay (which implies that the filter length is :math:`L+1`). We assume for simplicity that there is no additive noise. To write this relation as a matrix product, first construct .. math:: \vec{s}(n) &= \left[s_1(n), \ldots, s_1(n-(L+L')+1),\ldots,s_R(n-(L+L')+1)\right]^{\T}\\ \vec{x}(n) &= \left[x_1(n), \ldots, x_1(n-L'+1),\ldots,x_M(n),\ldots,x_M(n-L'+1)\right]^{\T}, with :math:`L'` chosen so that :math:`M L' \geq R (L + L')`. The mixture can now be written as :math:`\vec{x}(n) = \mat{H} \cdot \vec{s}(n)`, in which :math:`\mat{H}` is a Toeplitz-block matrix given by .. math:: \mat{H} = \begin{bmatrix} \mat{H}_{11} & \cdots & \mat{H}_{1R}\\ \vdots & \ddots & \vdots\\ \mat{H}_{M1} & \cdots & \mat{H}_{MR} \end{bmatrix} \in \R^{ML' \times R(L+L')} with blocks .. math:: \mat{H}_{ij} = \begin{bmatrix} h_{ij}(0) & \cdots & h_{ij}(L) & \cdots & 0 \\ & \ddots & \ddots & \ddots & \\ 0 & \cdots & h_{ij}(0) & \cdots & h_{ij}(L) \end{bmatrix} \in \R^{L' \times (L+L')}. Note that the choice of :math:`L'` implies that :math:`\mat{H}` will always have at least as many rows as columns. Now, a similar approach as in the instantaneous case can be used. By stacking lagged covariance matrices of the outputs :math:`E\left\lbrace\vec{x}(t)\vec{x}(t+\tau)^{\T}\right\rbrace`, the tensor shown in :num:`Figure #sobifig2` is obtained. This tensor can be decomposed using a :docurl:`block term decomposition ` in multilinear rank-:math:`(L+L',L+L',\cdot)` terms. In :num:`Figure #sobifig2`, the matrix :math:`\mat{H}_k` represents the :math:`k` th block column of :math:`\mat{H}` and the core tensors are formed by the block diagonals of the covariances of :math:`\vec{s}(n)`. This decomposition can be computed using the SDF-framework of Tensorlab. .. Now that we have written this relation as a matrix product :math:`\vec{x}(n) = \mat{H} \cdot \vec{s}(n)`, we can follow the same approach as in the instantaneous SOBI case. We construct a tensor consisting of covariances with different time shifts: .. code-block:: tensorlab T = zeros(M*Lacc,M*Lacc,K); for k = 1:K T(:,:,k) = scov(x_ext,k); end We again avoided the noise influences by only considering time shifts different from zero. Due to the way the source vector :math:`\vec{s}(n)` was constructed, its covariance will not be diagonal. Instead, a block-diagonal structure emerges because the autocorrelation of each source differs from zero. We thus obtain a tensor decomposition of the form .. _sobifig2: .. figure:: img/csobi.* :alt: SOBI :align: center :width: 90% Stacking the lagged covariance matrices for convolutive mixtures leads to a block-term decomposition in rank-:math:`(L+L',L+L',\cdot)` terms. .. To compute this decomposition, we turn to the structured data fusion framework, which allows to capture the available structure. First, the filter coefficients for each submatrix of :math:`\mat{H}` and the core tensors have to be initialized. For a mixture of two sources having three outputs, this is done by: .. code-block:: tensorlab model.variables.H11 = randn(L+1,1); model.variables.H21 = randn(L+1,1); model.variables.H31 = randn(L+1,1); model.variables.H12 = randn(L+1,1); model.variables.H22 = randn(L+1,1); model.variables.H32 = randn(L+1,1); model.variables.Core1 = randn(L+Lacc,L+Lacc,K); model.variables.Core2 = randn(L+Lacc,L+Lacc,K); Note that the parameter :math:`L'` is represented by ``Lacc``. Next, the Toeplitz structure of the submatrices :math:`\mat{H}_{ij}` is implemented. As explained in the documentation of ``struct_toeplitz``, it is possible to pass along known diagonals under or above the sought ones. Here, the fact that the first and last :math:`L'-1` diagonals of :math:`\mat{H}_{ij}` are zero, is taken into account in: .. code-block:: tensorlab toepl = @(z,task)struct_toeplitz(z,task,[Lacc L+Lacc], ... zeros(Lacc-1,1),zeros(Lacc-1,1)); This code will provide a structure that pads the variable ``z`` with :math:`L'-1` zeros at both ends and then uses these elements for the diagonals of a Toeplitz matrix. The rest of the code is similar to the previous examples: the structure is imposed when creating the factors, the data and decomposition are specified, and the model is computed: .. code-block:: tensorlab model.factors.H1 = {{'H11',toepl};{'H21',toepl};{'H31',toepl}}; model.factors.H2 = {{'H12',toepl};{'H22',toepl};{'H32',toepl}}; model.factors.Core1 = {'Core1'}; model.factors.Core2 = {'Core2'}; model.factors.C = eye(K); model.factorizations.example_btdconv.data = T; model.factorizations.example_btdconv.btd = {{'H1','H1','C','Core1'}, {'H2','H2','C','Core2'}}; options = struct; options.Display = 50; options.MaxIter = 500; options.TolFun = 1e-8; options.TolX = 1e-8; sol = sdf_minf(model,options); Pest = [sol.variables.H11, sol.variables.H12; sol.variables.H21,... sol.variables.H22; sol.variables.H31, sol.variables.H32]; cpderr(P,Pest) Because there is no factor matrix in the third mode, an identity matrix is used in that mode. The matrices ``Pest`` and ``P`` are constructed to easily compare the computed solution to the real one. The obtained accuracy is ``1.033602e-02`` when the signals have :math:`10^4` samples and the signal-to-noise ratio is :math:`20` dB in a mixture of two sources having three outputs and :math:`L = 1, L' = 2`.