Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Approximate a numerical matrix as sum of Kronecker products
ResourceFunction["NearestKroneckerProductSum"][m,{p1,q1},{p2,q2},n] gives a decomposition of a numerical matrix m into a sum of n Kronecker products of matrices of dimensions p1×q1 and p2×q2. | |
ResourceFunction["NearestKroneckerProductSum"][m,{p1,q1},{p2,q2},UpTo[n]] gives the decomposition for n Kronecker products, or as many as are available. |
Compute a Kronecker product approximation of a small matrix:
In[1]:= |
Out[1]= |
Form the approximant to the original matrix:
In[2]:= |
Out[2]= |
Using two terms gives a much better approximant:
In[3]:= |
Out[3]= |
In[4]:= |
Out[4]= |
The Frobenius norm of the remainder matrix is on the order of machine precision:
In[5]:= |
Out[5]= |
Define a 10×12 matrix:
In[6]:= |
Express the matrix as a sum of three Kronecker products of matrices of dimensions 5×3 and 2×4:
In[7]:= |
Out[7]= |
Check the difference between the original matrix and the sum of the Kronecker products:
In[8]:= |
Out[8]= |
A 10×12 matrix with approximate numerical values:
In[9]:= |
Out[9]= |
Express the matrix as a sum of up to seven Kronecker products of matrices of dimensions 2×3 and 5×4:
In[10]:= |
Out[10]= |
Check the difference between the original matrix and the sum of the Kronecker products:
In[11]:= |
Out[11]= |
An arbitrary-precision 10×12 matrix:
In[12]:= |
Out[12]= |
Express the matrix as a sum of up to seven Kronecker products of matrices of dimensions 2×3 and 5×4:
In[13]:= |
Out[13]= |
Check the difference between the original matrix and the sum of the Kronecker products:
In[14]:= |
Out[14]= |
Decompose a random complex-valued 10×12 matrix into a sum of two Kronecker products of matrices of dimensions 2×3 and 5×4:
In[15]:= |
Out[15]= |
NearestKroneckerProductSum is left unevaluated for symbolic input:
In[16]:= |
Out[16]= |
NearestKroneckerProductSum is left unevaluated for exact input:
In[17]:= |
Out[17]= |
Numericize the input to get a result:
In[18]:= |
Out[18]= |
NearestKroneckerProductSum is left unevaluated if the specified dimensions are incommensurate:
In[19]:= |
Out[19]= |
The decomposition of a matrix into a sum of Kronecker products is not unique:
In[20]:= |
In[21]:= |
Out[21]= |
This work is licensed under a Creative Commons Attribution 4.0 International License