Accord.Statistics.Analysis.ContrastFunctions.Exponential.Evaluate C# (CSharp) Method

Evaluate() public method

Contrast function.
public Evaluate ( double x, double output, double derivative ) : void
x double The vector of observations.
output double At method's return, this parameter /// should contain the evaluation of function over the vector /// of observations .
derivative double At method's return, this parameter /// should contain the evaluation of function derivative over /// the vector of observations .
return void
        public void Evaluate(double[] x, double[] output, double[] derivative)
        {
            // Exponential contrast function and its derivative, as given
            //  in original Hyvärinen's paper. See main references for the
            //  Independent Component Analysis class for details.

            for (int j = 0; j < x.Length; j++)
            {
                double w = x[j];
                double e = System.Math.Exp(-alpha * (w * w) / 2.0);

                // g(w*x) = wx * exp(-(wx^2)/2)
                output[j] = w * e;

                // g'(w*x) = (1 - wx^2) * exp(-(wx^2)/2)
                derivative[j] = (1.0 - alpha * w * w) * e;
            }
        }
    }