added unittests for LDA and corrected few mistakes