3.改進LLL方法-modified LLL或MLLL
原本的LLL需要線性獨立的向量,若Lattice中有線性相依的向量,那在計算Gram Schmidt正交化時會發生錯誤,Pohst在1987年發表了modified
LLL演算法,就算有線性相依的向量也能處理。
maxima程式碼我參考Computation with finitely presented groups的第374頁的虛擬碼,只是我寫的maxima程式碼一直有錯誤,而我找不出錯誤在哪裡,所以我將我目前所寫的程式碼公布出來,看有沒有網友能幫我除錯。
115.6.19補充,利用claude修正程式碼
虛擬碼的Goto 99雖然maxima也有對應的go指令
但實際使用時go無法從while do跳出來(出現do loop: 'go' not within 'block': 99錯誤訊息)
MLLL():=block(
x:1,
99,
while x<5 do
(x:x+1,
if x=3 then
(go(99))
else
(print("x=",x))
)
)$
MLLL();
\(x=2\)
do loop: 'go' not within 'block': 99
#0: MLLL()
-- an error. To debug this try: debugmode(true);
當時我使用startagain變數取代Goto 99,但程式沒寫好導致無法得到正確結果,改用claude修正程式碼如下。
Example 7.2. If \(n=1\) in MLLL, then MLLL performs the version of the Euclidean algorithm in which remainders under division are chosen to have minimum absolute value. For example, suppose that \(c_1=36,c_2=84,\) and \(c_3=100\). Table 8.7.1 summarizes the changes in the values of \(b_1,b_2,\) and \(b_3\) during the execution of MLLL\((c_1,c_2,c_3;b_1,b_2,b_3)\). The fourth column indicates the "places" in the procedure at which the changes occur.
Table 8.7.1
| \(b_1\) | \(b_2\) | \(b_3\) | Place |
\(\matrix{36\cr36\cr12\cr12\cr12\cr12\cr4\cr4}\)
|
\(\matrix{84\cr12\cr36\cr0\cr100\cr4\cr12\cr0}\)
|
\(\matrix{100\cr100\cr100\cr100\cr0\cr0\cr0\cr0}\)
|
\(\matrix{ \cr2\cr5\cr2\cr4\cr2\cr5\cr4}\)
|
Example 7.3. Now let us consider an example in \(\mathbb{Z}^2\). Let \(c_1=(4,-1),c_2=(5,4),\) and \(c_3=(-2,-4)\). Table 8.7.2 shows the changes in the values of \(b_1,b_2,\) and \(b_3\) in the execution of MLLL.
Table 8.7.2
| \(b_1\) | \(b_2\) | \(b_3\) | Place |
\(\matrix{(4, -1)\cr(4, -1)\cr(4, -1)\cr(4, -1)\cr(-1, 1)\cr(-1, 1)\cr(-1, 1)\cr(-1, 1)\cr(-1, 1)\cr(-1, 1)}\)
|
\(\matrix{(5, 4)\cr(1, 5)\cr(1, 5)\cr(-1, 1)\cr(4, -1)\cr(1, 2)\cr(1, 2)\cr(-1, 1)\cr(0, 0)\cr(1, 2)}\)
|
\(\matrix{(-2, -4)\cr(-2, -4)\cr(-1, 1)\cr(1, 5)\cr(1, 5)\cr(1, 5)\cr(-1, 1)\cr(1, 2)\cr(1, 2)\cr(0, 0)}\)
|
\(\matrix{ \cr2\cr2\cr5\cr5\cr2\cr2\cr5\cr2\cr4}\)
|
Example 7.4. Our last example is in \(\mathbb{Z}^3\). Suppose the input to MLLL consists of the rows of the matrix \(\begin{bmatrix} 48 & -124 & 292 \\ 171 & -142 & 141 \\ -291 & 254 & -277 \end{bmatrix}\).
Then the computation proceeds as shown in Table 8.7.3.
Table 8.7.3
| \(b_1\) | \(b_2\) | \(b_3\) | Place |
\(\matrix{(48, -124, 292)\cr(48, -124, 292)\cr(123, -18, -151)\cr(123, -18, -151)\cr(123, -18, -151)\cr(123, -18, -151)\cr(51, -30, 5)\cr(51, -30, 5)\cr(51, -30, 5)\cr(51, -30, 5)\cr(51, -30, 5)\cr(-12, 20, -40)\cr(-12, 20, -40)\cr(-12, 20, -40)\cr(-12, 20, -40)\cr(-12, 20, -40)\cr(18, -8, -6)\cr(18, -8, -6)\cr(18, -8, -6)\cr(18, -8, -6)\cr(18, -8, -6)\cr(18, -8, -6)\cr(18, -8, -6)}\)
|
\(\matrix{(171, -142, 141)\cr(123, -18, -151)\cr(48, -124, 292)\cr(171, -142, 141)\cr(171, -142, 141)\cr(51, -30, 5)\cr(123, -18, -151)\cr(21, 42, -161)\cr(21, 42, -161)\cr(192, -100, -20)\cr(-12, 20, -40)\cr(51, -30, 5)\cr(39, -10, -35)\cr(39, -10, -35)\cr(-18, 52, -126)\cr(18, -8, -6)\cr(-12, 20, -40)\cr(39, -10, -35)\cr(3, 6, -23)\cr(3, 6, -23)\cr(-18, 8, 6)\cr(0, 0, 0)\cr(3, 6, -23)}\)
|
\(\matrix{(-291, 254, -277)\cr(-291, 254, -277)\cr(-291, 254, -277)\cr(-291, 254, -277)\cr(51, -30, 5)\cr(171, -142, 141)\cr(171, -142, 141)\cr(171, -142, 141)\cr(192, -100, -20)\cr(21, 42, -161)\cr(21, 42, -161)\cr(21, 42, -161)\cr(21, 42, -161)\cr(-18, 52, -126)\cr(39, -10, -35)\cr(39, -10, -35)\cr(39, -10, -35)\cr(-12, 20, -40)\cr(-12, 20, -40)\cr(-18, 8, 6)\cr(3, 6, -23)\cr(3, 6, -23)\cr(0, 0, 0)}\)
|
\(\matrix{ \cr2\cr5\cr2\cr2\cr5\cr5\cr2\cr2\cr5\cr2\cr5\cr2\cr2\cr5\cr2\cr5\cr5\cr2\cr2\cr5\cr2\cr4}\)
|
(%i1)
ADJUST_MU(m,p):=block
(if abs(mu[m,p])>1/2 then
(r:round(mu[m,p]),if mu[m,p]=-5/2 then r:-3,
b[m]:b[m]-r*b[p],
mu[m,p]:mu[m,p]-r,
for j:1 thru p-1 do
(mu[m,j]:mu[m,j]-r*mu[p,j])
)
)$
(%i2)
MLLL(c):=block
([bstar,s,h,k,i,t,m,nu,B,C,restart],
h:length(c[1]),
k:length(c),
mu:zeromatrix(k,k),
b:zeromatrix(k,k),
ZeroVector:create_list(0,i,1,h),
bstar:zeromatrix(k,h),
B:create_list(0,i,1,k),
b:c,
s:k,
i:1,
/* 修正3: 外層while不再用startagain=false限制,改用restart局部旗標 */
while i<=s do
(if b[ i ]=ZeroVector then
(if i<s then ([b[ i ],b[s]]:[b[s],b[ i ]], print(" P1",b)),
s:s-1
)
else /*b[ i ]不為零向量*/
(bstar[ i ]:b[ i ], print("i=",i,"b*[",i,"]=",bstar[ i ],"b*=",bstar),
for j:1 thru i-1 do (mu[i,j]: (b[ i ].bstar[j])/B[j], bstar[ i ]:bstar[ i ]-mu[i,j]*bstar[j]),
B[ i ]:bstar[ i ].bstar[ i ],
if i=1 then
(i:2)
else /*i>1*/
(t:i, m:i,
restart:false, /* 修正3: 每次進入i>1區塊重設restart */
while m<=t and restart=false do /* 修正1+2: P4後立即退出內層while */
(ADJUST_MU(m,m-1), print(" P2",b),
nu:mu[m,m-1], C:B[m]+nu^2*B[m-1],
if C>=3/4*B[m-1] then
(for p:m-2 thru 1 step -1 do (ADJUST_MU(m,p), print("P 3",b)),
m:m+1
)
else
(if b[m]=ZeroVector then /* 修正1: P4與P5互斥 */
(if m<s then
([b[m],b[s]]:[b[s],b[m]], print("P 4",b)),
s:s-1, i:m,
restart:true /* 修正2: 設旗標讓內層while退出 */
)
else /*b[m]不為零向量,才執行Lovász交換(P5)*/
(if C#0 then
(mu[m,m-1]:nu*B[m-1]/C, B[m]:B[m-1]*B[m]/C,
for j:m+1 thru t do
(temp:matrix([1,mu[m,m-1]],[0,1]).matrix([0,1],[1,-nu]).matrix([mu[j,m-1]],[mu[j,m]]),
mu[j,m-1]:temp[1][1], mu[j,m]:temp[2][1]
)
),
B[m-1]:C,
[b[m-1],b[m]]:[b[m],b[m-1]], print("P 5",b), print("m=",m,"t=",t,"B=",B,"bstar=",bstar,"mu=",mu),
if B[m-1]=0 then (t:m-1),
for j:1 thru m-2 do ([mu[m-1,j],mu[m,j]]:[mu[m,j],mu[m-1,j]]),
bstar[m-1]:b[m-1],
for j:1 thru m-2 do (bstar[m-1]:bstar[m-1]-mu[m-1,j]*bstar[j]),
if m<=t then
(bstar[m]:b[m],
for j:1 thru m-1 do (bstar[m]:bstar[m]-mu[m,j]*bstar[j])
),
print("b=",b,"m=",m,"t=",t,"B=",B,"bstar=",bstar,"mu=",mu),
if m>2 then (m:m-1)
)
)/*C<3/4B[m-1]*/
),/*While m<=t and restart=false*/
/* 修正3: restart=true時不遞增i,讓外層while從i=m重新開始(模擬Goto 99) */
if restart=false then (i:i+1)
)/* i>1 */
)/* b[ i ]#0 */
),
return(b)
)$
(%i4)
c:matrix([36],
[84],
[100])$
MLLL(c);
\(i=1\) \(b^*[1]=[36]\) \(b^*=\left[\matrix{36\cr0\cr0}\right]\)
\(i=2\) \(b^*[2]=[84]\) \(b^*=\left[\matrix{36\cr84\cr0}\right]\)
\(P2\left[\matrix{36\cr12\cr100}\right]\)
\(P5\left[\matrix{12\cr36\cr100}\right]\)
\(m=2\) \(t=2\) \(B=[144,0,0]\) \(bstar=\left[\matrix{36\cr0\cr0}\right]\) \(mu=\left[\matrix{0&0&0\cr3&0&0\cr0&0&0}\right]\)
\(b=\left[\matrix{12\cr36\cr100}\right]\) \(m=2\) \(t=2\) \(B=[144,0,0]\) \(bstar=\left[\matrix{12\cr0\cr0}\right]\) \(mu=\left[\matrix{0&0&0\cr3&0&0\cr0&0&0}\right]\)
\(P2\left[\matrix{12\cr0\cr100}\right]\)
\(P4\left[\matrix{12\cr100\cr0}\right]\)
\(i=2\) \(b^*[2]=[100]\) \(b^*=\left[\matrix{12\cr100\cr0}\right]\)
\(P2\left[\matrix{12\cr4\cr0}\right]\)
\(P5\left[\matrix{4\cr12\cr0}\right]\)
\(m=2\) \(t=2\) \(B=[16,0,0]\) \(bstar=\left[\matrix{12\cr0\cr0}\right]\) \(mu=\left[\matrix{0&0&0\cr 3&0&0\cr 0&0&0}\right]\)
\(b=\left[\matrix{4\cr12\cr0}\right]\) \(m=2\) \(t=2\) \(B=[16,0,0]\) \(bstar=\left[\matrix{4\cr0\cr0}\right]\) \(mu=\left[\matrix{0&0&0\cr3&0&0\cr0&0&0}\right]\)
\(P2\left[\matrix{4\cr0\cr0}\right]\)
(%o4) \(\left[\matrix{4\cr0\cr0}\right]\)
(%i6)
c:matrix([4,-1],
[5,4],
[-2,-4])$
MLLL(c);
\(i=1\) \(b^*[1]=\left[4,-1\right]\) \(b^*=\left[\matrix{4&-1\cr 0&0\cr 0&0}\right]\)
\(i=2\) \(b^*[2]=\left[5,4\right]\) \(b^*=\left[\matrix{4&-1\cr 5&4\cr 0&0}\right]\)
\(P2\) \(\left[\matrix{4&-1\cr 1&5\cr -2&-4}\right]\)
\(i=3\) \(b^*[3]=\left[-2,-4\right]\) \(b^*=\left[\matrix{4&-1\cr \displaystyle \frac{21}{17}&\displaystyle \frac{84}{17}\cr -2&-4}\right]\)
\(P2\) \(\left[\matrix{4&-1\cr 1&5\cr -1&1}\right]\)
\(P5\) \(\left[\matrix{4&-1\cr -1&1\cr 1&5}\right]\)
\(m=3\) \(t=3\) \(B=\left[17,\displaystyle \frac{9}{17},0\right]\) \(bstar=\left[\matrix{4&-1\cr \displaystyle \frac{21}{17}&\displaystyle \frac{84}{17}\cr 0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-1}{17}&0&0\cr \displaystyle \frac{-5}{17}&7&0}\right]\)
\(B=\left[\matrix{4&-1\cr -1&1\cr 1&5}\right]\) \(m=3\) \(t=3\) \(B=\left[17,\displaystyle \frac{9}{17},0\right]\) \(bstar=\left[\matrix{4&-1\cr \displaystyle \frac{3}{17}&\displaystyle \frac{12}{17}\cr 0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-5}{17}&0&0\cr \displaystyle \frac{-1}{17}&7&0}\right]\)
\(P2\) \(\left[\matrix{4&-1\cr -1&1\cr 1&5}\right]\)
\(P5\) \(\left[\matrix{-1&1\cr 4&-1\cr 1&5}\right]\)
\(m=2\) \(t=3\) \(B=\left[2,\displaystyle \frac{9}{2},0\right]\) \(bstar=\left[\matrix{4&-1\cr \displaystyle \frac{3}{17}&\displaystyle \frac{12}{17}\cr 0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-5}{2}&0&0\cr 2&2&0}\right]\)
\(B=\left[\matrix{-1&1\cr 4&-1\cr 1&5}\right]\) \(m=2\) \(t=3\) \(B=\left[2,\displaystyle \frac{9}{2},0\right]\) \(bstar=\left[\matrix{-1&1\cr \displaystyle \frac{3}{2}&\displaystyle \frac{3}{2}\cr 0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-5}{2}&0&0\cr 2&2&0}\right]\)
\(P2\) \(\left[\matrix{-1&1\cr 1&2\cr 1&5}\right]\)
\(P2\) \(\left[\matrix{-1&1\cr 1&2\cr -1&1}\right]\)
\(P5\) \(\left[\matrix{-1&1\cr -1&1\cr 1&2}\right]\)
\(m=3\) \(t=3\) \(B=\left[2,0,0\right]\) \(bstar=\left[\matrix{-1&1\cr \displaystyle \frac{3}{2}&\displaystyle \frac{3}{2}\cr 0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{1}{2}&0&0\cr 1&0&0}\right]\)
\(B=\left[\matrix{-1&1\cr -1&1\cr 1&2}\right]\) \(m=3\) \(t=2\) \(B=\left[2,0,0\right]\) \(bstar=\left[\matrix{-1&1\cr 0&0\cr 0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr 1&0&0\cr \displaystyle \frac{1}{2}&0&0}\right]\)
\(P2\) \(\left[\matrix{-1&1\cr 0&0\cr 1&2}\right]\)
\(P4\) \(\left[\matrix{-1&1\cr 1&2\cr 0&0}\right]\)
\(i=2\) \(b^*[2]=\left[1,2\right]\) \(b^*=\left[\matrix{-1&1\cr 1&2\cr 0&0}\right]\)
\(P2\) \(\left[\matrix{-1&1\cr 1&2\cr 0&0}\right]\)
(%o6) \(\left[\matrix{-1&1\cr 1&2\cr 0&0}\right]\)
(%i8)
c:matrix([48,-124,292],
[171,-142,141],
[-291,254,-277])$
MLLL(c);
\(i=1\) \(b^*[1]=\left[48,-124,292\right]\) \(b^*=\left[\matrix{48&-124&292\cr 0&0&0\cr 0&0&0}\right]\)
\(i=2\) \(b^*[2]=\left[171,-142,141\right]\) \(b^*=\left[\matrix{48&-124&292\cr 171&-142&141\cr 0&0&0}\right]\)
\(P2\) \(\left[\matrix{48&-124&292\cr 123&-18&-151\cr -291&254&-277}\right]\)
\(P5\) \(\left[\matrix{123&-18&-151\cr 48&-124&292\cr -291&254&-277}\right]\)
\(m=2\) \(t=2\) \(B=\left[38254,\displaystyle \frac{1322592920}{19127},0\right]\) \(bstar=\left[\matrix{48&-124&292\cr \displaystyle \frac{449625}{3217}&\displaystyle \frac{-394471}{6434}&\displaystyle \frac{-315337}{6434}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-17978}{19127}&0&0\cr 0&0&0}\right]\)
\(B=\left[\matrix{123&-18&-151\cr 48&-124&292\cr -291&254&-277}\right]\) \(m=2\) \(t=2\) \(B=\left[38254,\displaystyle \frac{1322592920}{19127},0\right]\) \(bstar=\left[\matrix{123&-18&-151\cr \displaystyle \frac{3129390}{19127}&\displaystyle \frac{-2695352}{19127}&\displaystyle \frac{2870406}{19127}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-17978}{19127}&0&0\cr 0&0&0}\right]\)
\(P2\) \(\left[\matrix{123&-18&-151\cr 171&-142&141\cr -291&254&-277}\right]\)
\(i=3\) \(b^*[3]=\left[-291,254,-277\right]\) \(b^*=\left[\matrix{123&-18&-151\cr \displaystyle \frac{3129390}{19127}&\displaystyle \frac{-2695352}{19127}&\displaystyle \frac{2870406}{19127}\cr -291&254&-277}\right]\)
\(P2\) \(\left[\matrix{123&-18&-151\cr 171&-142&141\cr 51&-30&5}\right]\)
\(P5\) \(\left[\matrix{123&-18&-151\cr 51&-30&5\cr 171&-142&141}\right]\)
\(m=3\) \(t=3\) \(B=\left[38254,\displaystyle \frac{49092120}{19127},0\right]\) \(bstar=\left[\matrix{123&-18&-151\cr \displaystyle \frac{3129390}{19127}&\displaystyle \frac{-2695352}{19127}&\displaystyle \frac{2870406}{19127}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{1149}{19127}&0&0\cr \displaystyle \frac{3029}{19127}&\displaystyle \frac{109}{21}&0}\right]\)
\(B=\left[\matrix{123&-18&-151\cr 51&-30&5\cr 171&-142&141}\right]\) \(m=3\) \(t=3\) \(B=\left[38254,\displaystyle \frac{49092120}{19127},0\right]\) \(bstar=\left[\matrix{123&-18&-151\cr \displaystyle \frac{602910}{19127}&\displaystyle \frac{-519288}{19127}&\displaystyle \frac{553014}{19127}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{3029}{19127}&0&0\cr \displaystyle \frac{1149}{19127}&\displaystyle \frac{109}{21}&0}\right]\)
\(P2\) \(\left[\matrix{123&-18&-151\cr 51&-30&5\cr 171&-142&141}\right]\)
\(P5\) \(\left[\matrix{51&-30&5\cr 123&-18&-151\cr 171&-142&141}\right]\)
\(m=2\) \(t=3\) \(B=\left[3526,\displaystyle \frac{49092120}{1763},0\right]\) \(bstar=\left[\matrix{123&-18&-151\cr \displaystyle \frac{602910}{19127}&\displaystyle \frac{-519288}{19127}&\displaystyle \frac{553014}{19127}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{3029}{1763}&0&0\cr \displaystyle \frac{6843}{1763}&\displaystyle \frac{-16}{21}&0}\right]\)
\(B=\left[\matrix{51&-30&5\cr 123&-18&-151\cr 171&-142&141}\right]\) \(m=2\) \(t=3\) \(B=\left[3526,\displaystyle \frac{49092120}{1763},0\right]\) \(bstar=\left[\matrix{51&-30&5\cr \displaystyle \frac{62370}{1763}&\displaystyle \frac{59136}{1763}&\displaystyle \frac{-281358}{1763}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{3029}{1763}&0&0\cr \displaystyle \frac{6843}{1763}&\displaystyle \frac{-16}{21}&0}\right]\)
\(P2\) \(\left[\matrix{51&-30&5\cr 21&42&-161\cr 171&-142&141}\right]\)
\(P2\) \(\left[\matrix{51&-30&5\cr 21&42&-161\cr 192&-100&-20}\right]\)
\(P5\) \(\left[\matrix{51&-30&5\cr 192&-100&-20\cr 21&42&-161}\right]\)
\(m=3\) \(t=3\) \(B=\left[3526,\displaystyle \frac{2783000}{1763},0\right]\) \(bstar=\left[\matrix{51&-30&5\cr \displaystyle \frac{62370}{1763}&\displaystyle \frac{59136}{1763}&\displaystyle \frac{-281358}{1763}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-497}{1763}&0&0\cr \displaystyle \frac{6346}{1763}&\displaystyle \frac{21}{5}&0}\right]\)
\(B=\left[\matrix{51&-30&5\cr 192&-100&-20\cr 21&42&-161}\right]\) \(m=3\) \(t=3\) \(B=\left[3526,\displaystyle \frac{2783000}{1763},0\right]\) \(bstar=\left[\matrix{51&-30&5\cr \displaystyle \frac{14850}{1763}&\displaystyle \frac{14080}{1763}&\displaystyle \frac{-66990}{1763}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{6346}{1763}&0&0\cr \displaystyle \frac{-497}{1763}&\displaystyle \frac{21}{5}&0}\right]\)
\(P2\) \(\left[\matrix{51&-30&5\cr -12&20&-40\cr 21&42&-161}\right]\)
\(P5\) \(\left[\matrix{-12&20&-40\cr 51&-30&5\cr 21&42&-161}\right]\)
\(m=2\) \(t=3\) \(B=\left[2144,\displaystyle \frac{347875}{134},0\right]\) \(bstar=\left[\matrix{51&-30&5\cr \displaystyle \frac{14850}{1763}&\displaystyle \frac{14080}{1763}&\displaystyle \frac{-66990}{1763}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-353}{536}&0&0\cr \displaystyle \frac{1757}{536}&\displaystyle \frac{7}{5}&0}\right]\)
\(B=\left[\matrix{-12&20&-40\cr 51&-30&5\cr 21&42&-161}\right]\) \(m=2\) \(t=3\) \(B=\left[2144,\displaystyle \frac{347875}{134},0\right]\) \(bstar=\left[\matrix{-12&20&-40\cr \displaystyle \frac{5775}{134}&\displaystyle \frac{-2255}{134}&\displaystyle \frac{-1430}{67}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-353}{536}&0&0\cr \displaystyle \frac{1757}{536}&\displaystyle \frac{7}{5}&0}\right]\)
\(P2\) \(\left[\matrix{-12&20&-40\cr 39&-10&-35\cr 21&42&-161}\right]\)
\(P2\) \(\left[\matrix{-12&20&-40\cr 39&-10&-35\cr -18&52&-126}\right]\)
\(P5\) \(\left[\matrix{-12&20&-40\cr -18&52&-126\cr 39&-10&-35}\right]\)
\(m=3\) \(t=3\) \(B=\left[2144,\displaystyle \frac{27830}{67},0\right]\) \(bstar=\left[\matrix{-12&20&-40\cr \displaystyle \frac{5775}{134}&\displaystyle \frac{-2255}{134}&\displaystyle \frac{-1430}{67}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{183}{536}&0&0\cr \displaystyle \frac{787}{268}&\displaystyle \frac{5}{2}&0}\right]\)
\(B=\left[\matrix{-12&20&-40\cr -18&52&-126\cr 39&-10&-35}\right]\) \(m=3\) \(t=3\) \(B=\left[2144,\displaystyle \frac{27830}{67},0\right]\) \(bstar=\left[\matrix{-12&20&-40\cr \displaystyle \frac{1155}{67}&\displaystyle \frac{-451}{67}&\displaystyle \frac{-572}{67}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{787}{268}&0&0\cr \displaystyle \frac{183}{536}&\displaystyle \frac{5}{2}&0}\right]\)
\(P2\) \(\left[\matrix{-12&20&-40\cr 18&-8&-6\cr 39&-10&-35}\right]\)
\(P5\) \(\left[\matrix{18&-8&-6\cr -12&20&-40\cr 39&-10&-35}\right]\)
\(m=2\) \(t=3\) \(B=\left[424,\displaystyle \frac{111320}{53},0\right]\) \(bstar=\left[\matrix{-12&20&-40\cr \displaystyle \frac{1155}{67}&\displaystyle \frac{-451}{67}&\displaystyle \frac{-572}{67}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-17}{53}&0&0\cr \displaystyle \frac{124}{53}&\displaystyle \frac{1}{2}&0}\right]\)
\(B=\left[\matrix{18&-8&-6\cr -12&20&-40\cr 39&-10&-35}\right]\) \(m=2\) \(t=3\) \(B=\left[424,\displaystyle \frac{111320}{53},0\right]\) \(bstar=\left[\matrix{18&-8&-6\cr \displaystyle \frac{-330}{53}&\displaystyle \frac{924}{53}&\displaystyle \frac{-2222}{53}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-17}{53}&0&0\cr \displaystyle \frac{124}{53}&\displaystyle \frac{1}{2}&0}\right]\)
\(P2\) \(\left[\matrix{18&-8&-6\cr -12&20&-40\cr 39&-10&-35}\right]\)
\(P2\) \(\left[\matrix{18&-8&-6\cr -12&20&-40\cr 39&-10&-35}\right]\)
\(P5\) \(\left[\matrix{18&-8&-6\cr 39&-10&-35\cr -12&20&-40}\right]\)
\(m=3\) \(t=3\) \(B=\left[424,\displaystyle \frac{27830}{53},0\right]\) \(bstar=\left[\matrix{18&-8&-6\cr \displaystyle \frac{-330}{53}&\displaystyle \frac{924}{53}&\displaystyle \frac{-2222}{53}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{-17}{53}&0&0\cr \displaystyle \frac{124}{53}&2&0}\right]\)
\(B=\left[\matrix{18&-8&-6\cr 39&-10&-35\cr -12&20&-40}\right]\) \(m=3\) \(t=3\) \(B=\left[424,\displaystyle \frac{27830}{53},0\right]\) \(bstar=\left[\matrix{18&-8&-6\cr \displaystyle \frac{-165}{53}&\displaystyle \frac{462}{53}&\displaystyle \frac{-1111}{53}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{124}{53}&0&0\cr \displaystyle \frac{-17}{53}&2&0}\right]\)
\(P2\) \(\left[\matrix{18&-8&-6\cr 3&6&-23\cr -12&20&-40}\right]\)
\(P2\) \(\left[\matrix{18&-8&-6\cr 3&6&-23\cr -18&8&6}\right]\)
\(P5\) \(\left[\matrix{18&-8&-6\cr -18&8&6\cr 3&6&-23}\right]\)
\(m=3\) \(t=3\) \(B=\left[424,0,0\right]\) \(bstar=\left[\matrix{18&-8&-6\cr \displaystyle \frac{-165}{53}&\displaystyle \frac{462}{53}&\displaystyle \frac{-1111}{53}\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr \displaystyle \frac{18}{53}&0&0\cr -1&0&0}\right]\)
\(B=\left[\matrix{18&-8&-6\cr -18&8&6\cr 3&6&-23}\right]\) \(m=3\) \(t=2\) \(B=\left[424,0,0\right]\) \(bstar=\left[\matrix{18&-8&-6\cr 0&0&0\cr 0&0&0}\right]\) \(mu=\left[\matrix{0&0&0\cr -1&0&0\cr \displaystyle \frac{18}{53}&0&0}\right]\)
\(P2\) \(\left[\matrix{18&-8&-6\cr 0&0&0\cr 3&6&-23}\right]\)
\(P4\) \(\left[\matrix{18&-8&-6\cr 3&6&-23\cr 0&0&0}\right]\)
\(i=2\) \(b^*[2]=\left[3,6,-23\right]\) \(b^*=\left[\matrix{18&-8&-6\cr 3&6&-23\cr 0&0&0}\right]\)
\(P2\) \(\left[\matrix{18&-8&-6\cr 3&6&-23\cr 0&0&0}\right]\)
(%o8) \(\left[\matrix{18&-8&-6\cr 3&6&-23\cr 0&0&0}\right]\)
--------------------
另外
http://www.numbertheory.org/calc/krm_calc.html有calc的數學軟體
在
http://www.numbertheory.org/calc/下載calc_win32.exe,輸入以下指令(紅色文字)
CALC
A NUMBER THEORY CALCULATOR
K.R.MATTHEWS, 16th January 2015
Type exit to quit, help for information:
>
mlll()
Do you wish to use an existing matrix from a file? (Y/N)
Enter y or n :
n
enter the matrix of integers (first row non-zero) :
Enter the number of rows and number of columns
3 2
Enter row 1:
4 -1
Enter row 2:
5 4
Enter row 3:
-2 -4
The matrix entered is
4 -1
5 4
-2 -4
VERBOSE? (Y/N)
Enter y or n :
n
enter the parameters m1 and n1 (normally 1 and 1) :
1 1
L =
0 0 0
1 0 0
1 0 0
D[0] = 1, D[1] = 2, D[2] = 9, D[3] = 0,
The corresponding transformation matrix is
-1 1 1
-2 3 3
4 -6 -7
The corresponding reduced basis is
-1 1
1 2
>
程式輸出\( (-1,1),(1,2) \)結果是正確的但對除錯沒有太大的幫助。
參考資料
Computational Algebraic Number Theory
作者:Michael Pohst
https://books.google.com.tw/book ... 20reduction&f=false
MLLL原始的論文
http://www.researchgate.net/prof ... 73c47f645000000.pdf
有MLLL演算法虛擬碼
http://www.numbertheory.org/pdfs/mlll.pdf