LDA method implemented without testing the correctness.