From dc067976eb4efbf9fd5dbc663bd97850c2a30121 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Wed, 18 Dec 2024 00:25:15 -0800 Subject: [PATCH] Implement projection onto the zero subspace --- app-proto/src/engine.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app-proto/src/engine.rs b/app-proto/src/engine.rs index 36998bd..e96ea52 100644 --- a/app-proto/src/engine.rs +++ b/app-proto/src/engine.rs @@ -141,13 +141,15 @@ impl ConfigSubspace { // find the projection onto this subspace of the motion where the element // with the given column index has velocity `v` - /* TO DO */ - // for the zero subspace, this method's behavior doesn't match its name: it - // panics rather than returning zero pub fn proj(&self, v: &DVectorView, column_index: usize) -> DMatrix { - self.basis.iter().map( - |b| b.column(column_index).dot(&v) * b - ).sum() + if self.dim() == 0 { + const ELEMENT_DIM: usize = 5; + DMatrix::zeros(ELEMENT_DIM, self.assembly_dim) + } else { + self.basis.iter().map( + |b| b.column(column_index).dot(&v) * b + ).sum() + } } }