Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/17/09 17:05:22 (14 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/bdsvd.cs

    r2430 r2563  
    154154
    155155
    156         /*************************************************************************
    157         Obsolete 1-based subroutine. See RMatrixBDSVD for 0-based replacement.
    158 
    159         History:
    160             * 31 March, 2007.
    161                 changed MAXITR from 6 to 12.
    162 
    163           -- LAPACK routine (version 3.0) --
    164              Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
    165              Courant Institute, Argonne National Lab, and Rice University
    166              October 31, 1999.
    167         *************************************************************************/
    168156        public static bool bidiagonalsvddecomposition(ref double[] d,
    169157            double[] e,
     
    277265            if( n==1 )
    278266            {
    279                 if( d[1]<0 )
     267                if( (double)(d[1])<(double)(0) )
    280268                {
    281269                    d[1] = -d[1];
     
    384372            }
    385373            sminl = 0;
    386             if( tol>=0 )
     374            if( (double)(tol)>=(double)(0) )
    387375            {
    388376               
     
    391379                //
    392380                sminoa = Math.Abs(d[1]);
    393                 if( sminoa!=0 )
     381                if( (double)(sminoa)!=(double)(0) )
    394382                {
    395383                    mu = sminoa;
     
    398386                        mu = Math.Abs(d[i])*(mu/(mu+Math.Abs(e[i-1])));
    399387                        sminoa = Math.Min(sminoa, mu);
    400                         if( sminoa==0 )
     388                        if( (double)(sminoa)==(double)(0) )
    401389                        {
    402390                            break;
     
    453441                // Find diagonal block of matrix to work on
    454442                //
    455                 if( tol<0 & Math.Abs(d[m])<=thresh )
     443                if( (double)(tol)<(double)(0) & (double)(Math.Abs(d[m]))<=(double)(thresh) )
    456444                {
    457445                    d[m] = 0;
     
    465453                    abss = Math.Abs(d[ll]);
    466454                    abse = Math.Abs(e[ll]);
    467                     if( tol<0 & abss<=thresh )
     455                    if( (double)(tol)<(double)(0) & (double)(abss)<=(double)(thresh) )
    468456                    {
    469457                        d[ll] = 0;
    470458                    }
    471                     if( abse<=thresh )
     459                    if( (double)(abse)<=(double)(thresh) )
    472460                    {
    473461                        matrixsplitflag = true;
     
    606594                //
    607595                bchangedir = false;
    608                 if( idir==1 & Math.Abs(d[ll])<1.0E-3*Math.Abs(d[m]) )
     596                if( idir==1 & (double)(Math.Abs(d[ll]))<(double)(1.0E-3*Math.Abs(d[m])) )
    609597                {
    610598                    bchangedir = true;
    611599                }
    612                 if( idir==2 & Math.Abs(d[m])<1.0E-3*Math.Abs(d[ll]) )
     600                if( idir==2 & (double)(Math.Abs(d[m]))<(double)(1.0E-3*Math.Abs(d[ll])) )
    613601                {
    614602                    bchangedir = true;
     
    616604                if( ll!=oldll | m!=oldm | bchangedir )
    617605                {
    618                     if( Math.Abs(d[ll])>=Math.Abs(d[m]) )
     606                    if( (double)(Math.Abs(d[ll]))>=(double)(Math.Abs(d[m])) )
    619607                    {
    620608                       
     
    644632                    // First apply standard test to bottom of matrix
    645633                    //
    646                     if( Math.Abs(e[m-1])<=Math.Abs(tol)*Math.Abs(d[m]) | tol<0 & Math.Abs(e[m-1])<=thresh )
     634                    if( (double)(Math.Abs(e[m-1]))<=(double)(Math.Abs(tol)*Math.Abs(d[m])) | (double)(tol)<(double)(0) & (double)(Math.Abs(e[m-1]))<=(double)(thresh) )
    647635                    {
    648636                        e[m-1] = 0;
    649637                        continue;
    650638                    }
    651                     if( tol>=0 )
     639                    if( (double)(tol)>=(double)(0) )
    652640                    {
    653641                       
     
    661649                        for(lll=ll; lll<=m-1; lll++)
    662650                        {
    663                             if( Math.Abs(e[lll])<=tol*mu )
     651                            if( (double)(Math.Abs(e[lll]))<=(double)(tol*mu) )
    664652                            {
    665653                                e[lll] = 0;
     
    684672                    // First apply standard test to top of matrix
    685673                    //
    686                     if( Math.Abs(e[ll])<=Math.Abs(tol)*Math.Abs(d[ll]) | tol<0 & Math.Abs(e[ll])<=thresh )
     674                    if( (double)(Math.Abs(e[ll]))<=(double)(Math.Abs(tol)*Math.Abs(d[ll])) | (double)(tol)<(double)(0) & (double)(Math.Abs(e[ll]))<=(double)(thresh) )
    687675                    {
    688676                        e[ll] = 0;
    689677                        continue;
    690678                    }
    691                     if( tol>=0 )
     679                    if( (double)(tol)>=(double)(0) )
    692680                    {
    693681                       
     
    701689                        for(lll=m-1; lll>=ll; lll--)
    702690                        {
    703                             if( Math.Abs(e[lll])<=tol*mu )
     691                            if( (double)(Math.Abs(e[lll]))<=(double)(tol*mu) )
    704692                            {
    705693                                e[lll] = 0;
     
    724712                // accuracy, and if so set the shift to zero.
    725713                //
    726                 if( tol>=0 & n*tol*(sminl/smax)<=Math.Max(eps, 0.01*tol) )
     714                if( (double)(tol)>=(double)(0) & (double)(n*tol*(sminl/smax))<=(double)(Math.Max(eps, 0.01*tol)) )
    727715                {
    728716                   
     
    752740                    // Test if shift negligible, and if so set to zero
    753741                    //
    754                     if( sll>0 )
    755                     {
    756                         if( AP.Math.Sqr(shift/sll)<eps )
     742                    if( (double)(sll)>(double)(0) )
     743                    {
     744                        if( (double)(AP.Math.Sqr(shift/sll))<(double)(eps) )
    757745                        {
    758746                            shift = 0;
     
    769757                // If SHIFT = 0, do simplified QR iteration
    770758                //
    771                 if( shift==0 )
     759                if( (double)(shift)==(double)(0) )
    772760                {
    773761                    if( idir==1 )
     
    817805                        // Test convergence
    818806                        //
    819                         if( Math.Abs(e[m-1])<=thresh )
     807                        if( (double)(Math.Abs(e[m-1]))<=(double)(thresh) )
    820808                        {
    821809                            e[m-1] = 0;
     
    868856                        // Test convergence
    869857                        //
    870                         if( Math.Abs(e[ll])<=thresh )
     858                        if( (double)(Math.Abs(e[ll]))<=(double)(thresh) )
    871859                        {
    872860                            e[ll] = 0;
     
    935923                        // Test convergence
    936924                        //
    937                         if( Math.Abs(e[m-1])<=thresh )
     925                        if( (double)(Math.Abs(e[m-1]))<=(double)(thresh) )
    938926                        {
    939927                            e[m-1] = 0;
     
    979967                        // Test convergence
    980968                        //
    981                         if( Math.Abs(e[ll])<=thresh )
     969                        if( (double)(Math.Abs(e[ll]))<=(double)(thresh) )
    982970                        {
    983971                            e[ll] = 0;
     
    10131001            for(i=1; i<=n; i++)
    10141002            {
    1015                 if( d[i]<0 )
     1003                if( (double)(d[i])<(double)(0) )
    10161004                {
    10171005                    d[i] = -d[i];
     
    10441032                for(j=2; j<=n+1-i; j++)
    10451033                {
    1046                     if( d[j]<=smin )
     1034                    if( (double)(d[j])<=(double)(smin) )
    10471035                    {
    10481036                        isub = j;
     
    11171105            double result = 0;
    11181106
    1119             if( b>=0 )
     1107            if( (double)(b)>=(double)(0) )
    11201108            {
    11211109                result = Math.Abs(a);
     
    11501138            fhmn = Math.Min(fa, ha);
    11511139            fhmx = Math.Max(fa, ha);
    1152             if( fhmn==0 )
     1140            if( (double)(fhmn)==(double)(0) )
    11531141            {
    11541142                ssmin = 0;
    1155                 if( fhmx==0 )
     1143                if( (double)(fhmx)==(double)(0) )
    11561144                {
    11571145                    ssmax = ga;
     
    11641152            else
    11651153            {
    1166                 if( ga<fhmx )
     1154                if( (double)(ga)<(double)(fhmx) )
    11671155                {
    11681156                    aas = 1+fhmn/fhmx;
     
    11761164                {
    11771165                    au = fhmx/ga;
    1178                     if( au==0 )
     1166                    if( (double)(au)==(double)(0) )
    11791167                    {
    11801168                       
     
    12491237            //
    12501238            pmax = 1;
    1251             swp = ha>fa;
     1239            swp = (double)(ha)>(double)(fa);
    12521240            if( swp )
    12531241            {
     
    12661254            gt = g;
    12671255            ga = Math.Abs(gt);
    1268             if( ga==0 )
     1256            if( (double)(ga)==(double)(0) )
    12691257            {
    12701258               
     
    12821270            {
    12831271                gasmal = true;
    1284                 if( ga>fa )
     1272                if( (double)(ga)>(double)(fa) )
    12851273                {
    12861274                    pmax = 2;
    1287                     if( fa/ga<AP.Math.MachineEpsilon )
     1275                    if( (double)(fa/ga)<(double)(AP.Math.MachineEpsilon) )
    12881276                    {
    12891277                       
     
    12931281                        gasmal = false;
    12941282                        ssmax = ga;
    1295                         if( ha>1 )
     1283                        if( (double)(ha)>(double)(1) )
    12961284                        {
    12971285                            v = ga/ha;
     
    13161304                    //
    13171305                    d = fa-ha;
    1318                     if( d==fa )
     1306                    if( (double)(d)==(double)(fa) )
    13191307                    {
    13201308                        l = 1;
     
    13291317                    tt = t*t;
    13301318                    s = Math.Sqrt(tt+mm);
    1331                     if( l==0 )
     1319                    if( (double)(l)==(double)(0) )
    13321320                    {
    13331321                        r = Math.Abs(m);
     
    13401328                    ssmin = ha/a;
    13411329                    ssmax = fa*a;
    1342                     if( mm==0 )
     1330                    if( (double)(mm)==(double)(0) )
    13431331                    {
    13441332                       
     
    13461334                        // Note that M is very tiny
    13471335                        //
    1348                         if( l==0 )
     1336                        if( (double)(l)==(double)(0) )
    13491337                        {
    13501338                            t = extsignbdsqr(2, ft)*extsignbdsqr(1, gt);
Note: See TracChangeset for help on using the changeset viewer.