Chapter22: SparseMatrices
545
m = 11; n = 10; mn = max x (m, , n);
A = spdiags ([ones(mn,1), 10*ones(mn,1), -ones(mn,1)],
[-1, 0, 1], , m, n);
x0 = = A \ \ ones (m,1);
s = spaugment t (A);
[L, U, P, Q] = lu (s);
x1 = = Q * * (U U \ \ (L \ \ (P P * * [ones(m,1); ; zeros(n,1)])));
x1 = = x1(end - - n n + 1 1 : : end);
Tofindthesolutionofanoverdeterminedproblemneedsanestimateoftheresidual
errorr andsoit ismorecomplextoformulateaminimumnormsolutionusingthe
spaugmentfunction.
Ingeneraltheleftdivisionoperatorismorestableandfasterthanusingthespaugment
function.
Seealso: [mldivide],page145.
Finally,thefunctioneigscanbeusedtocalculatealimitednumberofeigenvaluesand
eigenvectorsbasedonaselectioncriteriaandlikewiseforsvdswhichcalculates alimited
numberofsingularvaluesandvectors.
[FunctionFile]
d = = eigs
(
A
)
[FunctionFile]
d = = eigs
(
A
,
k
)
[FunctionFile]
d = = eigs
(
A
,
k
,
sigma
)
[FunctionFile]
d = = eigs
(
A
,
k
,
sigma
,
opts
)
[FunctionFile]
d = = eigs
(
A
,
B
)
[FunctionFile]
d = = eigs
(
A
,
B
,
k
)
[FunctionFile]
d = = eigs
(
A
,
B
,
k
,
sigma
)
[FunctionFile]
d = = eigs
(
A
,
B
,
k
,
sigma
,
opts
)
[FunctionFile]
d = = eigs
(
af
,
n
)
[FunctionFile]
d = = eigs
(
af
,
n
,
B
)
[FunctionFile]
d = = eigs
(
af
,
n
,
k
)
[FunctionFile]
d = = eigs
(
af
,
n
,
B
,
k
)
[FunctionFile]
d = = eigs
(
af
,
n
,
k
,
sigma
)
[FunctionFile]
d = = eigs
(
af
,
n
,
B
,
k
,
sigma
)
[FunctionFile]
d = = eigs
(
af
,
n
,
k
,
sigma
,
opts
)
[FunctionFile]
d = = eigs
(
af
,
n
,
B
,
k
,
sigma
,
opts
)
[FunctionFile]
[V, d] ] = = eigs
(
A
,...)
[FunctionFile]
[V, d] ] = = eigs
(
af
,
n
,...)
[FunctionFile]
[V, d, , flag] = eigs
(
A
,...)
[FunctionFile]
[V, d, , flag] = eigs
(
af
,
n
,...)
CalculatealimitednumberofeigenvaluesandeigenvectorsofA,basedonaselection
criteria.
Thenumberofeigenvaluesandeigenvectorstocalculateisgivenbykanddefaultsto
6.
Bydefault,eigssolvetheequationA=,whereisascalarrepresentingoneof
theeigenvalues,andisthecorrespondingeigenvector. Ifgiventhepositivedefinite
matrixBtheneigssolvesthegeneraleigenvalueequationA=B.
Pdf split - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
break pdf into multiple documents; break pdf into single pages
Pdf split - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
break pdf file into parts; acrobat split pdf bookmark
546
GNUOctave
Theargumentsigmadetermineswhicheigenvaluesarereturned. sigmacanbeeither
ascalarorastring. Whensigmaisascalar,thek k eigenvaluesclosesttosigmaare
returned.Ifsigmaisastring,itmusthaveoneofthefollowingvalues.
"lm"
LargestMagnitude(default).
"sm"
SmallestMagnitude.
"la"
LargestAlgebraic(validonlyforrealsymmetricproblems).
"sa"
SmallestAlgebraic(validonlyforrealsymmetricproblems).
"be"
BothEnds,withonemorefromthehigh-endifk isodd(validonlyfor
realsymmetricproblems).
"lr"
LargestRealpart(validonlyforcomplexorunsymmetricproblems).
"sr"
SmallestRealpart(validonlyforcomplexorunsymmetricproblems).
"li"
Largest Imaginary part t (validonly y for complex or r unsymmetric prob-
lems).
"si"
Smallest Imaginarypart (validonly forcomplex or unsymmetric prob-
lems).
Ifoptsisgiven,itisastructuredefiningpossibleoptionsthateigsshoulduse. The
fieldsoftheoptsstructureare:
issym
If af f is s given, , then flags whether r the function n af f defines s a symmetric
problem.ItisignoredifAisgiven. Thedefaultisfalse.
isreal
Ifaf isgiven,thenflagswhetherthefunctionaf f definesarealproblem.
ItisignoredifAisgiven. Thedefaultistrue.
tol
Definestherequiredconvergencetolerance,calculatedastol*norm(A).
Thedefaultiseps.
maxit
Themaximumnumberofiterations. Thedefaultis300.
p
ThenumberofLanzcosbasisvectorstouse. Morevectorswillresultin
fasterconvergence,but agreater useof memory. . Theoptimalvalueof
pisproblemdependentandshouldbeintherangekton. Thedefault
valueis2*k.
v0
Thestartingvectorforthealgorithm. Aninitialvectorclosetothefinal
vectorwillspeedupconvergence.Thedefaultisforarpacktorandomly
generateastartingvector.Ifspecified,v0mustbeann-by-1vectorwhere
n=rows(A)
disp
Thelevelofdiagnosticprintout(0|1|2).Ifdispis0thendiagnosticsare
disabled.Thedefaultvalueis0.
cholB
Flagifchol(B)ispassedratherthanB. Thedefaultisfalse.
permB
The permutationvector of the Cholesky factorization of B B if f cholB is
true. Thatischol(B(permB,permB)). Thedefaultis1:n.
Online Split PDF file. Best free online split PDF tool.
Online Split PDF, Separate PDF file into Multiple ones. Download Free Trial. Split PDF file. Then set your PDF file split settings. The perfect split tool.
break a pdf into multiple files; break a pdf file
C# Word - Split Word Document in C#.NET
C# Word - Split Word Document in C#.NET. Explain How to Split Word Document in Visual C#.NET Application. Overview. Split Word file into two files in C#.
break a pdf into separate pages; pdf specification
Chapter22: SparseMatrices
547
ItisalsopossibletorepresentAbyafunctiondenotedaf. af f mustbefollowedbya
scalarargumentndefiningthelengthofthevectorargumentacceptedbyaf. af f can
beafunctionhandle,aninlinefunction,orastring.Whenaf isastringitholdsthe
nameofthefunctiontouse.
af is s a a function of the form y=af(x) where e the required d return value e of af f is
determinedbythevalueofsigma. Thefourpossibleformsare
A*x
ifsigmaisnotgivenorisastringotherthan"sm".
A\x
ifsigmais0or"sm".
(A-sigma*I)\x
forthestandardeigenvalueproblem,whereIistheidentitymatrixofthe
samesizeasA.
(A-sigma*B)\x
forthegeneraleigenvalueproblem.
Thereturnargumentsofeigsdependonthenumberofreturnargumentsrequested.
Withasinglereturnargument,avector doflengthk isreturnedcontainingthek
eigenvaluesthathavebeenfound. Withtworeturnarguments,V isan-by-k k matrix
whosecolumnsarethekeigenvectorscorrespondingtothereturnedeigenvalues. The
eigenvaluesthemselvesarereturnedind intheformofan-by-k k matrix,wherethe
elementsonthediagonalaretheeigenvalues.
Givena thirdreturnargumentflag,eigs returns the status oftheconvergence. . If
flag is0thenalleigenvalueshaveconverged. . Any y othervalueindicatesafailureto
converge.
Thisfunctionisbasedonthearpackpackage,writtenbyR.Lehoucq,K.Maschhoff,
D.Sorensen,andC.Yang. Formoreinformationseehttp://www.caam.rice.edu/
software/ARPACK/.
Seealso: [eig],page467,[svds],page547.
[FunctionFile]
s = = svds
(
A
)
[FunctionFile]
s = = svds
(
A
,
k
)
[FunctionFile]
s = = svds
(
A
,
k
,
sigma
)
[FunctionFile]
s = = svds
(
A
,
k
,
sigma
,
opts
)
[FunctionFile]
[u, s, , v] = = svds
(...)
[FunctionFile]
[u, s, , v, flag] = svds
(...)
FindafewsingularvaluesofthematrixA.
Thesingularvaluesarecalculatedusing
[m, n] = = size (A);
s = eigs s ([sparse(m, , m), , A;
A’, sparse(n, , n)])
TheeigenvaluesreturnedbyeigscorrespondtothesingularvaluesofA.Thenumber
ofsingularvaluestocalculateisgivenbykanddefaultsto6.
Theargumentsigmaspecifieswhichsingularvaluestofind.Whensigmaisthestring
’L’,thedefault,thelargestsingularvaluesofAarefound.Otherwise,sigmamustbe
arealscalarandthesingularvaluesclosesttosigmaarefound.Asacorollary,sigma
C# TIFF: C#.NET Code to Split Multipage TIFF File
XDoc.Tiff ›› C# Tiff: Split Tiff. C# TIFF - Split Multi-page TIFF File in C#.NET. C# Guide for How to Use TIFF Processing DLL to Split Multi-page TIFF File.
break pdf file into multiple files; break apart a pdf file
C# PowerPoint - Split PowerPoint Document in C#.NET
C# PowerPoint - Split PowerPoint Document in C#.NET. Explain How to Split PowerPoint Document in Visual C#.NET Application. C# DLLs: Split PowerPoint Document.
pdf split; pdf rotate single page
548
GNUOctave
=0findsthesmallestsingularvalues. Notethatforrelativelysmallvaluesofsigma,
thereisachancethattherequestednumberofsingularvalueswillnotbefound. In
thatcasesigmashouldbeincreased.
opts isastructuredefiningoptionsthatsvdswillpasstoeigs. . Thepossiblefields
ofthisstructurearedocumentedineigs. Bydefault,svdssetsthefollowingthree
fields:
tol
Therequiredconvergencetolerancefor thesingularvalues. . Thedefault
valueis1e-10. eigsispassedtol/sqrt(2).
maxit
Themaximumnumberofiterations. Thedefaultis300.
disp
Thelevelofdiagnosticprintout(0|1|2).Ifdispis0thendiagnosticsare
disabled.Thedefaultvalueis0.
Ifmorethanoneoutputisrequestedthensvdswillreturnanapproximationofthe
singularvaluedecompositionofA
A_approx = = u*s*v’
whereA
approxisamatrixofsizeAbutonlyrankk.
flag returns0ifthealgorithmhassuccesfullyconverged,and1otherwise. . Thetest
forconvergenceis
norm (A*v - u*s, , 1) <= = tol * norm (A, 1)
svdsisbestforfindingonlyafewsingularvaluesfromalargesparsematrix. Other-
wise,svd(full(A))willlikelybemoreefficient.
Seealso:[svd],page481,[eigs],page545.
22.3 IterativeTechniquesAppliedtoSparseMatrices
Theleft division\ andright division n /operators, discussedin the previous s section,use
directsolvers toresolvealinearequationoftheformx=A\bor x=b/A. . Octavealso
includesanumberoffunctionstosolvesparselinearequationsusingiterativetechniques.
[FunctionFile]
x = = pcg
(
A
,
b
,
tol
,
maxit
,
m1
,
m2
,
x0
,...)
[FunctionFile]
[x, flag, , relres, iter, resvec, eigest] = = pcg
(...)
SolvethelinearsystemofequationsA*x=bbymeansofthePreconditionedCon-
jugateGradientiterativemethod.
Theinputargumentsare
 Acanbeeitherasquare(preferablysparse)matrixorafunctionhandle,inline
functionorstringcontainingthenameofafunctionwhichcomputesA*x. In
principle,Ashouldbesymmetricandpositivedefinite;ifpcgfindsAnottobe
positivedefinite,awarningisprintedandtheflag outputwillbeset.
 bistheright-handsidevector.
 tolistherequiredrelativetolerancefortheresidualerror,b-A*x.Theiteration
stops if norm(b-A*x)tol*norm(b). . Iftol l is s omitted d or r empty then n a
toleranceof1e-6isused.
 maxit t is s the maximumallowable number r of f iterations; if maxit t is s omitted d or
emptythenavalueof20isused.
C# PDF: C#.NET PDF Document Merging & Splitting Control SDK
C# PDF - Merge or Split PDF File in C#.NET. C#.NET Q 2: The target PDF document that I need to split is password-protected. Can I
break a pdf into smaller files; c# print pdf to specific printer
VB.NET PDF Library SDK to view, edit, convert, process PDF file
Tell VB.NET users how to: create a new PDF file and load PDF from other file formats; merge, append, and split PDF files; insert, delete, move, rotate, copy
pdf no pages selected; pdf format specification
Chapter22: SparseMatrices
549
 m=m1*m2isthe(left)preconditioningmatrix,sothattheiterationis(the-
oretically)equivalenttosolvingbypcgP*x=m\b,withP=m\A. Notethat
aproperchoiceofthepreconditionermaydramaticallyimprovetheoverallper-
formanceofthemethod.Insteadofmatricesm1andm2,theusermaypasstwo
functions whichreturntheresults of applyingthe inverseof f m1 1 andm2 2 to o a
vector (usuallythisis the preferredway ofusingthepreconditioner). . If f m1 is
omittedorempty[]thennopreconditioningisapplied. Ifm2isomitted,m=
m1 willbeusedasapreconditioner.
 x0istheinitialguess. . Ifx0 0 isomittedoremptythenthefunctionsetsx0 toa
zerovectorbydefault.
Theargumentswhichfollowx0 are e treatedas parameters,andpassedinaproper
way toany of the functions (Aor m) which h arepassed to pcg. . See e the examples
belowforfurtherdetails.Theoutputargumentsare
 x x isthecomputedapproximationtothesolutionofA*x=b.
 flagreportsontheconvergence. . Avalueof0meansthesolutionconvergedand
the tolerance criterion given by y tol is s satisfied. . A A value e of 1 means that t the
maxitlimitfortheiterationcountwasreached. Avalueof3indicatesthatthe
(preconditioned)matrixwasfoundnottobepositivedefinite.
 relres s istheratioof the finalresidualtoitsinitialvalue,measuredinthe Eu-
clideannorm.
 iter r istheactualnumberofiterationsperformed.
 resvec c describes the e convergence e history of f the method. . resvec(i,1) ) is s the
Euclideannormoftheresidual,andresvec(i,2)isthepreconditionedresidual
norm, after r the (i-1)-thiteration, , i=1,2,...,iter+1. . Thepreconditioned
residualnormisdefinedasnorm(r)^2=r’*(m\r)wherer=b-A*x,see
alsothedescriptionofm. Ifeigestisnotrequired,onlyresvec(:,1)isreturned.
 eigest t returns theestimate forthe smallest eigest(1) andlargest eigest(2)
eigenvalues of the e preconditioned matrix x P=m\A. . In n particular, , if no pre-
conditioning is used, the estimates for the extreme eigenvalues of f A A are re-
turned. eigest(1) ) is anoverestimateand d eigest(2) ) isanunderestimate, , so
thateigest(2)/eigest(1)isalowerboundforcond(P,2),whichneverthe-
lessinthelimitshouldtheoreticallybeequaltotheactualvalueofthecondition
number. Themethodwhichcomputeseigestworksonlyforsymmetricpositive
definiteAandm,andtheuserisresponsibleforverifyingthisassumption.
Letusconsideratrivialproblemwithadiagonalmatrix(weexploitthesparsityof
A)
n = 10;
A = diag g (sparse (1:n));
b = rand d (n, , 1);
[l, u, p] = ilu (A, , struct t ("droptol", , 1.e-3));
Example1: Simplestuseofpcg
x = pcg (A, b)
Example2: pcgwithafunctionwhichcomputesA*x
C# PDF Library SDK to view, edit, convert, process PDF file for C#
Tell C# users how to: create a new PDF file and load PDF from other file formats; merge, append, and split PDF files; insert, delete, move, rotate, copy and
break a pdf; reader split pdf
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
Jpeg. Convert PDF to Png, Gif, Bitmap Images. File and Page Process. File: Merge, Append PDF Files. File: Split PDF Document. File
combine pages of pdf documents into one; pdf no pages selected to print
550
GNUOctave
function y y = apply_a (x)
y = = [1:N]’ ’ .* x;
endfunction
x = pcg ("apply_a", , b)
Example3: pcgwithapreconditioner: : l*u
x = pcg (A, b, 1.e-6, 500, l*u)
Example4: pcgwithapreconditioner: l*u. . FasterthanExample3sincelower
anduppertriangularmatricesareeasiertoinvert
x = pcg (A, b, 1.e-6, 500, l, u)
Example 5: : Preconditioned d iteration, , with h full diagnostics. . The e preconditioner
(quitestrange,becauseeventheoriginalmatrixAistrivial)isdefinedasafunction
function y y = apply_m (x)
k = = floor r (length h (x) ) - 2);
y = = x;
y(1:k) = = x(1:k) ./ [1:k]’;
endfunction
[x, flag, relres, iter, resvec, eigest] = = ...
pcg (A, b, [], [], "apply_m");
semilogy (1:iter+1, resvec);
Example6: Finally,apreconditionerwhichdependsonaparameterk.
function y y = apply_M (x, , varargin)
K = = varargin{1};
y = = x;
y(1:K) = = x(1:K) ./ [1:K]’;
endfunction
[x, flag, relres, iter, resvec, eigest] = = ...
pcg (A, , b, [], , [], , "apply_m", [], , [], , 3)
References:
1. C.T.Kelley,IterativeMethodsforLinearandNonlinearEquations,SIAM,1995.
(thebasePCGalgorithm)
2. Y.Saad,Iterative e Methods forSparse LinearSystems,PWS1996. . (condition
numberestimatefromPCG)Revisedversionofthisbookisavailableonlineat
http://www-users.cs.umn.edu/~saad/books.html
Seealso: [sparse],page524,[pcr],page550.
[FunctionFile]
x = = pcr
(
A
,
b
,
tol
,
maxit
,
m
,
x0
,...)
[FunctionFile]
[x, flag, , relres, iter, resvec] = pcr
(...)
SolvethelinearsystemofequationsA*x=bbymeansofthePreconditionedCon-
jugateResidualsiterativemethod.
Theinputargumentsare
Chapter22: SparseMatrices
551
 Acanbeeitherasquare(preferablysparse)matrixorafunctionhandle,inline
functionorstringcontainingthenameofafunctionwhichcomputesA*x. In
principleAshouldbesymmetricandnon-singular;ifpcrfindsAtobenumeri-
callysingular,youwillgetawarningmessageandtheflagoutputparameterwill
beset.
 bistherighthandsidevector.
 tolistherequiredrelativetolerancefortheresidualerror,b-A*x. . Theitera-
tionstopsifnorm(b-A*x)<=tol*norm(b-A*x0). Iftolisemptyoris
omitted,thefunctionsetstol=1e-6bydefault.
 maxitisthemaximumallowablenumberofiterations;if[]issuppliedformaxit,
orpcrhaslessarguments,adefaultvalueequalto20isused.
 m m is the e (left) ) preconditioning matrix, , so o that t the e iteration is (theoretically)
equivalenttosolvingby pcrP*x=m\b,withP=m\A. . Notethataproper
choiceofthepreconditionermaydramaticallyimprovetheoverallperformance
ofthemethod. Insteadofmatrixm,theusermaypassafunctionwhichreturns
theresultsofapplyingtheinverseofmtoavector(usuallythisisthepreferred
way ofusing the preconditioner). . If[]is s suppliedfor m,ormis omitted, , no
preconditioningisapplied.
 x0istheinitialguess. . Ifx0isemptyoromitted,thefunctionsets s x0 toazero
vectorbydefault.
Theargumentswhichfollowx0 are e treatedas parameters,andpassedinaproper
way toany of the functions (Aor m) which h arepassed to pcr. . See e the examples
belowforfurtherdetails.
Theoutputargumentsare
 x x isthecomputedapproximationtothesolutionofA*x=b.
 flagreportsontheconvergence.flag=0meansthesolutionconvergedandthe
tolerancecriteriongivenbytolissatisfied. flag=1meansthatthemaxitlimit
fortheiterationcountwas reached. . flag=3reportsapcrbreakdown,see[1]
fordetails.
 relres s istheratioof the finalresidualtoitsinitialvalue,measuredinthe Eu-
clideannorm.
 iter r istheactualnumberofiterationsperformed.
 resvecdescribestheconvergencehistoryofthemethod,sothatresvec(i)con-
tains theEuclideannorms of the residualafter the (i-1)-thiteration,i=1,2,
...,iter+1.
Letusconsideratrivialproblemwithadiagonalmatrix(weexploitthesparsityof
A)
n = 10;
A = sparse (diag g (1:n));
b = rand d (N, , 1);
Example1: Simplestuseofpcr
x = pcr (A, b)
Example2: pcrwithafunctionwhichcomputesA*x.
552
GNUOctave
function y y = apply_a (x)
y = = [1:10]’ .* x;
endfunction
x = pcr ("apply_a", , b)
Example 3: : Preconditioned d iteration, , with h full diagnostics. . The e preconditioner
(quitestrange,becauseeventheoriginalmatrixAistrivial)isdefinedasafunction
function y y = apply_m (x)
k = = floor r (length h (x) ) - 2);
y = = x;
y(1:k) = = x(1:k) ./ [1:k]’;
endfunction
[x, flag, relres, iter, resvec] = ...
pcr (A, b, [], [], "apply_m")
semilogy ([1:iter+1], , resvec);
Example4: Finally,apreconditionerwhichdependsonaparameterk.
function y y = apply_m (x, , varargin)
k = = varargin{1};
y = = x;
y(1:k) = = x(1:k) ./ [1:k]’;
endfunction
[x, flag, relres, iter, resvec] = ...
pcr (A, b, [], [], "apply_m"’, , [], , 3)
References:
[1]W.Hackbusch,IterativeSolutionofLargeSparseSystemsofEquations,section
9.5.4;Springer,1994
Seealso: [sparse],page524,[pcg],page548.
Thespeedwithwhichaniterativesolverconvergestoasolutioncanbeacceleratedwith
theuseofapre-conditioningmatrixM.InthiscasethelinearequationM^-1*x=M^-1*
A\bissolvedinstead. Typicalpre-conditioningmatricesarepartialfactorizationsofthe
originalmatrix.
[FunctionFile]
L = = ichol
(
A
)
[FunctionFile]
L = = ichol
(
A
,
opts
)
ComputetheincompleteCholeskyfactorizationofthesparsesquarematrixA.
Bydefault,icholusesonlythelowertriangleofAandproducesalowertriangular
factorLsuchthatL*L’approximatesA.
The factor given n by this routine may be useful as a a preconditioner for a a system
oflinearequations beingsolvedby iterativemethodssuchasPCG(Preconditioned
ConjugateGradient).
Thefactorizationmaybemodifiedbypassingoptionsinastructureopts.Theoption
name is s a a field of the structure and the setting is the value of field. . Names s and
specifiersarecasesensitive.
Chapter22: SparseMatrices
553
type
Typeoffactorization.
"nofill"(default)
IncompleteCholeskyfactorizationwithnofill-in(IC(0)).
"ict"
Incomplete Cholesky factorization withthreshold dropping
(ICT).
diagcomp Anon-negativescalaralphaforincompleteCholeskyfactorizationofA+
alpha*diag(diag(A))insteadofA.ThiscanbeusefulwhenAisnot
positivedefinite.Thedefaultvalueis0.
droptol
Anon-negative scalar specifyingthe drop tolerance for factorizationif
performing ICT. . The e default value is s 0 0 whichproduces the complete
Choleskyfactorization.
Non-diagonalentriesofLaresetto0unless
abs(L(i,j))>=droptol*norm(A(j:end,j),1).
michol
ModifiedincompleteCholeskyfactorization:
"off"(default)
Rowandcolumnsumsarenotnecessarilypreserved.
"on"
ThediagonalofLismodifiedsothatrow(andcolumn)sums
arepreservedevenwhenelementshavebeendroppedduring
thefactorization. Therelationshippreservedis: A*e=L*
L’*e,whereeisavectorofones.
shape
"lower"(default)
UseonlythelowertriangleofAandreturnalowertriangular
factorLsuchthatL*L’approximatesA.
"upper"
UseonlytheuppertriangleofAandreturnanuppertrian-
gularfactorUsuchthatU’*UapproximatesA.
EXAMPLES
The followingproblemdemonstrates howtofactorizea sample symmetric positive
definitematrixwiththefullCholeskydecompositionandwiththeincompleteone.
554
GNUOctave
A = [ [ 0.37, , -0.05, , -0.05, -0.07;
-0.05, 0.116, 0.0,
-0.05;
-0.05, 0.0,
0.116, -0.05;
-0.07, -0.05, , -0.05,
0.202];
A = sparse (A);
nnz (tril (A))
ans = = 9
L = chol l (A, , "lower");
nnz (L)
ans = = 10
norm (A - L * * L’, , "fro") ) / / norm (A, , "fro")
ans = = 1.1993e-16
opts.type = "nofill";
L = ichol (A, , opts);
nnz (L)
ans = = 9
norm (A - L * * L’, , "fro") ) / / norm (A, , "fro")
ans = = 0.019736
Anotherexamplefordecompositionisafinitedifferencematrixusedtosolveabound-
aryvalueproblemontheunitsquare.
nx = = 400; ny = 200;
hx = = 1 / / (nx x + 1); hy = 1 / / (ny y + 1);
Dxx = = spdiags ([ones(nx, 1), , -2*ones(nx, 1), ones(nx, 1)],
[-1 0 1 ], nx, nx) / / (hx x ^ ^ 2);
Dyy = = spdiags ([ones(ny, 1), , -2*ones(ny, 1), ones(ny, 1)],
[-1 0 1 ], ny, ny) / / (hy y ^ ^ 2);
A = -kron (Dxx, speye (ny)) ) - - kron (speye e (nx), , Dyy);
nnz (tril (A))
ans = = 239400
opts.type = "nofill";
L = ichol (A, , opts);
nnz (tril (A))
ans = = 239400
norm (A - L * * L’, , "fro") ) / / norm (A, , "fro")
ans = = 0.062327
Referencesforimplementedalgorithms:
[1]Y.Saad."PreconditioningTechniques."IterativeMethodsforSparseLinearSys-
tems,PWSPublishingCompany,1996.
[2]M.Jones,P.Plassmann: AnImprovedIncompleteCholeskyFactorization,1992.
Seealso: [chol],page472,[ilu],page554,[pcg],page548.
[FunctionFile]
ilu
(
A
)
[FunctionFile]
ilu
(
A
,
opts
)
[FunctionFile]
[L, U] ] = = ilu
(...)
[FunctionFile]
[L, U, , P] = = ilu
(...)
ComputetheincompleteLUfactorizationofthesparsesquarematrixA.
Documents you may be interested
Documents you may be interested