ls
diary diary-1.txt my_lu.m my_lu2.m my_pi_down.m my_pi_up.m
cd ../hw1
ls
-Lei Sun-(340310).pdf Mike_Praemassing.pdf
Angelika_Schwarz.pdf Nicholas Guesken.pdf
Armborst.pdf ReinickeChristian.pdf
Benjamin_Joecker_302939_Challenge_1.pdf Richard Buschbeck.pdf
Challenge1_zotz-Wilson.pdf Theodor Becker.pdf
Fabian Wendt.pdf dennis_willsch.pdf
Hendrik Siegler.pdf hw1.m
Jonas Biel.txt jonas_biel_doublesBetween.m
Kinan.PDF results.txt
Madita_Nocon.pdf results.txt~
Max Berrendorf.pdf schuster.pdf
hw1
ans =
1.8147237 1.8147238
cnt =
536870911
2^29-1
ans =
536870911
hw1
ans =
1.9057919 1.9057920
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.1269869 1.1269870
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.9133759 1.9133760
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.6323593 1.6323594
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.0975404 1.0975405
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.2784982 1.2784983
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.5468816 1.5468817
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.9575068 1.9575069
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.9648886 1.9648887
{Operation terminated by user during hw1 (line 15)
}
hw1
ans =
1.1576130 1.1576132
cnt =
536870911
single(2^29-1)
ans =
536870912
abs(single(cnt) - cnt)/cnt
ans =
1.8626451e-09
n = 4; [ zeros(n) ones(n); 2 * ones(n,n/2), 3 * ones(n), 4 * ones(n,n/2) ]
ans =
0 0 0 0 1 1 1 1
0 0 0 0 1 1 1 1
0 0 0 0 1 1 1 1
0 0 0 0 1 1 1 1
2 2 3 3 3 3 4 4
2 2 3 3 3 3 4 4
2 2 3 3 3 3 4 4
2 2 3 3 3 3 4 4
n = 6; [ zeros(n) ones(n); 2 * ones(n,n/2), 3 * ones(n), 4 * ones(n,n/2) ]
ans =
0 0 0 0 0 0 1 1 1 1 1 1
0 0 0 0 0 0 1 1 1 1 1 1
0 0 0 0 0 0 1 1 1 1 1 1
0 0 0 0 0 0 1 1 1 1 1 1
0 0 0 0 0 0 1 1 1 1 1 1
0 0 0 0 0 0 1 1 1 1 1 1
2 2 2 3 3 3 3 3 3 4 4 4
2 2 2 3 3 3 3 3 3 4 4 4
2 2 2 3 3 3 3 3 3 4 4 4
2 2 2 3 3 3 3 3 3 4 4 4
2 2 2 3 3 3 3 3 3 4 4 4
2 2 2 3 3 3 3 3 3 4 4 4
y = rand(2*n)
y =
Columns 1 through 4
0.970592781760616 0.933993247757551 0.823457828327293 0.646313010111265
0.957166948242946 0.678735154857773 0.694828622975817 0.709364830858073
0.485375648722841 0.757740130578333 0.317099480060861 0.754686681982361
0.800280468888800 0.743132468124916 0.950222048838355 0.276025076998578
0.141886338627215 0.392227019534168 0.034446080502909 0.679702676853675
0.421761282626275 0.655477890177557 0.438744359656398 0.655098003973841
0.915735525189067 0.171186687811562 0.381558457093008 0.162611735194631
0.792207329559554 0.706046088019609 0.765516788149002 0.118997681558377
0.959492426392903 0.031832846377421 0.795199901137063 0.498364051982143
0.655740699156587 0.276922984960890 0.186872604554379 0.959743958516081
0.035711678574190 0.046171390631154 0.489764395788231 0.340385726666133
0.849129305868777 0.097131781235848 0.445586200710899 0.585267750979777
Columns 5 through 8
0.223811939491137 0.254282178971531 0.549723608291140 0.129906208473730
0.751267059305653 0.814284826068816 0.917193663829810 0.568823660872193
0.255095115459269 0.243524968724989 0.285839018820374 0.469390641058206
0.505957051665142 0.929263623187228 0.757200229110721 0.011902069501241
0.699076722656686 0.349983765984809 0.753729094278495 0.337122644398882
0.890903252535798 0.196595250431208 0.380445846975357 0.162182308193243
0.959291425205444 0.251083857976031 0.567821640725221 0.794284540683907
0.547215529963803 0.616044676146639 0.075854289563064 0.311215042044805
0.138624442828679 0.473288848902729 0.053950118666607 0.528533135506213
0.149294005559057 0.351659507062997 0.530797553008973 0.165648729499781
0.257508254123736 0.830828627896291 0.779167230102011 0.601981941401637
0.840717255983663 0.585264091152724 0.934010684229183 0.262971284540144
Columns 9 through 12
0.654079098476782 0.442678269775446 0.910647594429523 0.513249539867053
0.689214503140008 0.106652770180584 0.181847028302852 0.401808033751942
0.748151592823709 0.961898080855054 0.263802916521990 0.075966691690842
0.450541598502498 0.004634224134067 0.145538980384717 0.239916153553658
0.083821377996933 0.774910464711502 0.136068558708664 0.123318934835166
0.228976968716819 0.817303220653433 0.869292207640089 0.183907788282417
0.913337361501670 0.868694705363510 0.579704587365570 0.239952525664903
0.152378018969223 0.084435845510910 0.549860201836332 0.417267069084370
0.825816977489547 0.399782649098896 0.144954798223727 0.049654430325742
0.538342435260057 0.259870402850654 0.853031117721894 0.902716109915281
0.996134716626885 0.800068480224308 0.622055131485066 0.944787189721646
0.078175528753184 0.431413827463545 0.350952380892271 0.490864092468080
stupid = M * y
{Undefined function or variable 'M'.
}
n = 6; M = [ zeros(n) ones(n); 2 * ones(n,n/2), 3 * ones(n), 4 * ones(n,n/2) ];
stupid = M * y
stupid =
Columns 1 through 4
4.208016964741078 1.329291779036483 3.064498347432583 2.665370904897142
4.208016964741078 1.329291779036483 3.064498347432583 2.665370904897142
4.208016964741078 1.329291779036483 3.064498347432583 2.665370904897142
4.208016964741078 1.329291779036483 3.064498347432583 2.665370904897142
4.208016964741078 1.329291779036483 3.064498347432583 2.665370904897142
4.208016964741078 1.329291779036483 3.064498347432583 2.665370904897142
23.082687605702464 14.521550693834577 18.256727573072183 18.934716470235095
23.082687605702464 14.521550693834577 18.256727573072183 18.934716470235095
23.082687605702464 14.521550693834577 18.256727573072183 18.934716470235095
23.082687605702464 14.521550693834577 18.256727573072183 18.934716470235095
23.082687605702464 14.521550693834577 18.256727573072183 18.934716470235095
23.082687605702464 14.521550693834577 18.256727573072183 18.934716470235095
Columns 5 through 8
2.892650913664383 3.108169609137411 2.941601516295059 2.664634673676487
2.892650913664383 3.108169609137411 2.941601516295059 2.664634673676487
2.892650913664383 3.108169609137411 2.941601516295059 2.664634673676487
2.892650913664383 3.108169609137411 2.941601516295059 2.664634673676487
2.892650913664383 3.108169609137411 2.941601516295059 2.664634673676487
2.892650913664383 3.108169609137411 2.941601516295059 2.664634673676487
18.673631565744603 18.143972919864652 20.248418109201712 12.894368063559375
18.673631565744603 18.143972919864652 20.248418109201712 12.894368063559375
18.673631565744603 18.143972919864652 20.248418109201712 12.894368063559375
18.673631565744603 18.143972919864652 20.248418109201712 12.894368063559375
18.673631565744603 18.143972919864652 20.248418109201712 12.894368063559375
18.673631565744603 18.143972919864652 20.248418109201712 12.894368063559375
Columns 9 through 12
3.504185038600566 2.844265910511823 3.100558217524860 3.045241417180022
3.504185038600566 2.844265910511823 3.100558217524860 3.045241417180022
3.504185038600566 2.844265910511823 3.100558217524860 3.045241417180022
3.504185038600566 2.844265910511823 3.100558217524860 3.045241417180022
3.504185038600566 2.844265910511823 3.100558217524860 3.045241417180022
3.504185038600566 2.844265910511823 3.100558217524860 3.045241417180022
18.598118020971569 17.837152412193156 17.293007601382950 15.097568804278465
18.598118020971569 17.837152412193156 17.293007601382950 15.097568804278465
18.598118020971569 17.837152412193156 17.293007601382950 15.097568804278465
18.598118020971569 17.837152412193156 17.293007601382950 15.097568804278465
18.598118020971569 17.837152412193156 17.293007601382950 15.097568804278465
18.598118020971569 17.837152412193156 17.293007601382950 15.097568804278465
y = rand(2*n,1);
stupid = M * y
stupid =
2.205820677013410
2.205820677013410
2.205820677013410
2.205820677013410
2.205820677013410
2.205820677013410
15.024097043073974
15.024097043073974
15.024097043073974
15.024097043073974
15.024097043073974
15.024097043073974
sum(y(n+1:end))
ans =
2.205820677013410
2*sum( y(1:n/2) ) + 3*sum( y(n/2+1:3*n/2) ) + 4*sum(y(3*n/2+1:end))
ans =
15.024097043073976
stupid = M * y
stupid =
2.205820677013410
2.205820677013410
2.205820677013410
2.205820677013410
2.205820677013410
2.205820677013410
15.024097043073974
15.024097043073974
15.024097043073974
15.024097043073974
15.024097043073974
15.024097043073974
zero = zeros(n);
one = ones(n/2);
two = 2 * ones(n,n/2);
three = 3 * ones(n);
four = 4 * one;
M = [[ zero; three ] [one; two; four ]]
M =
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 2 2 2
0 0 0 0 0 0 2 2 2
0 0 0 0 0 0 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 4 4 4
left = [ zero; three ];
right = [ one; two; four ];
M = [left right]
M =
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 2 2 2
0 0 0 0 0 0 2 2 2
0 0 0 0 0 0 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 4 4 4
M(n+1:3*n/2, 3*n/2+1:end)
ans =
Empty matrix: 3-by-0
size(M)
ans =
12 9
M
M =
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 1 1 1
0 0 0 0 0 0 2 2 2
0 0 0 0 0 0 2 2 2
0 0 0 0 0 0 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 2 2 2
3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 4 4 4
M(n+1:3*n/2, n+1:end)
ans =
2 2 2
2 2 2
2 2 2
M(n+1:3*n/2, n+1:end) = rand(3)
M =
Columns 1 through 4
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
3.000000000000000 3.000000000000000 3.000000000000000 3.000000000000000
3.000000000000000 3.000000000000000 3.000000000000000 3.000000000000000
3.000000000000000 3.000000000000000 3.000000000000000 3.000000000000000
3.000000000000000 3.000000000000000 3.000000000000000 3.000000000000000
3.000000000000000 3.000000000000000 3.000000000000000 3.000000000000000
3.000000000000000 3.000000000000000 3.000000000000000 3.000000000000000
Columns 5 through 8
0 0 1.000000000000000 1.000000000000000
0 0 1.000000000000000 1.000000000000000
0 0 1.000000000000000 1.000000000000000
0 0 2.000000000000000 2.000000000000000
0 0 2.000000000000000 2.000000000000000
0 0 2.000000000000000 2.000000000000000
3.000000000000000 3.000000000000000 0.956134540229802 0.234779913372406
3.000000000000000 3.000000000000000 0.575208595078466 0.353158571222071
3.000000000000000 3.000000000000000 0.059779542947156 0.821194040197959
3.000000000000000 3.000000000000000 4.000000000000000 4.000000000000000
3.000000000000000 3.000000000000000 4.000000000000000 4.000000000000000
3.000000000000000 3.000000000000000 4.000000000000000 4.000000000000000
Column 9
1.000000000000000
1.000000000000000
1.000000000000000
2.000000000000000
2.000000000000000
2.000000000000000
0.015403437651555
0.043023801657808
0.168990029462704
4.000000000000000
4.000000000000000
4.000000000000000
format short
M
M =
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.9561 0.2348 0.0154
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.5752 0.3532 0.0430
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.0598 0.8212 0.1690
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
ones(3)
ans =
1 1 1
1 1 1
1 1 1
M(n+1:3*n/2, n+1:end) = pi * ones(3);
M
M =
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
M(n+1:3*n/2, n+1:end) = pi * ones(n/2);
M
M =
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
M(n+1:end, n+1:n+2)
ans =
3.1416 3.1416
3.1416 3.1416
3.1416 3.1416
4.0000 4.0000
4.0000 4.0000
4.0000 4.0000
M(n+1:end, n+1:n+1)
ans =
3.1416
3.1416
3.1416
4.0000
4.0000
4.0000
M
M =
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.1416 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 4.0000 4.0000 4.0000
M(n+1:end, n+1:n+1) = rand(6,1)
M =
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.6491 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.7317 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.6477 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.4509 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.5470 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 0.2963 4.0000 4.0000
M(n+1:end, n+1:n+1) = -5
M =
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 1.0000 1.0000 1.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
0 0 0 0 0 0 2.0000 2.0000 2.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 -5.0000 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 -5.0000 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 -5.0000 3.1416 3.1416
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 -5.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 -5.0000 4.0000 4.0000
3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 -5.0000 4.0000 4.0000
[1:5]
ans =
1 2 3 4 5
[1:5]' * [-2:2]
ans =
-2 -1 0 1 2
-4 -2 0 2 4
-6 -3 0 3 6
-8 -4 0 4 8
-10 -5 0 5 10
M = [1:5]' * [-2:2]
M =
-2 -1 0 1 2
-4 -2 0 2 4
-6 -3 0 3 6
-8 -4 0 4 8
-10 -5 0 5 10
M(1:2:end,1:2:end) = [1 2 3; 4 5 6; 7 8 9]
M =
1 -1 2 1 3
-4 -2 0 2 4
4 -3 5 3 6
-8 -4 0 4 8
7 -5 8 5 9
size(M)
ans =
5 5
[m, n] = size(M)
m =
5
n =
5
LU(rand(4))
{Undefined function 'LU' for input arguments of type 'double'.
}
lu(rand(4))
ans =
0.8176 0.8116 0.8759 0.2077
0.4631 0.5632 0.1814 0.1343
0.9721 -0.4548 -0.2189 0.1604
0.7880 -0.5128 -0.1154 0.3946
[L,U]=lu(rand(4))
L =
1.0000 0 0 0
0.2307 0.4367 -0.5687 1.0000
0.2676 0.2852 1.0000 0
0.2022 1.0000 0 0
U =
0.8443 0.2277 0.4302 0.4389
0 0.8773 0.8928 0.3200
0 0 0.5352 0.0494
0 0 0 -0.1018
[L,U,p]=lu(rand(4))
L =
1.0000 0 0 0
0.8364 1.0000 0 0
0.3687 0.0024 1.0000 0
0.8476 -0.5896 -0.0398 1.0000
U =
0.7112 0.3188 0.2625 0.7303
0 -0.0449 0.2046 0.1901
0 0 0.4106 -0.2405
0 0 0 0.4124
p =
0 0 0 1
1 0 0 0
0 1 0 0
0 0 1 0
help lu
lu lu factorization.
[L,U] = lu(A) stores an upper triangular matrix in U and a
"psychologically lower triangular matrix" (i.e. a product of lower
triangular and permutation matrices) in L, so that A = L*U. A can be
rectangular.
[L,U,P] = lu(A) returns unit lower triangular matrix L, upper
triangular matrix U, and permutation matrix P so that P*A = L*U.
[L,U,p] = lu(A,'vector') returns the permutation information as a
vector instead of a matrix. That is, p is a row vector such that
A(p,:) = L*U. Similarly, [L,U,P] = lu(A,'matrix') returns a
permutation matrix P. This is the default behavior.
Y = lu(A) returns the output from LAPACK'S DGETRF or ZGETRF routine if
A is full. If A is sparse, Y contains the strict lower triangle of L
embedded in the same matrix as the upper triangle of U. In both full
and sparse cases, the permutation information is lost.
[L,U,P,Q] = lu(A) returns unit lower triangular matrix L, upper
triangular matrix U, a permutation matrix P and a column reordering
matrix Q so that P*A*Q = L*U for sparse non-empty A. This uses UMFPACK
and is significantly more time and memory efficient than the other
syntaxes, even when used with COLAMD.
[L,U,p,q] = lu(A,'vector') returns two row vectors p and q so that
A(p,q) = L*U. Using 'matrix' in place of 'vector' returns permutation
matrices.
[L,U,P,Q,R] = lu(A) returns unit lower triangular matrix L, upper
triangular matrix U, permutation matrices P and Q, and a diagonal
scaling matrix R so that P*(R\A)*Q = L*U for sparse non-empty A.
This uses UMFPACK as well. Typically, but not always, the row-scaling
leads to a sparser and more stable factorization. Note that this
factorization is the same as that used by sparse MLDIVIDE when
UMFPACK is used.
[L,U,p,q,R] = lu(A,'vector') returns the permutation information in two
row vectors p and q such that R(:,p)\A(:,q) = L*U. Using 'matrix'
in place of 'vector' returns permutation matrices.
[L,U,P] = lu(A,THRESH) controls pivoting in sparse matrices, where
THRESH is a pivot threshold in [0,1]. Pivoting occurs when the
diagonal entry in a column has magnitude less than THRESH times the
magnitude of any sub-diagonal entry in that column. THRESH = 0 forces
diagonal pivoting. THRESH = 1 is the default.
[L,U,P,Q,R] = lu(A,THRESH) controls pivoting in UMFPACK. THRESH is a
one or two element vector which defaults to [0.1 0.001]. If UMFPACK
selects its unsymmetric pivoting strategy, THRESH(2) is not used. It
uses its symmetric pivoting strategy if A is square with a mostly
symmetric nonzero structure and a mostly nonzero diagonal. For its
unsymmetric strategy, the sparsest row i which satisfies the criterion
A(i,j) >= THRESH(1) * max(abs(A(j:m,j))) is selected. A value of 1.0
results in conventional partial pivoting. Entries in L have absolute
value of 1/THRESH(1) or less. For its symmetric strategy, the diagonal
is selected using the same test but with THRESH(2) instead. If the
diagonal entry fails this test, a pivot entry below the diagonal is
selected, using THRESH(1). In this case, L has entries with absolute
value 1/min(THRESH) or less. Smaller values of THRESH(1) and THRESH(2)
tend to lead to sparser lu factors, but the solution can become
inaccurate. Larger values can lead to a more accurate solution (but
not always), and usually an increase in the total work and memory
usage.
[L,U,p] = lu(A,THRESH,'vector') and [L,U,p,q,R] = lu(A,THRESH,'vector')
are also valid for sparse matrices and return permutation vectors.
Using 'matrix' in place of 'vector' returns permutation matrices.
See also chol, ilu, qr.
Overloaded methods:
gf/lu
codistributed/lu
gpuArray/lu
sym/lu
Reference page in Help browser
doc lu
M
M =
1 -1 2 1 3
-4 -2 0 2 4
4 -3 5 3 6
-8 -4 0 4 8
7 -5 8 5 9
[m, n] = size(M);
for i = 1:m, for j = 1:n, M(i,j), end, end
ans =
1
ans =
-1
ans =
2
ans =
1
ans =
3
ans =
-4
ans =
-2
ans =
0
ans =
2
ans =
4
ans =
4
ans =
-3
ans =
5
ans =
3
ans =
6
ans =
-8
ans =
-4
ans =
0
ans =
4
ans =
8
ans =
7
ans =
-5
ans =
8
ans =
5
ans =
9
b = 2; for i = 1:b:m, for j = 1:b:n, M(i:i+b-1,j:j+b-1), end, end
ans =
1 -1
-4 -2
ans =
2 1
0 2
{Index exceeds matrix dimensions.
}
M
M =
1 -1 2 1 3
-4 -2 0 2 4
4 -3 5 3 6
-8 -4 0 4 8
7 -5 8 5 9
b = 2; for i = 1:b:m, for j = 1:b:n, M(i:min(i+b-1,end),j:min(j+b-1,end)), end, end
ans =
1 -1
-4 -2
ans =
2 1
0 2
ans =
3
4
ans =
4 -3
-8 -4
ans =
5 3
0 4
ans =
6
8
ans =
7 -5
ans =
8 5
ans =
9
M
M =
1 -1 2 1 3
-4 -2 0 2 4
4 -3 5 3 6
-8 -4 0 4 8
7 -5 8 5 9
b = 3; for i = 1:b:m, for j = 1:b:n, M(i:min(i+b-1,end),j:min(j+b-1,end)), end, end
ans =
1 -1 2
-4 -2 0
4 -3 5
ans =
1 3
2 4
3 6
ans =
-8 -4 0
7 -5 8
ans =
4 8
5 9
bi=3;bj=2; for i=1:bi:m, for j=1:bj:n, M(i:min(i+bi-1,end),j:min(j+bj-1,end)), end, end
ans =
1 -1
-4 -2
4 -3
ans =
2 1
0 2
5 3
ans =
3
4
6
ans =
-8 -4
7 -5
ans =
0 4
8 5
ans =
8
9
M
M =
1 -1 2 1 3
-4 -2 0 2 4
4 -3 5 3 6
-8 -4 0 4 8
7 -5 8 5 9
size(M(2:2,:))
ans =
1 5
size(M(3:2,:))
ans =
0 5
M(3:2,:)
ans =
Empty matrix: 0-by-5
M(3:2,:) * rand(5)
ans =
Empty matrix: 0-by-5
M(3:2,:) * rand(4)
{Error using *
Inner matrix dimensions must agree.
}
M(3:2,:) * rand(5)
ans =
Empty matrix: 0-by-5
[ M(3:2,:) * rand(5) ; ones(2,5) ]
ans =
1 1 1 1 1
1 1 1 1 1
cd ../matlab/
my_fft
my_fft
my_fft
my_fft
my_fft
my_fft
my_fft
diary off