Better pca

This is a pending branch that fixes a lot of things but hasn't been merged.

@AlexandreAbraham and @lesteve : do you think that you have time to have a look and see what needs to be merged.