예제 #1
0
        public float[] CalculateGreaterCircleDistance(float[] lat1, float[] long1, float[] lat2, float[] long2)
        {
            FPA fpLat1 = new FPA(lat1);
            FPA fpLong1 = new FPA(long1);
            FPA fpLat2 = new FPA(lat2);
            FPA fpLong2 = new FPA(long2);
            FPA fpResult = new FPA(0, fpLat1.Shape);

            fpResult += PA.Sqrt(PA.Add(
                PA.Pow2(PA.Sin(PA.Divide(PA.Divide(PA.Multiply(PI, PA.Subtract(fpLat2, fpLat1)), 180.0f), 2.0f))),
                PA.Multiply(
                    PA.Multiply(
                        PA.Cos(PA.Divide(PA.Multiply(PI, fpLat1), 180.0f)),
                        PA.Cos(PA.Divide(PA.Multiply(PI, fpLat2), 180.0f))
                        ),
                    PA.Pow2(PA.Sin(PA.Divide(PA.Divide(PA.Multiply(PI, PA.Subtract(fpLong2, fpLong1)), 180.0f), 2.0f)))
                    )
                ));

            float[] distance = new float[lat1.Length];
            eval.ToArray(fpResult, out distance);
            return distance;
        }
예제 #2
0
파일: CWT.cs 프로젝트: sliwku/falkowy
        private void ObliczCWTprzezGPU(Int16[] sygnal)
        {
            float[] sygnalFloat = new float[sygnal.Length];
            for(int i=0;i<sygnal.Length;i++)
                sygnalFloat[i] = sygnal[i];

            wynikCWT = new int[falka.FalkaDlaAF.Length, (sygnal.Length / dokladnoscB) + 1];

            DX9Target evalTarget = new DX9Target();

            FloatParallelArrayParam fpaSygnal = new FloatParallelArrayParam();
            FloatParallelArrayParam fpaFalka = new FloatParallelArrayParam();
            FPA fpCalySygnal = new FPA(sygnalFloat);

            FPA wynik;
            wynik = PA.Abs(PA.Sum(PA.Multiply(fpaSygnal, fpaFalka)));

            for (int iA = 0; iA < falka.FalkaDlaAF.Length; iA++)
            {
                fpaFalka.Bind(new FPA(falka.FalkaDlaAF[iA]));
                for (int b = 0, iB = 0; b < sygnal.Length; b += dokladnoscB, iB++)
                {
                    fpaSygnal.Bind(PA.Section(fpCalySygnal, new SectionSpecifier(b, fpaFalka.GetLength(0))));
                    wynikCWT[iA, iB] = (int)evalTarget.ToArray1D(wynik)[0];
                }
            }
        }