コード例 #1
0
        public static void Transform(uint bits, ComplexFloat[] data, Direction direction)
        {
            FPGA.Const <uint>  n      = GeneratorTools.ArrayLength(bits);
            FPGA.Const <float> nFloat = GeneratorTools.FloatArrayLength(bits);

            uint mask = GeneratorTools.Mask(bits);

            ComplexFloat[] transformed = new ComplexFloat[data.Length];
            float[]        cosMap      = GeneratorTools.CosArray(n, direction);

            var tmp = new ComplexFloat();

            // for each destination element
            for (uint i = 0; i < n; i++)
            {
                tmp.Re = 0.0f;
                tmp.Im = 0.0f;

                // sum source elements
                for (uint j = 0; j < n; j++)
                {
                    ComplexFloat source = new ComplexFloat();
                    source = data[j];

                    FTTools.RotateAndAdd(cosMap, bits, ref source, ref tmp, i * j);
                }

                transformed[i] = tmp;
            }

            FTTools.CopyAndNormalize(bits, transformed, data, direction, ref tmp);
        }
コード例 #2
0
 public void Mask16bits()
 {
     Assert.AreEqual(65535u, GeneratorTools.Mask(16));
 }
コード例 #3
0
 public void Mask10bits()
 {
     Assert.AreEqual(1023u, GeneratorTools.Mask(10));
 }