示例#1
0
            protected internal override double doFirstDerivative(double xValue)
            {
                ArgChecker.isTrue(Math.Abs(xValue) > SMALL, "magnitude of xValue must not be small");
                ValueDerivatives resValue = FUNCTION.evaluateAndDifferentiate(poly, xValue);

                return(-resValue.Value / (xValue * xValue) + resValue.getDerivative(0) / xValue);
            }
示例#2
0
            protected internal override DoubleArray doParameterSensitivity(double xValue)
            {
                ArgChecker.isTrue(Math.Abs(xValue) > SMALL, "magnitude of xValue must not be small");
                DoubleArray resSense = FUNCTION.nodeSensitivity(polySens.get(), xValue);

                return(resSense.multipliedBy(DoubleArray.of(resSense.size(), i => xValues[i] / xValue)));
            }
示例#3
0
    private void Update()
    {
        switch (function)
        {
        case FUNCTION.Enable:
            if (c.a < 1.00f)
            {
                c.a += Time.deltaTime * SPEED * speedModifier;
            }
            else
            {
                c.a      = 1.00f;
                function = FUNCTION.Sleep;
            }
            break;

        case FUNCTION.Disable:
            if (c.a > 0.00f)
            {
                c.a -= Time.deltaTime * SPEED * speedModifier;
            }
            else
            {
                c.a      = 0.00f;
                function = FUNCTION.Sleep;
                Deactivate();
            }
            break;

        default:
            enabled = false;
            break;
        }
        VaryColour();
    }
示例#4
0
            //-------------------------------------------------------------------------
            protected internal override double doInterpolate(double xValue)
            {
                ArgChecker.isTrue(Math.Abs(xValue) > SMALL, "magnitude of xValue must not be small");
                double resValue = FUNCTION.evaluate(poly, xValue).get(0);

                return(resValue / xValue);
            }
示例#5
0
    /*
     * Parses TYPEDEF commands (First token, then delegates rest to specific TYPEDEF implementations).
     * Populates typedef table.
     */
    public static TYPEDEF Parse(string code, Dictionary <string, TYPEDEF> typedefTable)
    {
        if (String.IsNullOrEmpty(code))
        {
            throw new ArgumentNullException("code");
        }
        if (null == typedefTable)
        {
            throw new ArgumentNullException("typedefTable");
        }

        string[] tokens = code.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);

        if (tokens.Length < 3)
        {
            throw new ArgumentException("TYPEDEF statements must consist of at least three tokens (TYPEDEF <NAME> <TYPE>), received: " + code);
        }
        if (tokens[0].ToUpper() != "TYPEDEF")
        {
            throw new ArgumentException("TYPEDEFs must start with keyword TYPEDEF, but received: " + tokens[0]);
        }

        TYPEDEF parsedType = null;
        string  Type       = tokens[2].ToUpper();

        if (Type == "BASIC")
        {
            parsedType = new BASIC(tokens, typedefTable);
        }
        else if (Type == "PRODUCT")
        {
            parsedType = new PRODUCT(tokens, typedefTable);
        }
        else if (Type == "SUM")
        {
            parsedType = new SUM(tokens, typedefTable);
        }
        else if (Type == "SEQUENCE")
        {
            parsedType = new SEQUENCE(tokens, typedefTable);
        }
        else if (Type == "FUNCTION")
        {
            parsedType = new FUNCTION(tokens, typedefTable);
        }
        else if (Type == "SUBTYPE")
        {
            parsedType = new SUBTYPE(tokens, typedefTable);
        }
        else
        {
            throw new SyntacticException("Not a valid TYPEDEF: " + code);
        }

        return(parsedType);
    }
示例#6
0
 // Snappy enable
 public void TurnOn()
 {
     Activate();
     c.a = 1.00f;
     if (col2D)
     {
         col2D.enabled = true;
     }
     function = FUNCTION.Sleep;
     VaryColour();
 }
示例#7
0
 // Snappy disable
 public void TurnOff()
 {
     c.a = 0.00f;
     if (col2D)
     {
         col2D.enabled = false;
     }
     function = FUNCTION.Sleep;
     VaryColour();
     Deactivate();
 }
 public LinearRegressionFunction(FUNCTION function)
 {
     this.function = function;
 }
示例#9
0
 public FunctionService(FUNCTION item)
 {
     _item = item;
 }
示例#10
0
 public LinearRegressionFunction(FUNCTION function)
 {
     this.function = function;
 }
示例#11
0
 // Progressive disable
 public void Disable()
 {
     function = FUNCTION.Disable;
     WhenDisabled();
     enabled = true;
 }
示例#12
0
 // Progressive enable
 public void Enable()
 {
     function = FUNCTION.Enable;
     WhenEnabled();
     enabled = true;
 }
示例#13
0
 /// <summary>
 /// Run a function on the pre-processor DLL without any arguments.
 /// </summary>
 /// <param name="fn">Specifies the function to run.</param>
 public void Run(FUNCTION fn)
 {
     m_iextension.RunExtension(m_hExtension, (long)fn, null);
 }
示例#14
0
 /// <summary>
 /// Run a function on the pre-processor DLL with arguments.
 /// </summary>
 /// <param name="fn">Specifies the function to run.</param>
 /// <param name="rgParam">Specifies the arguments.</param>
 /// <returns>The return values from the pre-processor DLL are returned.</returns>
 public float[] Run(FUNCTION fn, float[] rgParam)
 {
     return(m_iextension.RunExtensionF(m_hExtension, (long)fn, rgParam));
 }
示例#15
0
 /// <summary>
 /// Run a function on the pre-processor DLL with arguments.
 /// </summary>
 /// <param name="fn">Specifies the function to run.</param>
 /// <param name="rgParam">Specifies the arguments.</param>
 /// <returns>The return values from the pre-processor DLL are returned.</returns>
 public double[] Run(FUNCTION fn, double[] rgParam)
 {
     return(m_iextension.RunExtensionD(m_hExtension, (long)fn, rgParam));
 }