Esempio n. 1
0
    public override int Eval(Stack st)
    {
        int narg = GetNarg(st);
        var x    = GetVektor(st);

        x = ( Vector )(new ExpandConstants()).SymEval(x);

        var re = (( Vector )x.RealPart()).Double;
        var im = (( Vector )x.ImagPart()).Double;

        int n = re.Length;

        var power = JMath.log(n) / JMath.log(2.0);

        if (power != JMath.round(power))
        {
            var outRe = new double[n];
            var outIm = new double[n];

            LambdaFFT.idft(re, im, outRe, outIm);

            re = outRe;
            im = outIm;
        }
        else
        {
            LambdaFFT.ifft_1d(re, im, 1);
        }

        var a = new Number[n];

        for (int i = 0; i < n; i++)
        {
            a[i] = new Number(re[i], im[i]);
        }

        st.Push(new Vector(a));

        return(0);
    }
Esempio n. 2
0
    public override int lambda(Stack st)
    {
        int narg = getNarg(st);
        var x    = getVektor(st);

        x = ( Vektor )(new ExpandConstants()).f_exakt(x);

        var re = (( Vektor )x.realpart()).Double;
        var im = (( Vektor )x.imagpart()).Double;

        int n = re.Length;

        var power = JMath.log(n) / JMath.log(2.0);

        if (power != JMath.round(power))
        {
            var outRe = new double[n];
            var outIm = new double[n];

            LambdaFFT.idft(re, im, outRe, outIm);

            re = outRe;
            im = outIm;
        }
        else
        {
            LambdaFFT.ifft_1d(re, im, 1);
        }

        var a = new Unexakt[n];

        for (int i = 0; i < n; i++)
        {
            a[i] = new Unexakt(re[i], im[i]);
        }

        st.Push(new Vektor(a));

        return(0);
    }