sigmoid (matrix, vector, scalar) implementation