one shot similarity

i wanted to try the one shot similarity kernel
for same, not-same problems like the lfw challenge.

so, we first train once on background data only, then, for each pair a,b :

1. retrain with a added to negatives, check distance against b.
2. do the reverse, retrain with b added to negatives, check distance against a
3. mix results.

here is some opencv code

speed improved a lot by applying the power method to find the largest eigenvalue, instead of a full eigen decomposition.
so, all time spent in the inversion !
what can be done ?

* i don't have to invert it and multiply my vectors with A.inv() * x = y. i can use solve(A, x, y) instead.
  (still slow, but does not need the inversion)

* instead of the solve(), i can decompose it with SVD (once) and use the backsubstitution.
  (also saves the inversion, but takes ~3times more time than a mat mult)

in the end, for 120000 comparisons, using smaller features (and keep the inverse) turned out to be the best solution.