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


C# Vector.Count方法代码示例

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


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

示例1: VectorAdd

 public void VectorAdd()
 {
     Vector<Point> points = new Vector<Point>();
     points.Add(new Point(2f, 3f));
     Assert.AreEqual(1, points.Count());
     points.Add(new Point(2.4f, 3f));
     points.Add(new Point(2.5f, 3f));
     Assert.AreEqual(3, points.Count());
 }
开发者ID:danpamfil,项目名称:JuniorMind,代码行数:9,代码来源:VectorTests.cs

示例2: VectorRemove

        public void VectorRemove()
        {
            Point pointToRemove = new Point(2.4f, 3f);

            Vector<Point> points = new Vector<Point>();
            points.Add(new Point(2f, 3f));
            points.Add(pointToRemove);
            points.Add(new Point(2.5f, 3f));
            Assert.AreEqual(3, points.Count());
            points.Remove(pointToRemove);
            Assert.AreEqual(2, points.Count());
        }
开发者ID:danpamfil,项目名称:JuniorMind,代码行数:12,代码来源:VectorTests.cs

示例3: Ordering

 //function for samples ordering
 public Vector<double> Ordering(Vector<double> signal_rr)
 {
     // samplesOrder obtaining
     Vector<double> samplesOrder = Vector<double>.Build.Dense(signal_rr.Count(), 0);
     for (int i = 0; i < samplesOrder.Count; i++)
     {
         samplesOrder[i] = i;
     }
     return samplesOrder;
 }
开发者ID:Nefarin,项目名称:DadmProject,代码行数:11,代码来源:HRV_DFA_Alg.cs

示例4: AddNewObject

 public void AddNewObject()
 {
     int[] localData = new int[] { 3, 7, 5, 8 };
     Vector<int> vector = new Vector<int>(localData);
     int obj = 2;
     int[] expectedValue = new int[] { 3, 7, 5, 8, 2, 0, 0, 0 };
     vector.Add(obj);
     CollectionAssert.AreEqual(expectedValue, vector.GetData());
     Assert.AreEqual(5, vector.Count());
 }
开发者ID:paulcicio,项目名称:Training,代码行数:10,代码来源:VectorTests.cs

示例5: Integrate

        //function that integrates signal
        public Vector<double> Integrate(Vector<double> signal_rr)
        {
            Vector<double> signal_integrated = Vector<double>.Build.Dense(signal_rr.Count(),0);

            //Average
            double rr_avg = signal_rr.Sum()/signal_rr.Count;

            for (int i = 0; i < signal_rr.Count - 1; i++)
            {
                signal_integrated[0] = 0;
                signal_integrated[i+1] = signal_rr[i] - rr_avg;
                signal_integrated[i + 1] += signal_integrated[i];
                signal_integrated[i+1] = Math.Abs(signal_integrated[i+1]);
            }

            return signal_integrated;
        }
开发者ID:Nefarin,项目名称:DadmProject,代码行数:18,代码来源:HRV_DFA_Alg.cs

示例6: ListHaarDWT

 public List<Vector<double>> ListHaarDWT(Vector<double> signal, int n)
 {
     //Work just like wavedec but use only haar wavelet
     // http://www.mathworks.com/help/wavelet/ref/wavedec.html
     // [0]  -> d1, [1]  -> d2, ...
     int decompSize = signal.Count();
     double sqrt2 = Math.Sqrt(2);
     Vector<double> outVec = Vector<double>.Build.Dense(decompSize);
     Vector<double> signalTemp = signal;
     List<Vector<double>> listOut = new List<Vector<double>>();
     for (int i = 0; i < n; i++)
     {
         decompSize /= 2;
         for (int dataInd = 0; dataInd < decompSize; dataInd++)
         {
             outVec[dataInd] = (signalTemp[2 * dataInd] + signalTemp[2 * dataInd + 1]) / sqrt2;
             outVec[decompSize + dataInd] = (signalTemp[2 * dataInd] - signalTemp[2 * dataInd + 1]) / sqrt2;
         }
         signalTemp = outVec.SubVector(0, decompSize);
         listOut.Add(outVec.SubVector(decompSize, decompSize));
     }
     return listOut;
 }
开发者ID:Nefarin,项目名称:DadmProject,代码行数:23,代码来源:Waves_Alg.cs

示例7: ListDWT

        public List<Vector<double>> ListDWT(Vector<double> signal, int n, Wavelet_Type waveType)
        {
            double[] Hfilter =  { 0 };
            double[] Lfilter = { 0 };
            int filterSize = 0;
                //generated from wfilters Matlab function
                switch (waveType)
                {
                case Wavelet_Type.haar:
                    return ListHaarDWT(signal, n);

                case Wavelet_Type.db2:
                    Hfilter = new double []{ -0.482962913144690 ,    0.836516303737469, -0.224143868041857 ,-0.129409522550921};
                    Lfilter = new double[] { -0.129409522550921, 0.224143868041857, 0.836516303737469, 0.482962913144690 };
                    filterSize = 4;
                    break;

                case Wavelet_Type.db3:
                    Hfilter = new double[] { -0.332670552950957,  0.806891509313339, - 0.459877502119331, - 0.135011020010391,  0.0854412738822415,  0.0352262918821007 };
                    Lfilter = new double[] { 0.0352262918821007, - 0.0854412738822415, - 0.135011020010391,  0.459877502119331,   0.806891509313339,   0.332670552950957 };
                    filterSize = 6;
                    break;
                }
                int decompSize = signal.Count();
                Vector<double> outVec = Vector<double>.Build.Dense(decompSize);
                Vector<double> signalTemp = signal;
                List<Vector<double>> listOut = new List<Vector<double>>();
                for (int i = 0; i < n; i++)
                {
                    decompSize /= 2;
                    for (int dataInd = 0; dataInd < decompSize; dataInd++)
                    {
                        outVec[dataInd] = 0;
                        outVec[decompSize + dataInd] = 0;
                        for( int filtIt = 0; filtIt < filterSize && (2*dataInd + filtIt) < signalTemp.Count ; filtIt++)
                        {
                            outVec[dataInd] += signalTemp[2 * dataInd + filtIt]*Lfilter[filterSize - filtIt - 1] ;
                            outVec[decompSize + dataInd] += signalTemp[2 * dataInd + filtIt]* Hfilter[filterSize - filtIt - 1];
                        }

                    }
                    signalTemp = outVec.SubVector(0, decompSize);
                    listOut.Add(outVec.SubVector(decompSize, decompSize));
                }
                return listOut;
        }
开发者ID:Nefarin,项目名称:DadmProject,代码行数:46,代码来源:Waves_Alg.cs

示例8: HaarDWT

        public Vector<double> HaarDWT(Vector<double> signal, int n)
        {
            //Work just like wavedec but use only haar wavelet
            // http://www.mathworks.com/help/wavelet/ref/wavedec.html
            //lol
            int decompSize = signal.Count();
            double sqrt2 = Math.Sqrt(2);
            Vector<double> outVec = Vector<double>.Build.Dense(decompSize);
            Vector<double> signalTemp = signal;

            for (int i = 0; i < n; i++)
            {
                decompSize /= 2;
                for (int dataInd = 0; dataInd < decompSize; dataInd++)
                {
                    outVec[dataInd] = (signalTemp[2 * dataInd] + signalTemp[2 * dataInd + 1]) / sqrt2;
                    outVec[decompSize + dataInd] = (signalTemp[2 * dataInd] - signalTemp[2 * dataInd + 1]) / sqrt2;
                }
                signalTemp = outVec.SubVector(0, decompSize);
            }
            return outVec;
        }
开发者ID:Nefarin,项目名称:DadmProject,代码行数:22,代码来源:Waves_Alg.cs

示例9: VectorCount

 public void VectorCount()
 {
     Vector<Point> points = new Vector<Point>();
     Assert.AreEqual(0, points.Count());
 }
开发者ID:danpamfil,项目名称:JuniorMind,代码行数:5,代码来源:VectorTests.cs

示例10: CountObjects

 public void CountObjects()
 {
     int[] localData = new int[4] { 3, 7, 5, 8 };
     Vector<int> vector = new Vector<int>(localData);
     Assert.AreEqual(4, vector.Count());
 }
开发者ID:paulcicio,项目名称:Training,代码行数:6,代码来源:VectorTests.cs

示例11: LLTSolve

    // this is from https://ece.uwaterloo.ca/~ece204/howtos/forward/ hehehh
    private Vector LLTSolve(Matrix L, Vector b)
    {
        int i = 0;
        int n = b.Count();
        // forward sub to solve Lz = b
        Vector z = Vector.Zeros(n);

        for (i = 0; i < n; i++)
        {
            z[i] = (b[i] - (L.GetRowVector(i) * z)) / L[i, i];
        }

        // back sub to solve L'x = z
        Vector x = Vector.Zeros(n);
        var Lt = Matrix.Transpose(L);

        for (i = n-1; i >= 0; i--)
        {
            x[i] = (z[i] - (Lt.GetRowVector(i) * x)) / Lt[i, i];
        }

        return x;
    }
开发者ID:smokelore,项目名称:UnityPointCloud,代码行数:24,代码来源:PointCloud.cs


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