﻿
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);
Toﬁndthesolutionofanoverdeterminedproblemneedsanestimateoftheresidual
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. Ifgiventhepositivedeﬁnite
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
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,itisastructuredeﬁningpossibleoptionsthateigsshoulduse. The
ﬁeldsoftheoptsstructureare:
issym
If af f is s given, , then ﬂags whether r the function n af f deﬁnes s a symmetric
problem.ItisignoredifAisgiven. Thedefaultisfalse.
isreal
Ifaf isgiven,thenﬂagswhetherthefunctionaf f deﬁnesarealproblem.
ItisignoredifAisgiven. Thedefaultistrue.
tol
Deﬁnestherequiredconvergencetolerance,calculatedastol*norm(A).
Thedefaultiseps.
maxit
Themaximumnumberofiterations. Thedefaultis300.
p
ThenumberofLanzcosbasisvectorstouse. Morevectorswillresultin
fasterconvergence,but agreater useof memory. . Theoptimalvalueof
pisproblemdependentandshouldbeintherangekton. Thedefault
valueis2*k.
v0
Thestartingvectorforthealgorithm. Aninitialvectorclosetotheﬁnal
vectorwillspeedupconvergence.Thedefaultisforarpacktorandomly
generateastartingvector.Ifspeciﬁed,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
scalarargumentndeﬁningthelengthofthevectorargumentacceptedbyaf. 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 thirdreturnargumentﬂag,eigs returns the status oftheconvergence. . If
ﬂag is0thenalleigenvalueshaveconverged. . Any y othervalueindicatesafailureto
converge.
Thisfunctionisbasedonthearpackpackage,writtenbyR.Lehoucq,K.Maschhoﬀ,
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.
Theargumentsigmaspeciﬁeswhichsingularvaluestoﬁnd.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
=0ﬁndsthesmallestsingularvalues. Notethatforrelativelysmallvaluesofsigma,
thereisachancethattherequestednumberofsingularvalueswillnotbefound. In
thatcasesigmashouldbeincreased.
opts isastructuredeﬁningoptionsthatsvdswillpasstoeigs. . Thepossibleﬁelds
ofthisstructurearedocumentedineigs. Bydefault,svdssetsthefollowingthree
ﬁelds:
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.
ﬂag returns0ifthealgorithmhassuccesfullyconverged,and1otherwise. . Thetest
forconvergenceis
norm (A*v - u*s, , 1) <= = tol * norm (A, 1)
svdsisbestforﬁndingonlyafewsingularvaluesfromalargesparsematrix. Other-
wise,svd(full(A))willlikelybemoreeﬃcient.
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-
Theinputargumentsare
 Acanbeeitherasquare(preferablysparse)matrixorafunctionhandle,inline
functionorstringcontainingthenameofafunctionwhichcomputesA*x. In
principle,Ashouldbesymmetricandpositivedeﬁnite;ifpcgﬁndsAnottobe
positivedeﬁnite,awarningisprintedandtheﬂag 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-
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.
 ﬂagreportsontheconvergence. . Avalueof0meansthesolutionconvergedand
the tolerance criterion given by y tol is s satisﬁed. . A A value e of 1 means that t the
maxitlimitfortheiterationcountwasreached. Avalueof3indicatesthatthe
(preconditioned)matrixwasfoundnottobepositivedeﬁnite.
 relres s istheratioof the ﬁnalresidualtoitsinitialvalue,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
residualnormisdeﬁnedasnorm(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
deﬁniteAandm,andtheuserisresponsibleforverifyingthisassumption.
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)isdeﬁnedasafunction
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
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;ifpcrﬁndsAtobenumeri-
callysingular,youwillgetawarningmessageandtheﬂagoutputparameterwill
beset.
 bistherighthandsidevector.
 tolistherequiredrelativetolerancefortheresidualerror,b-A*x. . Theitera-
tionstopsifnorm(b-A*x)<=tol*norm(b-A*x0). Iftolisemptyoris
omitted,thefunctionsetstol=1e-6bydefault.
 maxitisthemaximumallowablenumberofiterations;if[]issuppliedformaxit,
 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
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.
 ﬂagreportsontheconvergence.flag=0meansthesolutionconvergedandthe
tolerancecriteriongivenbytolissatisﬁed. flag=1meansthatthemaxitlimit
fortheiterationcountwas reached. . flag=3reportsapcrbreakdown,see[1]
fordetails.
 relres s istheratioof the ﬁnalresidualtoitsinitialvalue,measuredinthe Eu-
clideannorm.
 iter r istheactualnumberofiterationsperformed.
 resvecdescribestheconvergencehistoryofthemethod,sothatresvec(i)con-
tains theEuclideannorms of the residualafter the (i-1)-thiteration,i=1,2,
...,iter+1.
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)isdeﬁnedasafunction
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*
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
Thefactorizationmaybemodiﬁedbypassingoptionsinastructureopts.Theoption
name is s a a ﬁeld of the structure and the setting is the value of ﬁeld. . Names s and
speciﬁersarecasesensitive.
Chapter22: SparseMatrices
553
type
Typeoffactorization.
"nofill"(default)
IncompleteCholeskyfactorizationwithnoﬁll-in(IC(0)).
"ict"
Incomplete Cholesky factorization withthreshold dropping
(ICT).
diagcomp Anon-negativescalaralphaforincompleteCholeskyfactorizationofA+
positivedeﬁnite.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
ModiﬁedincompleteCholeskyfactorization:
"off"(default)
Rowandcolumnsumsarenotnecessarilypreserved.
"on"
ThediagonalofLismodiﬁedsothatrow(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
deﬁnitematrixwiththefullCholeskydecompositionandwiththeincompleteone.