Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/17/09 17:05:22 (15 years ago)
Author:
gkronber
Message:

Updated ALGLIB to latest version. #751 (Plugin for for data-modeling with ANN (integrated into CEDMA))

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/ALGLIB/rotations.cs

    r2430 r2563  
    9393                        ctemp = c[j-m1+1];
    9494                        stemp = s[j-m1+1];
    95                         if( ctemp!=1 | stemp!=0 )
     95                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    9696                        {
    9797                            jp1 = j+1;
     
    129129                        ctemp = c[j-m1+1];
    130130                        stemp = s[j-m1+1];
    131                         if( ctemp!=1 | stemp!=0 )
     131                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    132132                        {
    133133                            temp = a[j+1,n1];
     
    150150                        ctemp = c[j-m1+1];
    151151                        stemp = s[j-m1+1];
    152                         if( ctemp!=1 | stemp!=0 )
     152                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    153153                        {
    154154                            jp1 = j+1;
     
    186186                        ctemp = c[j-m1+1];
    187187                        stemp = s[j-m1+1];
    188                         if( ctemp!=1 | stemp!=0 )
     188                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    189189                        {
    190190                            temp = a[j+1,n1];
     
    256256                        ctemp = c[j-n1+1];
    257257                        stemp = s[j-n1+1];
    258                         if( ctemp!=1 | stemp!=0 )
     258                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    259259                        {
    260260                            jp1 = j+1;
     
    292292                        ctemp = c[j-n1+1];
    293293                        stemp = s[j-n1+1];
    294                         if( ctemp!=1 | stemp!=0 )
     294                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    295295                        {
    296296                            temp = a[m1,j+1];
     
    313313                        ctemp = c[j-n1+1];
    314314                        stemp = s[j-n1+1];
    315                         if( ctemp!=1 | stemp!=0 )
     315                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    316316                        {
    317317                            jp1 = j+1;
     
    349349                        ctemp = c[j-n1+1];
    350350                        stemp = s[j-n1+1];
    351                         if( ctemp!=1 | stemp!=0 )
     351                        if( (double)(ctemp)!=(double)(1) | (double)(stemp)!=(double)(0) )
    352352                        {
    353353                            temp = a[m1,j+1];
     
    378378            double g1 = 0;
    379379
    380             if( g==0 )
     380            if( (double)(g)==(double)(0) )
    381381            {
    382382                cs = 1;
     
    386386            else
    387387            {
    388                 if( f==0 )
     388                if( (double)(f)==(double)(0) )
    389389                {
    390390                    cs = 0;
     
    399399                    cs = f1/r;
    400400                    sn = g1/r;
    401                     if( Math.Abs(f)>Math.Abs(g) & cs<0 )
     401                    if( (double)(Math.Abs(f))>(double)(Math.Abs(g)) & (double)(cs)<(double)(0) )
    402402                    {
    403403                        cs = -cs;
     
    408408            }
    409409        }
    410 
    411 
    412         private static void testrotations()
    413         {
    414             double[,] al1 = new double[0,0];
    415             double[,] al2 = new double[0,0];
    416             double[,] ar1 = new double[0,0];
    417             double[,] ar2 = new double[0,0];
    418             double[] cl = new double[0];
    419             double[] sl = new double[0];
    420             double[] cr = new double[0];
    421             double[] sr = new double[0];
    422             double[] w = new double[0];
    423             int m = 0;
    424             int n = 0;
    425             int maxmn = 0;
    426             double t = 0;
    427             int pass = 0;
    428             int passcount = 0;
    429             int i = 0;
    430             int j = 0;
    431             double err = 0;
    432             double maxerr = 0;
    433             bool isforward = new bool();
    434 
    435             passcount = 1000;
    436             maxerr = 0;
    437             for(pass=1; pass<=passcount; pass++)
    438             {
    439                
    440                 //
    441                 // settings
    442                 //
    443                 m = 2+AP.Math.RandomInteger(50);
    444                 n = 2+AP.Math.RandomInteger(50);
    445                 isforward = AP.Math.RandomReal()>0.5;
    446                 maxmn = Math.Max(m, n);
    447                 al1 = new double[m+1, n+1];
    448                 al2 = new double[m+1, n+1];
    449                 ar1 = new double[m+1, n+1];
    450                 ar2 = new double[m+1, n+1];
    451                 cl = new double[m-1+1];
    452                 sl = new double[m-1+1];
    453                 cr = new double[n-1+1];
    454                 sr = new double[n-1+1];
    455                 w = new double[maxmn+1];
    456                
    457                 //
    458                 // matrices and rotaions
    459                 //
    460                 for(i=1; i<=m; i++)
    461                 {
    462                     for(j=1; j<=n; j++)
    463                     {
    464                         al1[i,j] = 2*AP.Math.RandomReal()-1;
    465                         al2[i,j] = al1[i,j];
    466                         ar1[i,j] = al1[i,j];
    467                         ar2[i,j] = al1[i,j];
    468                     }
    469                 }
    470                 for(i=1; i<=m-1; i++)
    471                 {
    472                     t = 2*Math.PI*AP.Math.RandomReal();
    473                     cl[i] = Math.Cos(t);
    474                     sl[i] = Math.Sin(t);
    475                 }
    476                 for(j=1; j<=n-1; j++)
    477                 {
    478                     t = 2*Math.PI*AP.Math.RandomReal();
    479                     cr[j] = Math.Cos(t);
    480                     sr[j] = Math.Sin(t);
    481                 }
    482                
    483                 //
    484                 // Test left
    485                 //
    486                 applyrotationsfromtheleft(isforward, 1, m, 1, n, ref cl, ref sl, ref al1, ref w);
    487                 for(j=1; j<=n; j++)
    488                 {
    489                     applyrotationsfromtheleft(isforward, 1, m, j, j, ref cl, ref sl, ref al2, ref w);
    490                 }
    491                 err = 0;
    492                 for(i=1; i<=m; i++)
    493                 {
    494                     for(j=1; j<=n; j++)
    495                     {
    496                         err = Math.Max(err, Math.Abs(al1[i,j]-al2[i,j]));
    497                     }
    498                 }
    499                 maxerr = Math.Max(err, maxerr);
    500                
    501                 //
    502                 // Test right
    503                 //
    504                 applyrotationsfromtheright(isforward, 1, m, 1, n, ref cr, ref sr, ref ar1, ref w);
    505                 for(i=1; i<=m; i++)
    506                 {
    507                     applyrotationsfromtheright(isforward, i, i, 1, n, ref cr, ref sr, ref ar2, ref w);
    508                 }
    509                 err = 0;
    510                 for(i=1; i<=m; i++)
    511                 {
    512                     for(j=1; j<=n; j++)
    513                     {
    514                         err = Math.Max(err, Math.Abs(ar1[i,j]-ar2[i,j]));
    515                     }
    516                 }
    517                 maxerr = Math.Max(err, maxerr);
    518             }
    519             System.Console.Write("TESTING ROTATIONS");
    520             System.Console.WriteLine();
    521             System.Console.Write("Pass count ");
    522             System.Console.Write("{0,0:d}",passcount);
    523             System.Console.WriteLine();
    524             System.Console.Write("Error is ");
    525             System.Console.Write("{0,5:E3}",maxerr);
    526             System.Console.WriteLine();
    527         }
    528410    }
    529411}
Note: See TracChangeset for help on using the changeset viewer.