Implement projection onto the zero subspace

This commit is contained in:
Aaron Fenyes 2024-12-18 00:25:15 -08:00
parent 971a7ca7e2
commit dc067976eb

View File

@ -141,14 +141,16 @@ 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<f64>, column_index: usize) -> DMatrix<f64> {
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()
}
}
}
// --- descent history ---