Changeset 429

Show
Ignore:
Timestamp:
02/06/10 14:18:05 (1 month ago)
Author:
dmitrey
Message:

some changes for lsqr

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PythonPackages/OpenOpt/openopt/solvers/Standalone/lsqr.py

    r425 r429  
    20 20 def normof4(x1,x2,x3,x4): return sqrt(x1**2 + x2**2 + x3**2 + x4**2) 
    21 21  
    22   def lsqr( m, n, aprod, b, damp, atol, btol, conlim, itnlim, show, wantvar = False ): 
      22 def lsqr( m, n, aprod, b, damp, atol, btol, conlim, itnlim, show, wantvar = False, callback = lambda x: None): 
    23 23     """ 
    24 24     [ x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var ]... 
     
    290 290                  
    291 291         if istop > 0: break 
      292         callback(x) # added for OpenOpt kernel 
    292 293  
    293 294     # End of iteration loop. 
  • PythonPackages/OpenOpt/openopt/solvers/Standalone/lsqr_oo.py

    r425 r429  
    65 65 #                assert damp == 0 
    66 66 #                if damp != 0:  
    67   #                assert not condX 
    68   #                p.iterfcn(x,f) 
      67 #                    assert not condX 
      68 #                p.iterfcn(x) 
      69 #                if p.istop: raise isSolved 
    69 70                 return r 
    70 71             elif mode == 2: 
     
    78 79          
    79 80         [ x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var ] = \ 
    80           LSQR(m, n, aprod, d, damp, 1e-9, 1e-9, conlim, p.maxIter, show, wantvar = False
      81         LSQR(m, n, aprod, d, damp, 1e-9, 1e-9, conlim, p.maxIter, show, wantvar = False, callback = p.iterfcn
    81 82         # ( m, n, aprod, b, damp, atol, btol, conlim, itnlim, show, wantvar = False ) 
    82 83  
    83 84         #p.istop, p.msg, p.iter = istop, msg.rstrip(), iter 
    84 85         p.istop = 1000 
    85           p.iter = 1 # itn 
      86         p.debugmsg('lsqr iterations elapsed: %d' % itn) 
      87         #p.iter = 1 # itn 
    86 88         p.xf = x 
    87 89         #p.ff = p.fk = w[0]