# Nearest Kronecker Product

Does anyone have a code for the nearest Kronecker product? Or knows the package for it?

I have a large matrix C, and I am trying to find the best approximation for matrices A and B such that A ⊗ B = C.

I searched using the keywords Nearest Kronecker and Reverse Kronecker, but couldn’t find anything.

I am not trying to find Kronecker product of two matrices.

I'm not comfortable that this is sound.

``````# Example matrix
C <- matrix(c(59,39,65,42,13,81,51,41,49), nrow = 3, ncol = 3)

svd_C <- svd(C)
rank_C <- sum(svd_C\$d > 1e-10)
U <- svd_C\$u[, 1:rank_C]
D <- diag(svd_C\$d[1:rank_C])
V <- svd_C\$v[, 1:rank_C]
(A <- U %*% sqrt(D))
#>           [,1]      [,2]       [,3]
#> [1,] -7.107070 -1.942691 -0.9902144
#> [2,] -4.313819 -4.054018  0.8035097
#> [3,] -9.154068  3.418714  0.3901355
(B <- sqrt(D) %*% t(V))
#>            [,1]       [,2]       [,3]
#> [1,] -7.7334426 -7.1676800 -6.4602373
#> [2,] -1.5835192  4.4713244 -3.0653623
#> [3,] -0.9710984  0.2573162  0.8769916
``````

Created on 2023-06-26 with reprex v2.0.2

If A is a m by n matrix, and B is an p by q matrix, then A ⊗ B = C is mn by pq.

So the dimensions in this code don’t match up. A,B and C have the same dimensions.

I thought this was dodgy. Maybe take it up a level to S/O?

Does this help?

Or there is some matlab code at:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.