sigmoid

Function sigmoid 

Source
pub fn sigmoid<F>(a: &ArrayView2<'_, F>) -> LinalgResult<Array2<F>>
where F: Float + NumAssign + Sum + One + Send + Sync + ScalarOperand + 'static,
Expand description

Compute the sigmoid function element-wise on a matrix.

The sigmoid function is defined as: sigmoid(x) = 1 / (1 + exp(-x))

§Arguments

  • a - Input matrix

§Returns

  • Matrix with sigmoid applied element-wise

§Examples

use scirs2_core::ndarray::array;
use scirs2_linalg::matrix_functions::sigmoid;

let a = array![[1.0_f64, 2.0], [3.0, 4.0]];
let sig_a = sigmoid(&a.view()).unwrap();