@@ -669,105 +669,6 @@ end
669
669
670
670
-- map logarithm of exponential poisson bracket: r = exp(:log(x):) y
671
671
672
- local function fgrad (x, t)
673
- local r = t:same()
674
- for i=1,#x do r = r + x[i]*t:deriv(i) end
675
- return r
676
- end
677
-
678
- local function liebra (x, y)
679
- local r = x:same()
680
- for i=1,#x do
681
- for j=1,#x do
682
- local t1 = y[j] * x[i]:deriv(j)
683
- local t2 = x[j] * y[i]:deriv(j)
684
- r[i] = r[i] + t2 - t1
685
- end end
686
- return r
687
- end
688
-
689
- local function mnrm (x)
690
- local nrm = 0
691
- for i=1,#x do nrm = nrm + x[i]:nrm() end
692
- return nrm
693
- end
694
-
695
- local function logpb (x, r, eps) -- c_logf + c_flofacg
696
- -- c_logf
697
- local x0 = x:copy():set0(0)
698
-
699
- local fid = 1262 -- ..1289
700
- x0:write("fort/fort_n."..fid, "x0") ; fid = fid+1 ; -- 1263
701
-
702
- -- c_flofacg
703
- local v = x:same():eye() -- identity
704
-
705
- x0:write("fort/fort_n."..fid, "x") ; fid = fid+1 ; -- 1264
706
-
707
- -- special case where eps = -no
708
- if eps and eps <= 0 then
709
- for k=1,round(eps)-1 do
710
- local y = (-r):exppb(x0)
711
- local t = y - v
712
- r = r+t
713
-
714
- t:write("fort/fort_n."..fid, "t_0 @ "..k) ; fid = fid+1 ;
715
- r:write("fort/fort_n."..fid, "r_0 @ "..k) ; fid = fid+1 ;
716
- end
717
- return r
718
- end
719
-
720
- local nrm0 = mnrm(x0)
721
- local epsone = eps or nrm0/1000
722
- local xn, xn0 = 1e4, 1e36
723
- local nrmax = 1000
724
- local conv = false
725
-
726
- for k=1,nrmax do
727
- local y = (-r):exppb(x0)
728
- local t = y - v
729
-
730
- t:write("fort/fort_n."..fid, "t_1 @ "..k) ; fid = fid+1 ; -- 1265
731
-
732
- if xn < epsone then -- CBH (* == c_bra_v_ct)
733
- local e2, e3 = x:same(), x:same()
734
- for i=1,#x do e2[i] = -0.5*fgrad(t ,t[i]) end
735
- for i=1,#x do e3[i] = -0.5*fgrad(e2,t[i])-(1/6)*fgrad(t,e2[i]) end
736
- t = t+e2+e3
737
-
738
- t:write("fort/fort_n."..fid, "t_2 @ "..k) ; fid = fid+1 ; -- 1266
739
-
740
- local z = liebra(r,t) -- <r,t>
741
- local e2 = liebra(r,z) -- <r,<r,t>>
742
- local e3 = liebra(t,z) -- <t,<r,t>>
743
- t = t + 0.5*z + (1/12)*(e2-e3)
744
-
745
- t:write("fort/fort_n."..fid, "t_3 @ "..k) ; fid = fid+1 ; -- 1267
746
-
747
- local e4 = liebra(t,e2) -- <t,<r,<r,t>>>
748
- t = t - (1/24)*e4
749
-
750
- t:write("fort/fort_n."..fid, "t_4 @ "..k) ; fid = fid+1 ; -- 1268
751
-
752
- end
753
- r = r+t
754
-
755
- r:write("fort/fort_n."..fid, "r_1 @ "..k) ; fid = fid+1 ;
756
-
757
- local nrm = mnrm(t)
758
- xn = nrm/nrm0
759
-
760
- print("xn=", xn, "epsone=", epsone, "nrm=", nrm, "nrm0=", nrm0)
761
-
762
- -- same scheme as exppb
763
- if xn < 1e-14 or conv and xn >= xn0 then break end
764
- if xn < 1e-10 then conv = true end
765
- xn0 = xn
766
- end
767
-
768
- return r
769
- end
770
-
771
672
function MR.logpb (x, y0, r)
772
673
if is_string(r) and r == 'in' then r = x end -- in place
773
674
r = r or map_alloc(x)
@@ -1259,7 +1160,6 @@ function MR.__pow (x, n, r)
1259
1160
if n == 0 then break end
1260
1161
t:compose(t,t) -- t = t^2
1261
1162
end
1262
-
1263
1163
return r
1264
1164
end
1265
1165
0 commit comments