Changeset 2838 for trunk/GSASIImath.py


Ignore:
Timestamp:
May 24, 2017 2:32:22 PM (5 years ago)
Author:
vondreele
Message:

add a bit of printing to LS & show no. of penalty fxns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r2775 r2838  
    120120        Yvec /= Adiag
    121121        Amat /= Anorm
     122        if Print:
     123            print 'initial chi^2 %.5g'%(chisq0)
    122124        while True:
    123125            Lam = np.eye(Amat.shape[0])*lam
     
    136138                lam *= 10.
    137139                if Print:
    138                     print 'matrix modification needed; lambda now %.1e'%(lam)
     140                    print 'new chi^2 %.5g; matrix modification needed; lambda now %.1e'%(chisq1,lam)
    139141            else:
    140142                x0 += Xvec
     
    160162    Anorm = np.outer(Adiag,Adiag)
    161163    Lam = np.eye(Amat.shape[0])*lam
    162     Amatlam = Amat/Anorm  #*(One+Lam)              #don't scale Amat to Marquardt array       
     164    Amatlam = Amat/Anorm       
     165#    Amatlam = Amat*(One+Lam)                #scale Amat to Marquardt array?       
    163166    try:
    164         Bmat = nl.inv(Amatlam)/Anorm  #*(One+Lam)      #don't rescale Bmat to Marquardt array
     167        Bmat = nl.inv(Amatlam)/Anorm
     168#        Bmat = Bmat*(One+Lam)               #rescale Bmat to Marquardt array?
    165169        return [x0,Bmat,{'num cyc':icycle,'fvec':M,'nfev':nfev,'lamMax':lamMax,'psing':[], 'Converged': ifConverged, 'DelChi2':deltaChi2}]
    166170    except nl.LinAlgError:
Note: See TracChangeset for help on using the changeset viewer.