Implement projection onto the zero subspace
This commit is contained in:
parent
971a7ca7e2
commit
dc067976eb
@ -141,14 +141,16 @@ impl ConfigSubspace {
|
|||||||
|
|
||||||
// find the projection onto this subspace of the motion where the element
|
// find the projection onto this subspace of the motion where the element
|
||||||
// with the given column index has velocity `v`
|
// 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> {
|
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(
|
self.basis.iter().map(
|
||||||
|b| b.column(column_index).dot(&v) * b
|
|b| b.column(column_index).dot(&v) * b
|
||||||
).sum()
|
).sum()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- descent history ---
|
// --- descent history ---
|
||||||
|
Loading…
Reference in New Issue
Block a user