Find a matrix A that satisfies data

51 Views Asked by At

I want to find a matrix $A \in \mathbb{R}^{3\times3}$ that minimizes the following expression:-

$\sum_{i=1}^N ( \|Ax_i\|^2_2 - b_i )^2$

where $x_i \in \mathbb{R}^{3}_{\ge 0}$, $b_i \in \mathbb{R}_{\ge 0}$.

Is there an easy (or standard) way to go about solving this?

Thanks for your help!

1

There are 1 best solutions below

1
On

As described in the comments, it can be cast as a semidefinite program. Using MATLAB and the modelling Toolbox YALMIP (disclaimer, developed by me) and some SDP solver (such as Mosek, Sedumi, SDPT3) you have

N = 100;
x = randn(3,N);
b = rand(1,N);
B = sdpvar(3);
objective = 0;
for i = 1:N
    objective = objective + (x(:,i)'*B*x(:,i) - b(i))^2;
end
constraints = [B >= 0];
optimize(constraints,objective)
A = value(B)^0.5;

The obejctive can alternatively be written as

((diag(x'*B*x)-b'))'*((diag(x'*B*x)-b'))