Trait for common mathematical functions for scalars, vectors and matrices.
| 44 | |
| 45 | /// Trait for common mathematical functions for scalars, vectors and matrices. |
| 46 | pub trait Functions { |
| 47 | |
| 48 | /// Computes the sigmoid function (i.e. 1/(1+exp(-x))) for a scalar or each |
| 49 | /// element in a vector or matrix. |
| 50 | fn sigmoid(&self) -> Self; |
| 51 | |
| 52 | /// Computes the derivative of the sigmoid function (i.e. sigmoid(x) * (1 - sigmoid(x))) |
| 53 | /// for a scalar or each element in a vector or matrix. |
| 54 | fn sigmoid_derivative(&self) -> Self; |
| 55 | |
| 56 | /// Computes the reciprocal (inverse) of each element of the matrix |
| 57 | /// and returns the result in a new matrix. |
| 58 | fn recip(&self) -> Self; |
| 59 | } |
| 60 | |
| 61 | macro_rules! impl_functions { |
| 62 | ( $( $x:ty )+ ) => ($( |
nothing calls this directly
no outgoing calls
no test coverage detected