[][src]Function deep_learning_playground::perceptron::single::and_perceptron

pub fn and_perceptron() -> Box<dyn Fn(bool, bool) -> bool>

and_perceptron generates the logical AND function. Let \(p\) and \(q\) are logical variables, and_perceptron generates the function which satisfies the following truth table.

\(p\)\(q\)and_perceptron()(\(p\),\(q\))
\(1\)\(1\)\(1\)
\(1\)\(0\)\(0\)
\(0\)\(1\)\(0\)
\(0\)\(0\)\(0\)

e.g.

assert_eq!(true, deep_learning_playground::perceptron::single::and_perceptron()(true, true));
assert_eq!(false, deep_learning_playground::perceptron::single::and_perceptron()(false, true));
assert_eq!(false, deep_learning_playground::perceptron::single::and_perceptron()(false, false));