8

Given $A \in \mathbb{R}^{n \times n}$, let $Q \in O(n)$ be the orthogonal matrix nearest to $A$ in the Frobenius norm, i.e.,

$$Q := \text{arg}\min_{M \in O(n)} \| A - M \|_{F}^2$$

It's well known that $Q = U V^{T}$, where $A = U\Sigma V^{T}$ is the SVD of $A$ (see Orthogonal_Procrustes, Nearest orthogonal matrix).

I'm trying to solve a similar problem:

$$S := \text{arg}\min_{M \in \mbox{SP}(n)} \| A - M \|_{F}^2$$

where $\mbox{SP}(n)$ is a group of signed permutation matrices.

I know that in the case of permutation matrices, the problem reduces to linear sum assignment and can be solved using the Hungarian algorithm. I suspect in the signed permutation case it will reduce to some linear program. Is it possible to somehow solve this problem using SVD or the Hungarian algorithm?

I would really like to avoid general LP solvers, if possible.

ivt
  • 1,667
  • 2
    So $M$ has entries $\pm 1$, and exactly one nonzero in each row/column? If you replace all elements of $Q$ with their absolute values, it becomes a regular permutation matrix problem where you can use the Hungarian algorithm (or Jonker-Volgenant, much faster!). Am I missing something? – LinAlg Nov 06 '18 at 23:41
  • @LinAlg great comment. I believe you meant to replace elements of $A$ with their absolute values? Then I could find permutation matrix $Q$ and set $q_{ij}$ to be $-1$ if the corresponding $a_{ij}$ was negative? I thought about this but haven't yet convinced myself such procedure would be correct. I'll try to make a proof sketch and let you know! You might also choose to write this as a full answer. – ivt Dec 19 '18 at 19:53
  • 1
    the answer of Erick Wong boils down to the same: the choice of the min depends on the sign of the element in $M$ – LinAlg Dec 19 '18 at 19:56
  • @LinAlg I've read the answer and see the connection now. Thanks a lot! – ivt Dec 19 '18 at 19:58
  • Do you agree with my edits? – Rodrigo de Azevedo Feb 17 '23 at 21:30

1 Answers1

7

This reduces in linear time to the assignment problem in much the same way as the unsigned case, at least for the simple reduction I have in mind. Let me thus reiterate the unsigned case as I see it: form a cost matrix $c_{ij}$ as the norm contribution of assigning the $i$th row of $M$ to the $j$th elementary row vector $e_j$, namely

$$c_{ij} = \sum_{k=1}^n (a_{ik} - e_{jk})^2.$$

Then the problem is equivalent to minimizing the cost of assigning all rows of $M$ to distinct elementary vectors.

The only difference in your example is that you calculate the cost function as a min of just two possibilities: $e_j$ or $-e_j$. So take

$$c_{ij} = \min \{ \sum_{k=1}^n (a_{ik} - e_{jk})^2 , \sum_{k=1}^n (a_{ik} + e_{jk})^2 \}$$

and you’re done. There are of course efficient ways to compute $c_{ij}$ without summing the entire row every time.

Erick Wong
  • 25,868
  • 3
  • 43
  • 96
  • Amazing answer. I haven't though of the cost matrix like that before. Thanks a lot. – ivt Dec 19 '18 at 19:57