The activation functions used by the flat networks.
        /// <summary>
        /// Calculate the derivative of the activation. It is assumed that the value
        /// x, which is passed to this method, was the output from this activation.
        /// This prevents this method from having to recalculate the activation, just
        /// to recalculate the derivative.
        /// </summary>
        ///
        /// <param name="type"/>The type of activation.</param>
        /// <param name="x"/>The activation to calculate for.</param>
        /// <param name="params"/>The parameters for this activation function.</param>
        /// <param name="paramOffset"/>The offset the parameters begin at.</param>
        /// <returns>The derivative.</returns>
        public static double CalculateActivationDerivative(int type,
                                                           double x, double[] paras, int paramOffset)
        {
            switch (type)
            {
            case ActivationFunctions.ACTIVATION_LINEAR:
                return(ActivationFunctions.CalculateActivationDerivativeLINEAR(x,
                                                                               paras, paramOffset));

            case ActivationFunctions.ACTIVATION_TANH:
                return(ActivationFunctions.CalculateActivationDerivativeTANH(x,
                                                                             paras, paramOffset));

            case ActivationFunctions.ACTIVATION_SIGMOID:
                return(ActivationFunctions.CalculateActivationDerivativeSIGMOID(x,
                                                                                paras, paramOffset));

            case ACTIVATION_SOFTMAX:
                return(ActivationFunctions.CalculateActivationDerivativeSOFTMAX(x,
                                                                                paras, paramOffset));

            case ACTIVATION_BIPOLAR:
                return(ActivationFunctions.CalculateActivationDerivativeBIPOLAR(x,
                                                                                paras, paramOffset));

            case ACTIVATION_STEP:
                return(ActivationFunctions.CalculateActivationDerivativeSTEP(x,
                                                                             paras, paramOffset));

            case ACTIVATION_RAMP:
                return(ActivationFunctions.CalculateActivationDerivativeRAMP(x,
                                                                             paras, paramOffset));

            case ACTIVATION_COMPETITIVE:
                return(ActivationFunctions
                       .CalculateActivationDerivativeCOMPETITIVE(x, paras,
                                                                 paramOffset));

            case ACTIVATION_SIN:
                return(ActivationFunctions.CalculateActivationDerivativeSIN(x,
                                                                            paras, paramOffset));

            case ACTIVATION_LOG:
                return(ActivationFunctions.CalculateActivationDerivativeLOG(x,
                                                                            paras, paramOffset));

            case ACTIVATION_GAUSSIAN:
                return(ActivationFunctions.CalculateActivationDerivativeGAUSSIAN(x,
                                                                                 paras, paramOffset));

            default:
                throw new EncogEngineError("Unknown activation type: " + type);
            }
        }
        /// <summary>
        /// Calculate an activation.
        /// </summary>
        ///
        /// <param name="type"/>The type of activation.</param>
        /// <param name="x"/>The input and output array. Input values are provided and thearray is modified to reflect the output.</param>
        /// <param name="params"/>THe parameters needed for the calculation.</param>
        /// <param name="xOffset"/>The offset into X for where we are calculating.</param>
        /// <param name="xLength"/>The length of the array we are calculating.</param>
        /// <param name="paramOffset"/>The parameter offset.</param>
        public static void CalculateActivation(int type, double[] x,
                                               double[] paras, int xOffset, int xLength,
                                               int paramOffset)
        {
            switch (type)
            {
            case ActivationFunctions.ACTIVATION_LINEAR:
                ActivationFunctions.CalculateActivationLINEAR(x, paras, xOffset,
                                                              xLength, paramOffset);
                break;

            case ActivationFunctions.ACTIVATION_TANH:
                ActivationFunctions.CalculateActivationTANH(x, paras, xOffset,
                                                            xLength, paramOffset);
                break;

            case ActivationFunctions.ACTIVATION_SIGMOID:
                ActivationFunctions.CalculateActivationSIGMOID(x, paras, xOffset,
                                                               xLength, paramOffset);
                break;

            case ACTIVATION_SOFTMAX:
                ActivationFunctions.CalculateActivationSOFTMAX(x, paras, xOffset,
                                                               xLength, paramOffset);
                break;

            case ACTIVATION_BIPOLAR:
                ActivationFunctions.CalculateActivationBIPOLAR(x, paras, xOffset,
                                                               xLength, paramOffset);
                break;

            case ACTIVATION_STEP:
                ActivationFunctions.CalculateActivationSTEP(x, paras, xOffset,
                                                            xLength, paramOffset);
                break;

            case ACTIVATION_RAMP:
                ActivationFunctions.CalculateActivationRAMP(x, paras, xOffset,
                                                            xLength, paramOffset);
                break;

            case ACTIVATION_COMPETITIVE:
                ActivationFunctions.CalculateActivationCOMPETITIVE(x, paras,
                                                                   xOffset, xLength, paramOffset);
                break;

            case ACTIVATION_SIN:
                ActivationFunctions.CalculateActivationSIN(x, paras, xOffset,
                                                           xLength, paramOffset);
                break;

            case ACTIVATION_LOG:
                ActivationFunctions.CalculateActivationLOG(x, paras, xOffset,
                                                           xLength, paramOffset);
                break;

            case ACTIVATION_GAUSSIAN:
                ActivationFunctions.CalculateActivationGAUSSIAN(x, paras, xOffset,
                                                                xLength, paramOffset);
                break;

            default:
                throw new EncogEngineError("Unknown activation type: " + type);
            }
        }