MCPcopy Create free account
hub / github.com/daniel-e/rustml / if_then

Method if_then

src/matrix.rs:768–775  ·  view source on GitHub ↗
(&self, prd: F, tr: T, fa: T)

Source from the content-addressed store, hash-verified

766 }
767
768 pub fn if_then<F>(&self, prd: F, tr: T, fa: T) -> Matrix<T>
769 where F: Fn(&T) -> bool {
770
771 Matrix::from_iter(
772 self.values().map(|x| if prd(x) { tr.clone() } else { fa.clone() }),
773 self.cols()
774 ).unwrap()
775 }
776}
777
778// --------------- Iterators ----------------------------------------

Callers

nothing calls this directly

Calls 3

mapMethod · 0.80
valuesMethod · 0.80
colsMethod · 0.80

Tested by

no test coverage detected