using System;
using System.Collections.Generic;
namespace ArrayFastCmp
{ class Program
{ static void Main ( string[] args )
{ TimeSpan t; string T;
int Counter = 1000000, K=0;
byte[] a = { 1,1,1,1,1,1,1,1,1,1 };
byte[] b = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 };
ushort[] c = new ushort[10];
t = DateTime.Now.TimeOfDay;
for ( int j=0;j<Counter;j++)
{ for ( int i=0;i<10;i++ )
{ Yeppp.Core.Subtract_V8uV8u_V16u ( b, i, a, 0, c, 0, 10 );
} }
T = ( DateTime.Now.TimeOfDay - t ).TotalSeconds.ToString ("F2");
Console.WriteLine( "1 - " + T ); // 2.16 сек.
t = DateTime.Now.TimeOfDay;
for ( int k=0;k<Counter;k++ )
{ for ( int i=0;i<10;i++)
// { for( int j=0;j<10;j++) { if (a[j] != b[j+1]) K++; } // 1.78 sec
{ for( int j=0;j<10;j++) { if (a[j] != b[j+1]) K++; } // 1.51 sec
} }
T = ( DateTime.Now.TimeOfDay - t ).TotalSeconds.ToString ("F2");
Console.WriteLine( "2 - " + T ); // ???
Console.ReadKey();
} } }
{ for( int j=0;j<10;j++) { if (a[j] != b[j+1]) K++; } // 1.51 sec
{ for( int j=0;j<10;j++) { K = a[j] - b[j+1]; } // 1.51 sec
--
You received this message because you are subscribed to the Google Groups "yeppp-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yeppp-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi to all!
Hi to all!
Hi to all!
Hi to all!
Hi to all!
Hi to all!
Hi to all!
Hi to all!
Hi to all!
Hi,Marat!
Hi!
double Min=0,Max=0;
double [] a = {1,2,3,4,5};
Yeppp.Core.Max_IV64fS64f_IV64f ( a,0,Max,5); // I'm waiting Max = 5, but I'm receiving Max = 0;
Yeppp.Core.Min_IV64fS64f_IV64f ( a,0,Min,5); // I'm waiting Min = 1, but I'm receiving Min = 0;
--
Thanks! I understand!
public class rShift { public rShift ( int shift, double r ) { Shift = shift; R = r; } public int Shift; public double R; }
public rShift CorrelatePirson ( double [] F, double [] f ) // Расчет коэффициента корреляции Пирсона
{ double A,a,Q,q,R, RMax = 0; double [] G = (double[]) F.Clone(), g; rShift RShift; int NShiftMax = 30, Count = G.Length - NShiftMax, i, I = 0;
A = Yeppp.Core.Sum_V64f_S64f ( G, 0, Count ) / Count; // Ave ( X )
Yeppp.Core.Subtract_IV64fS64f_IV64f ( G, 0, A, Count ); // G <== Arr ( Xi - Ave ( X ) )
Q = Yeppp.Core.SumSquares_V64f_S64f ( G, 0, Count ); // Sum ( ( Xi - Ave ( X ) ) **2 )
for(i = 0;i<NShiftMax;i++)
{ g = (double[])f.Clone();
a = Yeppp.Core.Sum_V64f_S64f ( g, i, Count ) / Count; // Ave ( Y )
Yeppp.Core.Subtract_IV64fS64f_IV64f ( g, i, a, Count ); // g <== Arr ( Yi - Ave ( Y ) )
q = Yeppp.Core.SumSquares_V64f_S64f ( g, i, Count ); // Sum ( ( Yi - Ave ( Y ) ) **2 )
Yeppp.Core.Multiply_IV64fV64f_IV64f ( g, i, G, 0, Count ); // Arr { [ Xi - Ave ( Xi ) ] * [ Yi - Ave ( Y ) ] }
a = Yeppp.Core.Sum_V64f_S64f ( g, i, Count ); // Sum { Arr [ Xi - Ave ( Xi ) ] * [ Yi - Ave ( Y ) ] }
if ( Q == 0 || q == 0 ) return RShift = new rShift (0,0);
R = a / Math.Sqrt ( Q * q ); if ( Math.Abs (RMax) < Math.Abs (R) ){ RMax = R; I = i; } // R <== Sum { Arr [ Xi - Ave ( Xi ) ] * [ Yi - Ave ( Y ) ] } / Sqrt { Sum ( ( Xi - Ave ( X ) ) **2 ) * Sum ( ( Yi - Ave ( Y ) ) **2 ) }
} return RShift = new rShift (I,RMax);
}
New year!
--