asp.net c# pdf viewer : How to split pdf file by pages application Library utility azure asp.net html visual studio octave54-part524

Chapter22: SparseMatrices
525
Ifmor narenotspecifiedtheirvaluesarederivedfromthemaximumindexinthe
vectorsiandjasgivenbym=max(i),n=max(j).
Note: if f multiple values are specifiedwiththe same i,j indices,thecorresponding
valueins willbe the sumofthevalues at the repeatedlocation. . See e accumarray
for anexampleofhow to producedifferent behavior,suchas takingtheminimum
instead.
Iftheoption"unique"isgiven,andmorethanonevalueisspecifiedatthesamei,j
indices,thenthelastspecifiedvaluewillbeused.
sparse(m,n)willcreateanemptymxnsparsematrixandisequivalenttosparse
([],[],[],m,n)
Theargumentnzmaxisignoredbutacceptedforcompatibilitywithmatlab.
Example1(sumatrepeatedindices):
i = [1 1 1 2]; ; j = = [1 1 1 2]; sv = = [3 3 4 4 5];
sparse (i, j, , sv, , 3, 4)
)
Compressed Column Sparse e (rows = = 3, , cols s = 4, nnz z = = 2 [17%])
(1, 1) -> > 7
(2, 2) -> > 5
Example2("unique"option):
i = [1 1 1 2]; ; j = = [1 1 1 2]; sv = = [3 3 4 4 5];
sparse (i, j, , sv, , 3, 4, "unique")
)
Compressed Column Sparse e (rows = = 3, , cols s = 4, nnz z = = 2 [17%])
(1, 1) -> > 4
(2, 2) -> > 5
See also: [full], page 524[accumarray], page e 499[spalloc], page e 524[spdiags],
page 521[speye], page e 522[spones], , page e 522[sprand], , page 522[sprandn],
page522,[sprandsym],page523,[spconvert],page525,[spfun],page496.
[FunctionFile]
x = = spconvert
(
m
)
ConvertasimplesparsematrixformateasilygeneratedbyotherprogramsintoOc-
tave’sinternalsparseformat.
Theinputmiseithera3or4columnrealmatrix,containingtherow,column,real,
andimaginary partsof the elements ofthesparsematrix. . Anelement t withazero
realandimaginarypartcanbeusedtoforceaparticularmatrixsize.
Seealso: [sparse],page524.
The above problemofmemory reallocation can be avoidedinoct-files. . However,the
construction of a sparse matrix x fromanoct-file is more complex thancan n be discussed
here. See Appendix A A [External Code e Interface], page819, for a full description of the
techniquesinvolved.
How to split pdf file by pages - 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
pdf file specification; break a pdf file into parts
How to split pdf file by pages - 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 a pdf into parts; break pdf password online
526
GNUOctave
22.1.3 FindingInformationaboutSparseMatrices
Thereareanumberoffunctionsthatallow informationconcerningsparsematricestobe
obtained. Themost t basicofthese isissparse thatidentifies whether aparticular Octave
objectisinfactasparsematrix.
Anotherverybasicfunctionisnnzthatreturnsthenumberofnonzeroentriesthereare
inasparsematrix,whilethefunctionnzmaxreturnstheamountofstorageallocatedtothe
sparsematrix. NotethatOctavetendstocropunusedmemoryatthefirstopportunityfor
sparseobjects.Therearesomecasesofusercreatedsparseobjectswherethevaluereturned
bynzmaxwillnotbethesameasnnz,butingeneraltheywillgivethesameresult. The
functionspstatsreturnssomebasicstatisticsonthecolumnsofasparsematrixincluding
thenumberofelements,themeanandthevarianceofeachcolumn.
[Built-inFunction]
issparse
(
x
)
Returntrueifx isasparsematrix.
Seealso: [ismatrix],page63.
[Built-inFunction]
n = = nnz
(
a
)
Returnthenumberofnonzeroelementsina.
Seealso: [nzmax],page526,[nonzeros],page526,[find],page407.
[FunctionFile]
nonzeros
(
s
)
Returnavectorofthenonzerovaluesofthesparsematrixs.
Seealso: [find],page407,[nnz],page526.
[Built-inFunction]
n = = nzmax
(
SM
)
ReturntheamountofstorageallocatedtothesparsematrixSM.
Note thatOctavetends to cropunusedmemoryat thefirst opportunityfor sparse
objects. Thus,ingeneralthevalueofnzmaxwillbethesameasnnzexceptforsome
casesofuser-createdsparseobjects.
Seealso: [nnz],page526,[spalloc],page524,[sparse],page524.
[FunctionFile]
[count, mean, var] = spstats
(
S
)
[FunctionFile]
[count, mean, var] = spstats
(
S
,
j
)
ReturnthestatsforthenonzeroelementsofthesparsematrixS.
countisthenumberofnonzerosineachcolumn,meanisthemeanofthenonzerosin
eachcolumn,andvar isthevarianceofthenonzerosineachcolumn.
Calledwithtwo input arguments, ifS is thedata andj is thebinnumberfor the
data,compute the stats for eachbin. . Inthis s case,bins cancontaindata values of
zero,whereaswithspstats(S)thezerosmaydisappear.
WhensolvinglinearequationsinvolvingsparsematricesOctavedeterminesthemeansto
solvetheequationbasedonthetypeofthematrix(seeSection22.2[SparseLinearAlgebra],
page540).Octaveprobesthematrixtypewhenthediv(/)orldiv(\)operatorisfirstused
withthematrixandthencachesthetype. Howeverthematrix
type functioncanbeused
todeterminethetypeofthesparsematrixprior touseofthedivorldiv operators. . For
example,
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
C# File: Merge PDF; C# File: Split PDF; C# Page: Insert PDF pages; C# Page: Delete PDF pages; C# Read: PDF Text Extract; C# Read: PDF
split pdf by bookmark; pdf splitter
C# PDF Page Insert Library: insert pages into PDF file in C#.net
a new PDF page into existing PDF document file, RasterEdge C# page using C# .NET, how to reorganize PDF document pages and how to split PDF document in
pdf no pages selected to print; pdf split and merge
Chapter22: SparseMatrices
527
a = = tril (sprandn (1024, 1024, 0.02), , -1) ) ...
+ speye (1024);
matrix_type (a);
ans = Lower
showsthatOctavecorrectlydeterminesthematrixtypeforlowertriangularmatrices. ma-
trix
type can n also be used d to o force e the e type e of a a matrix to be a particular r type. . For
example:
a = = matrix_type e (tril l (sprandn (1024, , ...
1024, 0.02), , -1) ) + speye (1024), "Lower");
Thisallowsthecostofdeterminingthematrixtypetobeavoided. However,incorrectly
definingthematrixtypewillresultinincorrectresultsfromsolutionsoflinearequations,
andsoitisentirelytheresponsibilityoftheusertocorrectlyidentifythematrixtype
Thereareseveralgraphicalmeansoffindingoutinformationaboutsparsematrices.The
firstisthespycommand,whichdisplaysthestructureofthenonzeroelementsofthematrix.
SeeFigure22.1,foranexampleoftheuseofspy.Moreadvancedgraphicalinformationcan
beobtainedwiththetreeplot,etreeplotandgplotcommands.
0
50
100
150
200
0
50
100
150
200
Figure22.1:Structureofsimplesparsematrix.
Oneuseofsparsematricesisingraphtheory,wheretheinterconnectionsbetweennodes
arerepresentedasanadjacencymatrix. Thatis,ifthei-thnodeinagraphisconnectedto
thej-thnode.Thentheij-thnode(andinthecaseofundirectedgraphstheji-thnode)ofthe
sparseadjacencymatrixisnonzero.Ifeachnodeisthenassociatedwithasetofcoordinates,
thenthe gplot commandcanbeusedtographicallydisplaytheinterconnectionsbetween
nodes.
Asatrivialexampleoftheuseofgplotconsidertheexample,
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Moreover, you may use the following VB.NET demo code to insert multiple pages of a PDF file to a PDFDocument object at user-defined position.
c# split pdf; break a pdf password
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
Ability to remove consecutive pages from PDF file in VB.NET. Enable specified pages deleting from PDF in Visual Basic .NET class.
cannot print pdf no pages selected; break apart a pdf
528
GNUOctave
A = = sparse ([2,6,1,3,2,4,3,5,4,6,1,5],
[1,1,2,2,3,3,4,4,5,5,6,6],1,6,6);
xy = = [0,4,8,6,4,2;5,0,5,7,5,7]’;
gplot (A,xy)
whichcreatesanadjacencymatrixAwherenode1is connectedtonodes 2and6,node2
withnodes1and3,etc. Thecoordinatesofthenodesaregiveninthen-by-2matrix x xy.
SeeFigure22.2.
0
1
2
3
4
5
6
7
0
1
2
3
4
5
6
7
8
Figure22.2:Simpleuseofthegplotcommand.
The dependencies betweenthenodes of aCholeskyfactorizationcanbe calculatedin
lineartimewithoutexplicitlyneedingtocalculatetheCholeskyfactorizationbytheetree
command. Thiscommandreturnstheeliminationtreeofthematrixandcanbedisplayed
graphicallybythecommandtreeplot(etree(A))ifAissymmetricortreeplot(etree
(A+A’))otherwise.
[FunctionFile]
spy
(
x
)
[FunctionFile]
spy
(...,
markersize
)
[FunctionFile]
spy
(...,
line_spec
)
Plotthesparsitypatternofthesparsematrixx.
Iftheargumentmarkersizeisgivenasascalarvalue,itisusedtodeterminethepoint
sizeintheplot.
Ifthestringline
specisgivenitispassedtoplotanddeterminestheappearanceof
theplot.
Seealso: [plot],page274,[gplot],page529.
[LoadableFunction]
p = = etree
(
S
)
[LoadableFunction]
p = = etree
(
S
,
typ
)
[LoadableFunction]
[p, q] ] = = etree
(
S
,
typ
)
ReturntheeliminationtreeforthematrixS.
C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
Ability to remove a range of pages from PDF file. Description: Delete consecutive pages from the input PDF file starting at specified position. Parameters:
can print pdf no pages selected; break pdf into pages
VB.NET PDF File Compress Library: Compress reduce PDF size in vb.
Also able to uncompress PDF file in VB.NET programs. Offer flexible and royalty-free developing library license for VB.NET programmers to compress PDF file.
pdf separate pages; split pdf into multiple files
Chapter22: SparseMatrices
529
Bydefault Sisassumedtobesymmetricandthesymmetriceliminationtreeis re-
turned. Theargumenttypcontrolswhetherasymmetricorcolumneliminationtreeis
returned.Validvaluesoftypare"sym"or"col",forsymmetricorcolumnelimination
treerespectively.
Calledwitha secondargument,etree alsoreturns the postorder permutationson
thetree.
[FunctionFile]
etreeplot
(
A
)
[FunctionFile]
etreeplot
(
A
,
node_style
,
edge_style
)
PlottheeliminationtreeofthematrixAorA+A’ifAinnotsymmetric.
Theoptionalparametersnode
styleandedge
style definetheoutputstyle.
Seealso: [treeplot],page529,[gplot],page529.
[FunctionFile]
gplot
(
A
,
xy
)
[FunctionFile]
gplot
(
A
,
xy
,
line_style
)
[FunctionFile]
[x, y] ] = = gplot
(
A
,
xy
)
PlotagraphdefinedbyAandxy inthegraphtheorysense.
A is s the adjacency matrix of the array y to o be plotted and xy y is an n-by-2 2 matrix
containingthecoordinatesofthenodesofthegraph.
Theoptionalparameterline
styledefinestheoutputstylefortheplot. Calledwith
nooutputargumentsthegraphisplotteddirectly.Otherwise,returnthecoordinates
oftheplotinxandy.
Seealso: [treeplot],page529,[etreeplot],page529,[spy],page528.
[FunctionFile]
treeplot
(
tree
)
[FunctionFile]
treeplot
(
tree
,
node_style
,
edge_style
)
Produceagraphoftreeorforest.
Thefirstargumentisvectorofpredecessors.
Theoptionalparametersnode
styleandedge
style definetheoutputplotstyle.
ThecomplexityofthealgorithmisO(n)intermsofistimeandmemoryrequirements.
Seealso: [etreeplot],page529,[gplot],page529.
[FunctionFile]
treelayout
(
tree
)
[FunctionFile]
treelayout
(
tree
,
permutation
)
treelayoutlaysoutatreeoraforest.
Thefirstargumenttreeisavectorofpredecessors.
Theparameterpermutationisanoptionalpostorderpermutation.
ThecomplexityofthealgorithmisO(n)intermsoftimeandmemoryrequirements.
Seealso: [etreeplot],page529,[gplot],page529,[treeplot],page529.
22.1.4 BasicOperatorsandFunctionsonSparseMatrices
VB.NET PDF File Merge Library: Merge, append PDF files in vb.net
Combine multiple specified PDF pages in into single one file. Able to integrate VB.NET PDF Merging control to both .NET WinForms application and ASP.NET project
acrobat separate pdf pages; a pdf page cut
C# PDF File Compress Library: Compress reduce PDF size in C#.net
size PDF document of 1000+ pages to smaller one in a short time while without losing high image quality. Easy to compress & decompress PDF document file in .NET
can't cut and paste from pdf; break pdf documents
530
GNUOctave
22.1.4.1 SparseFunctions
Many Octavefunctions havebeenoverloadedtoworkwitheithersparseor fullmatrices.
Thereisnodifferenceincallingconventionwhenusinganoverloadedfunctionwithasparse
matrix,however,thereisalsonoaccesstopotentiallysparse-specificfeatures.Atanytime
thesparsematrixspecificversionofafunctioncanbeusedbyexplicitlycallingitsfunction
name.
ThetablebelowlistsallofthesparsefunctionsofOctave. Notethatthenamesofthe
specificsparseformsofthefunctionsaretypicallythesameasthegeneralversionswitha
spprefix. Inthetablebelow,andintherestofthisarticle,thespecificsparseversionsof
functionsareused.
Generatesparsematrices:
spalloc,spdiags,speye,sprand,sprandn,sprandsym
Sparsematrixconversion:
full,sparse,spconvert
Manipulatesparsematrices
issparse,nnz,nonzeros,nzmax,spfun,spones,spy
GraphTheory:
etree,etreeplot,gplot,treeplot
Sparsematrixreordering:
amd,ccolamd,colamd,colperm,csymamd,dmperm,symamd,randperm,sym-
rcm
Linearalgebra:
condest,eigs,matrix
type,normest,sprank,spaugment,svds
Iterativetechniques:
ichol,ilu,pcg,pcr
Miscellaneous:
spparms,symbfact,spstats
InadditionallofthestandardOctavemapperfunctions(i.e.,basicmathfunctionsthat
takeasingleargument)suchasabs,etc.canacceptsparsematrices.Thereaderisreferred
tothedocumentationsuppliedwiththesefunctionswithinOctaveitselfforfurtherdetails.
22.1.4.2 ReturnTypesofOperatorsandFunctions
Thetwobasicreasonstousesparsematricesaretoreducethememoryusageandtonothave
todocalculationsonzeroelements. Thetwoareclosely y relatedinthat the computation
timeonasparsematrixoperatororfunctionisroughlylinearwiththenumberofnonzero
elements.
Therefore,thereisacertaindensityofnonzeroelementsofamatrixwhereitnolonger
makes sense tostore it as a sparsematrix,but rather as a fullmatrix. . For r this reason
operatorsandfunctionsthathaveahighprobabilityofreturningafullmatrixwillalways
returnone. For r example adding ascalar constanttoa sparse matrix willalmost always
makeitafullmatrix,andsotheexample,
Chapter22: SparseMatrices
531
speye (3) ) + + 0
)
1 0 0 0
0 1 1 0
0 0 0 1
returnsafullmatrixascanbeseen.
Additionally, if sparse_auto_mutate e is true, , all sparse functions test t the amount of
memoryoccupiedbythesparsematrixtoseeiftheamountofstorageusedislargerthan
theamountusedbythefullequivalent. Thereforespeye(2)*1willreturnafullmatrix
asthememoryusedissmallerforthefullversionthanthesparseversion.
Asallof themixedoperators andfunctionsbetweenfullandsparsematricesexist,in
generalthisdoesnotcauseanyproblems.However,oneareawhereitdoescauseaproblem
iswhereasparsematrixispromotedtoafullmatrix,wheresubsequentoperationswould
resparsify the matrix. . Such h cases are rare, , but t can n be e artificially created, , for r example
(fliplr(speye(3))+speye(3))-speye(3)givesafullmatrixwhenitshouldgivea
sparseone.Ingeneral,wheresuchcasesoccur,theyimposeonlyasmallmemorypenalty.
Thereishowever oneknowncasewherethisbehavior ofOctave’ssparsematriceswill
causeaproblem. That t isinthe handling ofthe diag g function. . Whether r diag returns a
sparseorfullmatrixdependingonthetypeofitsinputarguments. So
a = = diag (sparse e ([1,2,3]), -1);
shouldreturnasparsematrix. Toensurethisactuallyhappens,thesparse e function,and
otherfunctionsbasedonitlikespeye,alwaysreturnsasparsematrix,evenifthememory
usedwillbelargerthanitsfullrepresentation.
[Built-inFunction]
val = = sparse_auto_mutate
()
[Built-inFunction]
old_val = sparse_auto_mutate
(
new_val
)
[Built-inFunction]
sparse_auto_mutate
(
new_val
,
"
local
"
)
Query or set theinternalvariable that controls whether Octave will l automatically
mutatesparsematricestofullmatricestosavememory.
Forexample:
s = speye (3);
sparse_auto_mutate (false);
s(:, 1) = 1;
typeinfo (s)
) sparse e matrix
sparse_auto_mutate (true);
s(1, :) = 1;
typeinfo (s)
) matrix
Whencalledfrominsideafunctionwiththe"local"option,thevariableischanged
locally for thefunctionandany subroutines itcalls. . The e originalvariablevalue is
restoredwhenexitingthefunction.
Notethatthesparse_auto_mutate optionisincompatiblewithmatlab,andsoitis
offbydefault.
532
GNUOctave
22.1.4.3 MathematicalConsiderations
Theattempthasbeenmadetomakesparsematricesbehaveinexactlythesamemanner
astherefullcounterparts.However,therearecertaindifferencesandespeciallydifferences
withotherproductssparseimplementations.
First,the"./"and".^"operatorsmustbeusedwithcare.Considerwhattheexamples
s = speye (4);
a1 = = s .^ 2;
a2 = = s .^ s;
a3 = = s .^ -2;
a4 = = s ./ 2;
a5 = = 2 ./ s;
a6 = = s ./ s;
willgive. Thefirstexampleofs s raisedtothepowerof2causesnoproblems. . However r s
raisedelement-wisetoitselfinvolvesalargenumberofterms0.^0whichis1. Theres.^
sisafullmatrix.
Likewises.^-2involvestermslike0.^-2whichisinfinity,andsos.^-2isequally
afullmatrix.
For the "./"operator s./2 has noproblems,but2./s involves alarge number of
infinitytermsaswellandisequallyafullmatrix. Thecaseofs./sinvolvestermslike0
./0whichisaNaNandsothisisequallyafullmatrix withthe zeroelementsofs filled
withNaNvalues.
The abovebehavior is consistentwithfullmatrices,but is notconsistentwithsparse
implementationsinotherproducts.
Aparticularproblemofsparsematricescomesaboutduetothefactthatasthezeros
arenotstored,thesign-bitofthesezerosisequallynotstored.Incertaincasesthesign-bit
ofzeroisimportant.Forexample:
a = = 0 0 ./ / [-1, , 1; 1, , -1];
b = = 1 1 ./ / a
) -Inf
Inf
Inf
-Inf
c = = 1 1 ./ / sparse e (a)
)
Inf
Inf
Inf
Inf
Tocorrectthisbehaviorwouldmeanthatzeroelementswithanegativesign-bitwould
needtobestoredinthematrixtoensurethattheirsign-bitwasrespected.Thisisnotdone
atthistime,forreasonsofefficiency,andsotheuseriswarnedthatcalculationswherethe
sign-bitofzeroisimportantmustnotbedoneusingsparsematrices.
In general any y function n or r operator used on n a a sparse e matrix will l result in a a sparse
matrix withthe same or a larger number ofnonzero elements thanthe originalmatrix.
Thisisparticularlytruefortheimportantcaseofsparsematrixfactorizations. Theusual
way to address this s is s toreorder the matrix, , suchthat its factorization is s sparser than
thefactorizationoftheoriginalmatrix. Thatis s thefactorizationofL*U=P*S*Qhas
sparsertermsLandUthantheequivalentfactorizationL*U=S.
Chapter22: SparseMatrices
533
Several functions s are available to reorder dependingon n the type of thematrix x to be
factorized.Ifthematrixissymmetricpositive-definite,thensymamdorcsymamdshouldbe
used. Otherwiseamd,colamdorccolamdshouldbeused.Forcompletenessthereordering
functionscolpermandrandpermarealsoavailable.
SeeFigure22.3,foranexampleofthestructureofasimplepositivedefinitematrix.
0
50
100
150
200
0
50
100
150
200
Figure22.3:Structureofsimplesparsematrix.
ThestandardCholesky factorizationofthis matrixcanbeobtainedbythesamecom-
mandthatwouldbeusedforafullmatrix. Thiscanbevisualizedwiththecommandr=
chol(A);spy(r);. See Figure22.4. Theoriginalmatrixhad598nonzeroterms,while
thisCholeskyfactorizationhas10200,withonlyhalfofthesymmetricmatrixbeingstored.
Thisisasignificantleveloffillin,andalthoughnotanissueforsuchasmalltestcase,can
representsalargeoverheadinworkingwithothersparsematrices.
The appropriate e sparsity preserving permutation of the original matrix is given by
symamdandthefactorizationusingthisreorderingcanbevisualizedusingthecommand
q=symamd(A);r=chol(A(q,q));spy(r). This s gives 399nonzero terms whichis s a
significantimprovement.
The Cholesky factorization n itself f can n be e used to determine the e appropriate e sparsity
preserving reordering of the matrix during the factorization, In that case this might be
obtainedwiththreereturnargumentsas[r,p,q]=chol(A);spy(r).
534
GNUOctave
0
50
100
150
200
0
50
100
150
200
Figure22.4:StructureoftheunpermutedCholeskyfactorizationoftheabovematrix.
0
50
100
150
200
0
50
100
150
200
Figure22.5:StructureofthepermutedCholeskyfactorizationoftheabovematrix.
Inthecaseofanasymmetricmatrix,theappropriatesparsitypreservingpermutationis
colamdandthefactorizationusingthisreorderingcanbevisualizedusingthecommandq
=colamd(A);[l,u,p]=lu(A(:,q));spy(l+u).
Finally,Octaveimplicitly reordersthematrixwhenusingthe div(/)andldiv (\) op-
erators, and so no the user r does not need d to explicitly y reorder the matrix x to o maximize
performance.
Documents you may be interested
Documents you may be interested