当前位置: 首页>>代码示例>>C#>>正文


C# Vector.Reverse方法代码示例

本文整理汇总了C#中System.Numerics.Vector.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# Vector.Reverse方法的具体用法?C# Vector.Reverse怎么用?C# Vector.Reverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Numerics.Vector的用法示例。


在下文中一共展示了Vector.Reverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConvertToString

        public static string ConvertToString(BigInteger n, bool escape, int radix)
        {
            if (radix == -1)
            {
                radix = (int)Runtime.GetDynamic(Symbols.PrintBase);
            }

            if (radix == -1)
            {
                radix = 10;
            }
            else if (radix < 2 || radix > 36)
            {
                throw new LispException("Invalid number base: {0}", radix);
            }

            if (n == 0)
            {
                return "0";
            }

            var sign = (n >= 0) ? "" : "-";
            n = (n >= 0) ? n : -n;
            var stk = new Vector();
            while (n != 0)
            {
                var d = (int)(n % radix);
                if (d <= 9)
                {
                    stk.Add((char)(d + '0'));
                }
                else {
                    stk.Add((char)(d - 10 + 'a'));
                }
                n = n / radix;
            }
            stk.Reverse();
            if (escape)
            {
                switch (radix)
                {
                    case 10:
                        return sign + Runtime.MakeString(stk.ToArray());
                    case 16:
                        return sign + "0x" + Runtime.MakeString(stk.ToArray());
                    case 8:
                        return sign + "0" + Runtime.MakeString(stk.ToArray());
                    case 2:
                        return "#b" + sign + Runtime.MakeString(stk.ToArray());
                    default:
                        return "#" + radix + "r" + sign + Runtime.MakeString(stk.ToArray());
                }
            }
            else {
                return sign + Runtime.MakeString(stk.ToArray());
            }
        }
开发者ID:jantolenaar,项目名称:kiezellisp,代码行数:57,代码来源:number.cs

示例2: GenerateFilterMatrix

        public bool GenerateFilterMatrix(bool UseMeasuredSignal = false)
        {
            if (matchedFilterEnabled)
            {
                Debug.WriteLine("Generating beaconsignal.");

                FileInfo beaconfile = new FileInfo(@"resources/beaconfile.bin");
                if (beaconfile.Exists && UseMeasuredSignal)
                {
                    long samples = beaconfile.Length / 4; //singles
                    beaconsignal = DenseVector.Create(Convert.ToInt32(samples), 0);
                    using (BinaryReader br = new BinaryReader(beaconfile.OpenRead()))
                    {
                        int i = 0;
                        while (i < samples)
                        {
                            beaconsignal[i] = br.ReadSingle();
                            i++;
                        }
                    }
                    Debug.WriteLine("Used measurement data for beaconsignal.");
                }
                else
                {
                    //Own Code: e65a 20e5 b37a c60d
                    beaconsignal = Tools.refsignal(Tools.Timer0Freq.Carrier10kHz, Tools.Timer1Freq.Code2500Hz, Tools.Timer3Freq.Repeat10Hz, "e65a20e5", ASIO.Fs);

                    Debug.WriteLine("Used reference data for beaconsignal.");
                }
                int endpoint = beaconsignal.Count-1;
                while (beaconsignal[endpoint] == 0 && endpoint > 0)
                {
                    endpoint--;
                }
                int startpoint = 0;
                while (beaconsignal[startpoint] == 0 && startpoint < endpoint)
                {
                    startpoint++;
                }
                beaconsignal = beaconsignal.SubVector(startpoint, endpoint - startpoint); //Trimmed
                int samplenumber = 0;
                Vector<double> bsreverse = new DenseVector(beaconsignal.Count); // WAS: Convert.ToInt32(Math.Round(ASIO.Fs * sampleLength))
                //samplenumber = 0;
                foreach (double d in beaconsignal.Reverse())
                {
                    bsreverse[samplenumber] = d;
                    samplenumber++;
                    if (samplenumber == bsreverse.Count)
                        break;
                }
                if (!matchedFilterToep)
                {
                    // Get the matchedfilter convolution vector
                    matchedfilterVector = bsreverse;
                }
                else
                {
                    //Circulant Convolution
                    Debug.WriteLine("Generating Toeplitz matrix.");

                    //Figure out corrent matchedfilter matrix

                    //Normal Convolution
                    //Matrix<double> X = Tools.Toep(bsreverse, bsreverse.Count*2-1, bsreverse.Count, false);
                    //Circulant Convolution
                    Matrix<double> X = Tools.Toep(bsreverse, bsreverse.Count, bsreverse.Count);
                    bsreverse = null;
                    Debug.WriteLine("Generating matched filter matrix.");
                    //X is a circulant matrix.
                    matchedfilter = X;
                }
            }
            else
            {
                Debug.WriteLine("Matched filter is disabled.");
            }
            return true;
        }
开发者ID:EraYaN,项目名称:EV2020,代码行数:78,代码来源:Localizer.cs


注:本文中的System.Numerics.Vector.Reverse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。