Shift and scale a set of vectors to align them: $a_i \mathbf x_i + b_i = a_j\mathbf x_j + b_j$ for all $i,j$

41 Views Asked by At

Align a set of vectors with shifting and scaling:

Given a set of vectors $\mathbf x_1, \cdots, \mathbf x_N$ in $\mathbb R^n$, find pairs of real numbers $(a_1, b_1), \cdots, (a_N, b_N)$ (scaling and shifting parameters) such that $ | (a_i \mathbf x_i + b_i) - (a_j \mathbf x_j + b_j) | $ is minimal for all $i,j$. Here summing a real value to the vector is done element-wise.

How should I approach this problem?

What I tried is to simply get the mean vector $\bar {\mathbf x}$ and then solve $N$ least squares problems $a_i \mathbf x_i + b_i = \bar {\mathbf x}$ but I'm not sure this is the optimal approach.

Edit: Ok so a friend pointed out that there's the trivial solution $a_i = b_i = 0$ which is not what I was aiming for. In a way, I wish to calibrate each vector with the least amount of scaling and shifting ($a_i \approx 1, b_i \approx 0$) so that they all align.

Edit2: Imagine I have a set of rulers with marks, but let's say the ruler manufacturer is not very good so the marks across rulers are misaligned. I'd like to stretch each ruler or shift the marks so that they all align.