Given:
x(n1,n2) = {1 ,n1=0,n2=0 ;
2 ,n1=1,n2=0 ;
3 ,n1=0,n2=1 ;
6 ,n1=1,n2=1 }
How could one prove it is separable?
Given:
x(n1,n2) = {1 ,n1=0,n2=0 ;
2 ,n1=1,n2=0 ;
3 ,n1=0,n2=1 ;
6 ,n1=1,n2=1 }
How could one prove it is separable?
Nilesh Padhi, Welcome to the DSP Community.
The classic definition of separable means the data (2D) given by $ X \in \mathbb{R}^{m \times n} $ can be written as:
$$ X = \sigma u {v}^{T} $$
Where $ \sigma \in \mathbb{R} $, $ u \in \mathbb{R}^{m} $ and $ v \in \mathbb{R}^{n} $.
This is called Rank 1 Matrix.
How can you get those parameters and vectors given $ X $?
Well, the Singular Value Decomposition (SVD) is here to save the data.
The SVD of $ X $ is given by:
$$ X = U \Sigma {V}^{T} = \sum {\sigma}_{i} {u}_{i} {v}_{i}^{T} $$
You can see those match when $ {\sigma}_{j} = 0 $ for $ j \geq 2 $.
So what you should do is the following:
epsThr = 1e-7;
[mU, mD, mV] = svd(mX);
vD = diag(mD);
if(all(vD(2:end) < epsThr))
vU = mU(:, 1);
vV = mV(:, 1);
end
We checked if indeed the singular value of 2 and onward are small.
If they do (You can decide to what degree of small by epsThr) then it is separable and the vectors are vU and vV.
In your case:
mX = [1, 3; 2, 6];
[mU, mD, mV] = svd(mX);
vD = diag(mD);
disp(vD);
The result is:
vD =
7.0711
0.0000
Since vD values are zero besides the first element (Only single non vanishing Singular Value) it is separable.
Indeed you can see that:
mD(1) * mU(:, 1) * mV(:, 1).'
ans =
1.0000 3.0000
2.0000 6.0000
As expected.
This method is really useful in Image Processing when we want to convolve with 2D kernel and we find it is separable and hence we can apply the 2D convolution using 2 1D convolutions (Along Columns / Rows).
In that case we define $ \hat{u} = \sqrt{{\sigma}_{1}} u $ and $ \hat{v} = \sqrt{{\sigma}_{1}} v $ where $ {\sigma}_{1} $ is the Singular Value.
Then we convolve $ \hat{u} $ along columns and $ \hat{v}^{T} $ along rows.
imfilter(). In Linear Algebra you usually leave at the form of the SVD decomposition in order ot keep $ u $ and $ v $ part of orthonormal basis.
– Royi
Aug 27 '18 at 19:03
imfilter() multiply each by the square root [At least in MATLAB R2018a]). I wasn't into the small details of technicality but into the idea. Thank You.
– Royi
Aug 27 '18 at 20:50