1

I'm developing a program that uses a linear transformation $$T=Hi*Hk$$ to do a prediction. Where $Hi$ and $Hk$ are 3x3 invertible matrices.

The prediction has an error and I can find a 3x3 correction matrix $Hc$ so that $$T2 = Hc*Hi*Hk$$

now my prediction using $T2$ has no error.

What I want is to introduce my correction matrix $Hc$ into $Hk$ so that I have a new $Hk'$ so that $$T2= Hi*Hk'$$

Is there any close-form way of obtaining $Hk'$ in terms of $Hc,Hi,Hk$ ?

2 Answers2

1

Sure.

$$ H_k' = H_i^{-1} H_c H_i H_k. $$ Since matrix inversion (for $3 \times 3$ matrices) can be carried out explicitly (via Cramer's rule, for instance), this is a closed-form way of finding what you need.

I feel obliged to say that I also think it's a rather bad idea to seek a closed-form solution, for the matrix $H_i$, while invertible, might be badly conditioned, so that any Cramer's-rule approximation of its inverse could be quite bad. But you may have other reasons for wanting a possibly-bad answer, or maybe you know something about $H_i$ that you haven't told us.

John Hughes
  • 93,729
  • Oh! that's embarrassingly obvious. Thanks. The H matrices are homographies. What would be a better conditioned way of finding $Hk'$ ? I just said closed-form because I thought that would be the fastest way of computing $Hk'$. – martinako Jan 18 '17 at 18:30
  • I'd just use your favorite numerical inversion routine (e.g., something based on the SVD). Do you need to compute a billion of these, or just a hundred? If it's just a hundred, then "fastest" probably isn't all that important. :) – John Hughes Jan 18 '17 at 19:07
  • Ok, thanks. I would probably calculate the inverse with numpy.pinv so I guess that would be better conditioned than Cramer's rule? – martinako Jan 18 '17 at 19:22
  • I would need to compute a few hundred of these times 30 per second. I guess that's not too much. But I don't want this part of the system to take too long, it's a realtime application. – martinako Jan 18 '17 at 19:28
  • Yep -- pinv is probably just fine. – John Hughes Jan 18 '17 at 20:14
1

$$Hc\cdot Hi \cdot Hk= Hi \cdot Hk' → Hk' = (Hi)^{-1} \cdot Hc\cdot Hi \cdot Hk$$

Arnaldo
  • 21,342