From 288f7f2c7044ca12f6e59034f52d7d08ecd01f5a Mon Sep 17 00:00:00 2001 From: Vishal Patil Date: Mon, 2 Sep 2024 14:16:14 -0400 Subject: [PATCH] Fix the cov function --- pca/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pca/src/main.rs b/pca/src/main.rs index c896307..e3ca0a4 100644 --- a/pca/src/main.rs +++ b/pca/src/main.rs @@ -39,7 +39,7 @@ fn cov(data: &Tensor, device: &Device) -> Result { let cov = centered .transpose(D::Minus1, D::Minus2)? .matmul(¢ered)? - .broadcast_div(&Tensor::new(m as f32, device)?)?; + .broadcast_div(&Tensor::new((m - 1) as f32, device)?)?; Ok(cov) }