From 3c7ef759e69b9ba99a6389d01ba3b3a397f0e144 Mon Sep 17 00:00:00 2001
From: bastien-mva <bastien.batardiere@gmail.com>
Date: Wed, 29 Mar 2023 15:12:21 +0200
Subject: [PATCH] not a good idea to orthogonalize the matrix before projecting
 in dimension p

---
 pyPLNmodels/VEM.py | 6 +++---
 setup.py           | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pyPLNmodels/VEM.py b/pyPLNmodels/VEM.py
index e91f83f5..d12564f0 100644
--- a/pyPLNmodels/VEM.py
+++ b/pyPLNmodels/VEM.py
@@ -638,15 +638,15 @@ class _PLNPCA(_PLN):
 
     @property
     def latent_variables(self):
-        self._ortho_C = torch.linalg.qr(self._C, "reduced")[0]
-        return torch.matmul(self._M, self._ortho_C.T).detach()
+        return torch.matmul(self._M, self._C.T).detach()
 
     def get_projected_latent_variables(self, nb_dim):
         if nb_dim > self._q:
             raise AttributeError(
                 "The number of dimension {nb_dim} is larger than the rank {self._q}"
             )
-        return torch.mm(self.latent_variables, self._ortho_C[:, :nb_dim]).detach()
+        ortho_C = torch.linalg.qr(self._C, "reduced")[0]
+        return torch.mm(self.latent_variables, ortho_C[:, :nb_dim]).detach()
 
     def get_pca_projected_latent_variables(self, nb_dim):
         pca = PCA(n_components=nb_dim)
diff --git a/setup.py b/setup.py
index 82f479d6..9b07566b 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from setuptools import setup, find_packages
 
-VERSION = "0.0.32"
+VERSION = "0.0.33"
 
 with open("README.md", "r") as fh:
     long_description = fh.read()
-- 
GitLab