Chapter16: MatrixManipulation
415
[s, i] = = sort ([1, , 2; 2, , 3; 3, 1])
) s s = = 1 1 1
2 2
3 3
) i i = = 1 1 3
2 1
3 2
Forequalelements,theindicesaresuchthatequalelementsarelistedintheorderin
whichtheyappearedintheoriginallist.
Sortingofcomplex entries isdonefirstbymagnitude(abs(z)) andforanyties by
phaseangle(angle(z)). Forexample:
sort ([1+i; 1; 1-i])
) 1 1 + + 0i
1 - - 1i
1 + + 1i
NaNvaluesaretreatedas beinggreaterthananyothervalueandaresortedtothe
endofthelist.
Thesortfunctionmayalsobeusedtosortstringsandcellarraysofstrings,inwhich
caseASCIIdictionaryorder(uppercase’A’precedes lowercase’a’)ofthestrings is
used.
Thealgorithmusedinsortisoptimizedforthesortingofpartiallyorderedlists.
Seealso: [sortrows],page415,[issorted],page415.
[FunctionFile]
[s, i] ] = = sortrows
(
A
)
[FunctionFile]
[s, i] ] = = sortrows
(
A
,
c
)
SorttherowsofthematrixAaccordingtotheorderofthecolumnsspecifiedinc.
Ifc is s omitted,a lexicographical l sort t is used. . By y default ascendingorder is used
however if elements s of f c c are e negative then the corresponding column is s sorted in
descendingorder.
Seealso: [sort],page414.
[Built-inFunction]
issorted
(
a
)
[Built-inFunction]
issorted
(
a
,
mode
)
[Built-inFunction]
issorted
(
a
,
"
rows
"
,
mode
)
Return true e if f the array is s sorted d according g to mode, , which h may be e either
"ascending","descending",or"either".
Bydefault,modeis"ascending".NaNsaretreatedinthesamemannerassort.
Ifthe optionalargument "rows" is supplied, check whether the array is sortedby
rowsasoutputbythefunctionsortrows(withnooptions).
Thisfunctiondoesnotsupportsparsematrices.
Seealso: [sort],page414,[sortrows],page415.
[Built-inFunction]
nth_element
(
x
,
n
)
[Built-inFunction]
nth_element
(
x
,
n
,
dim
)
Selectthen-thsmallestelementofavector,usingtheorderingdefinedbysort.
Pdf insert page break - 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
split pdf into multiple files; acrobat split pdf bookmark
Pdf insert page break - 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 into single pages; can't cut and paste from pdf
416
GNUOctave
Theresultisequivalenttosort(x)(n).
ncanalsobeacontiguousrange,eitherascendingl:uordescendingu:-1:l,inwhich
casearangeofelementsisreturned.
Ifx is anarray,nth_element operatesalongthedimensiondefinedby dim,or the
firstnon-singletondimensionifdimisnotgiven.
ProgrammingNote: nth
elementencapsulatestheC++ standardlibrary algorithms
nth
element and partial
sort. On n average, , the complexity y of the operation n is
O(M*log(K)), where e M=size(x,dim) and K=length(n). . This s function n is
intendedforcaseswheretheratioK/Missmall;otherwise,itmaybebettertouse
sort.
Seealso: [sort],page414,[min],page445,[max],page444.
[FunctionFile]
tril
(
A
)
[FunctionFile]
tril
(
A
,
k
)
[FunctionFile]
tril
(
A
,
k
,
pack
)
[FunctionFile]
triu
(
A
)
[FunctionFile]
triu
(
A
,
k
)
[FunctionFile]
triu
(
A
,
k
,
pack
)
Returnanewmatrixformedbyextractingthelower(tril)orupper(triu)triangular
partofthematrixA,andsettingallotherelementstozero.
Thesecondargumentisoptional,andspecifieshowmanydiagonalsaboveorbelow
themaindiagonalshouldalsobesettozero.
The default value of k k is s zero, , so that t triu andtril normally include the main
diagonalaspartoftheresult.
Ifthevalueofk is s nonzerointeger, , theselectionofelements s starts at anoffset of
k diagonals s above or belowthe maindiagonal;above forpositive k andbelow for
negativek.
The absolute value of k k must not t be greater r thanthe e number r of f subdiagonals s or
superdiagonals.
Forexample:
tril (ones (3), -1)
)
0 0 0 0
1 0 0 0
1 1 1 0
and
tril (ones (3), 1)
)
1 1 1 0
1 1 1 1
1 1 1 1
If the e option n "pack" is given as third argument, , the extracted d elements are e not
insertedintoamatrix,butratherstackedcolumn-wiseoneaboveother.
Seealso: [diag],page417.
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Offer PDF page break inserting function. This demo will help you to insert a PDF page to a PDFDocument object at specified position in VB.NET program.
break a pdf into parts; pdf split pages in half
C# PDF Page Insert Library: insert pages into PDF file in C#.net
Offer PDF page break inserting function. NET PDF document editor library control, RasterEdge XDoc.PDF, offers easy APIs for developers to add & insert an (empty
break pdf into multiple documents; pdf print error no pages selected
Chapter16: MatrixManipulation
417
[Built-inFunction]
v = = vec
(
x
)
[Built-inFunction]
v = = vec
(
x
,
dim
)
Returnthevectorobtainedbystackingthecolumns ofthematrix x oneabovethe
other.
Withoutdimthisisequivalenttox(:).
Ifdimissupplied,thedimensionsofv aresettodimwithallelementsalongthelast
dimension. Thisisequivalenttoshiftdim(x(:),1-dim).
Seealso: [vech],page417,[resize],page412,[cat],page410.
[FunctionFile]
vech
(
x
)
Returnthevectorobtainedbyeliminatingallsuperdiagonalelementsofthesquare
matrixxandstackingtheresultonecolumnabovetheother.
This has uses inmatrix calculus wherethe underlyingmatrix is symmetric and d it
wouldbepointlesstokeepvaluesabovethemaindiagonal.
Seealso: [vec],page417.
[FunctionFile]
prepad
(
x
,
l
)
[FunctionFile]
prepad
(
x
,
l
,
c
)
[FunctionFile]
prepad
(
x
,
l
,
c
,
dim
)
Prependthescalarvaluectothevectorx untilitisoflengthl. . Ifcisnotgiven,a
valueof0isused.
Iflength(x)>l,elements fromthebeginningofx x areremoveduntilavector r of
lengthlisobtained.
Ifxisamatrix,elementsareprependedorremovedfromeachrow.
Iftheoptionalargumentdimisgiven,operatealongthisdimension.
Ifdimislargerthanthedimensionsofx,theresultwillhavedimdimensions.
Seealso: [postpad],page417,[cat],page410,[resize],page412.
[FunctionFile]
postpad
(
x
,
l
)
[FunctionFile]
postpad
(
x
,
l
,
c
)
[FunctionFile]
postpad
(
x
,
l
,
c
,
dim
)
Appendthescalarvaluec tothevectorx untilitisoflengthl. . Ifc c isnotgiven,a
valueof0isused.
Iflength(x)>l,elementsfromtheendofx areremoveduntilavectoroflengthl
isobtained.
Ifxisamatrix,elementsareappendedorremovedfromeachrow.
Iftheoptionalargumentdimisgiven,operatealongthisdimension.
Ifdimislargerthanthedimensionsofx,theresultwillhavedimdimensions.
Seealso: [prepad],page417,[cat],page410,[resize],page412.
[Built-inFunction]
M = = diag
(
v
)
[Built-inFunction]
M = = diag
(
v
,
k
)
[Built-inFunction]
M = = diag
(
v
,
m
,
n
)
[Built-inFunction]
v = = diag
(
M
)
C# PDF Convert: How to Convert Jpeg, Png, Bmp, & Gif Raster Images
Success"); break; case ConvertResult.FILE_TYPE_UNSUPPORT: Console.WriteLine("Fail: can not convert to PDF, file type unsupport"); break; case ConvertResult
a pdf page cut; break a pdf
C# Image Convert: How to Convert Word to Jpeg, Png, Bmp, and Gif
RasterEdge.XDoc.PDF.dll. is not a document"); default: Console.WriteLine("Fail: unknown error"); break; }. This demo code just convert first word page to Png
break apart pdf pages; split pdf by bookmark
418
GNUOctave
[Built-inFunction]
v = = diag
(
M
,
k
)
Returnadiagonalmatrixwithvectorv ondiagonalk.
Thesecondargumentis optional. . Ifitis s positive, , the vectoris s placedonthe k-th
superdiagonal. Ifit t is negative,it is placedonthe -k-thsubdiagonal. . The e default
valueofkis0,andthevectorisplacedonthemaindiagonal. Forexample:
diag ([1, 2, 3], , 1)
)
0 1 0 0
0 0 2 0
0 0 0 3
0 0 0 0
The3-inputformreturnsadiagonalmatrixwithvectorv onthemaindiagonaland
theresultingmatrixbeingofsizemrowsxncolumns.
Givenamatrixargument,insteadofavector,diagextractsthek-thdiagonalofthe
matrix.
[FunctionFile]
blkdiag
(
A
,
B
,
C
,...)
BuildablockdiagonalmatrixfromA,B,C,...
Allargumentsmust be numericandeither two-dimensionalmatricesorscalars. . If
anyargumentisoftypesparse,theoutputwillalsobesparse.
Seealso:[diag],page417,[horzcat],page411,[vertcat],page411,[sparse],page524.
16.3 SpecialUtilityMatrices
[Built-inFunction]
eye
(
n
)
[Built-inFunction]
eye
(
m
,
n
)
[Built-inFunction]
eye
(
[mn]
)
[Built-inFunction]
eye
(...,
class
)
Returnanidentitymatrix.
Ifinvokedwithasinglescalarargumentn,returnasquareNxNidentitymatrix.
Ifsuppliedtwoscalar arguments(m,n),eyetakes themtobethenumber ofrows
andcolumns.Ifgivenavectorwithtwoelements,eyeusesthevaluesoftheelements
asthenumberofrowsandcolumns,respectively. Forexample:
eye (3)
)
1 0 0
0 1 0
0 0 1
Thefollowingexpressionsallproducethesameresult:
eye (2)
eye (2, 2)
eye (size ([1, 2; 3, 4]))
Theoptionalargumentclass,allowseyetoreturnanarrayofthespecifiedtype,like
C# TWAIN - Query & Set Device Abilities in C#
device.TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE) device.TransferMethod = method; } // If it's not supported tell stop.
acrobat split pdf pages; break pdf into pages
C# TWAIN - Install, Deploy and Distribute XImage.Twain Control
are three parts on this page, including system RasterEdge.XDoc.PDF.dll. device. TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE
cannot select text in pdf file; break pdf file into parts
Chapter16: MatrixManipulation
419
val = = zeros s (n,m, "uint8")
Callingeyewithnoargumentsisequivalenttocallingitwithanargumentof1.Any
negativedimensionsaretreatedaszero. Theseodddefinitionsareforcompatibility
withmatlab.
Seealso: [speye],page522,[ones],page419,[zeros],page419.
[Built-inFunction]
ones
(
n
)
[Built-inFunction]
ones
(
m
,
n
)
[Built-inFunction]
ones
(
m
,
n
,
k
,...)
[Built-inFunction]
ones
(
[mn
...
]
)
[Built-inFunction]
ones
(...,
class
)
ReturnamatrixorN-dimensionalarraywhoseelementsareall1.
Ifinvokedwithasinglescalarintegerargumentn,returnasquareNxNmatrix.
Ifinvokedwithtwoor morescalarinteger arguments,oravectorofintegervalues,
returnanarraywiththegivendimensions.
Tocreateaconstantmatrixwhosevaluesareallthesameuseanexpressionsuchas
val_matrix = val l * * ones (m, , n)
Theoptionalargument class s specifies s theclass ofthe returnarrayanddefaults to
double. Forexample:
val = = ones s (m,n, , "uint8")
Seealso: [zeros],page419.
[Built-inFunction]
zeros
(
n
)
[Built-inFunction]
zeros
(
m
,
n
)
[Built-inFunction]
zeros
(
m
,
n
,
k
,...)
[Built-inFunction]
zeros
(
[mn
...
]
)
[Built-inFunction]
zeros
(...,
class
)
ReturnamatrixorN-dimensionalarraywhoseelementsareall0.
Ifinvokedwithasinglescalarintegerargument,returnasquareNxNmatrix.
Ifinvokedwithtwoor morescalarinteger arguments,oravectorofintegervalues,
returnanarraywiththegivendimensions.
Theoptionalargument class s specifies s theclass ofthe returnarrayanddefaults to
double. Forexample:
val = = zeros s (m,n, "uint8")
Seealso: [ones],page419.
[FunctionFile]
repmat
(
A
,
m
)
[FunctionFile]
repmat
(
A
,
m
,
n
)
[FunctionFile]
repmat
(
A
,
m
,
n
,
p
...)
[FunctionFile]
repmat
(
A
,
[mn]
)
[FunctionFile]
repmat
(
A
,
[mnp
...
]
)
Formablockmatrixofsizembyn,withacopyofmatrixAaseachelement.
Ifnisnotspecified,formanmbymblockmatrix.Forcopyingalongmorethantwo
dimensions,specifythenumberoftimestocopyacrosseachdimensionm,n,p,...,
inavectorinthesecondargument.
C# TWAIN - Specify Size and Location to Scan
connection can be found at this tutorial page of how in frames) { if (frame == TwainStaticFrameSizeType.LetterUS) { this.device.FrameSize = frame; break; } } }.
acrobat split pdf into multiple files; break apart a pdf in reader
C# TWAIN - Acquire or Save Image to File
RasterEdge.XDoc.PDF.dll. if (device.Compression != TwainCompressionMode.Group4) device.Compression = TwainCompressionMode.Group3; break; } } acq.FileTranfer
cannot print pdf file no pages selected; can't select text in pdf file
420
GNUOctave
Seealso: [repelems],page420.
[Built-inFunction]
repelems
(
x
,
r
)
Constructavectorofrepeatedelementsfromx.
r is s a 2xN N integer r matrix x specifying which h elements s to o repeat t and how often n to
repeateachelement. Entriesinthefirstrow,r(1,j),selectanelementtorepeat. The
correspondingentryinthe secondrow, r(2,j), specifiesthe repeat count. . If f x x is s a
matrix thenthecolumns of x x areimaginedto o be stackedontop ofeachotherfor
purposesoftheselectionindex.Arowvectorisalwaysreturned.
Conceptuallytheresultiscalculatedasfollows:
y = [];
for i i = = 1:columns (r)
y = = [y, , x(r(1,i)*ones(1, r(2,i)))];
endfor
Seealso: [repmat],page419,[cat],page410.
Thefunctionslinspaceandlogspacemakeitveryeasytocreatevectorswithevenly
orlogarithmicallyspacedelements. SeeSection4.2[Ranges],page52.
[Built-inFunction]
linspace
(
base
,
limit
)
[Built-inFunction]
linspace
(
base
,
limit
,
n
)
Returnarowvectorwithnlinearlyspacedelementsbetweenbaseandlimit.
Ifthenumberofelementsisgreaterthanone,thentheendpointsbaseandlimitare
alwaysincludedintherange.Ifbaseisgreaterthanlimit,theelementsarestoredin
decreasingorder.Ifthenumberofpointsisnotspecified,avalueof100isused.
Thelinspacefunctionalwaysreturnsarowvectorifbothbaseandlimitarescalars.
Ifone,orboth,ofthemarecolumnvectors,linspacereturnsamatrix.
Forcompatibilitywithmatlab,returnthesecondargument(limit)iffewerthantwo
valuesarerequested.
Seealso: [logspace],page420.
[FunctionFile]
logspace
(
a
,
b
)
[FunctionFile]
logspace
(
a
,
b
,
n
)
[FunctionFile]
logspace
(
a
,pi,
n
)
Returnarowvectorwithnelementslogarithmicallyspacedfrom10
a
to10
b
.
Ifnisunspecifieditdefaultsto50.
Ifbisequalto,thepointsarebetween10
a
and,not 10
a
and10
,inordertobe
compatiblewiththecorrespondingmatlabfunction.
Alsoforcompatibilitywithmatlab,returnthesecondargumentbiffewerthantwo
valuesarerequested.
Seealso: [linspace],page420.
[Built-inFunction]
rand
(
n
)
[Built-inFunction]
rand
(
m
,
n
,...)
[Built-inFunction]
rand
(
[mn
...
]
)
Chapter16: MatrixManipulation
421
[Built-inFunction]
v = = rand
(
"
state
"
)
[Built-inFunction]
rand
(
"
state
"
,
v
)
[Built-inFunction]
rand
(
"
state
"
,
"
reset
"
)
[Built-inFunction]
v = = rand
(
"
seed
"
)
[Built-inFunction]
rand
(
"
seed
"
,
v
)
[Built-inFunction]
rand
(
"
seed
"
,
"
reset
"
)
[Built-inFunction]
rand
(...,
"
single
"
)
[Built-inFunction]
rand
(...,
"
double
"
)
Returnamatrixwithrandomelementsuniformlydistributedontheinterval(0,1).
Theargumentsarehandledthesameastheargumentsforeye.
Youcanquerythestateoftherandomnumbergeneratorusingtheform
v = rand d ("state")
This returnsa columnvector v v oflength625. . Later, , youcanrestore therandom
numbergeneratortothestatevusingtheform
rand ("state", v)
Youmayalsoinitializethestatevectorfromanarbitraryvectoroflength625for
v. Thisnewstatewillbeahashbasedonthevalueofv,notv v itself.
Bydefault,thegeneratorisinitializedfrom/dev/urandomifitisavailable,otherwise
fromCPUtime,wallclocktime,andthecurrentfractionofasecond.Notethatthis
differsfrommatlab,whichalwaysinitializesthestatetothesamestateatstartup.
Toobtainbehaviorcomparabletomatlab,initializewithadeterministicstatevector
inOctave’sstartupfiles(seeSection2.1.2[StartupFiles],page19).
Tocompute the pseudo-randomsequence,rand uses the MersenneTwister with a
periodof 2
19937
1 (See M. Matsumoto and T. Nishimura, , Mersenne e Twister: : A
623-dimensionally equidistributed d uniform pseudorandom number r generator, , ACM
Trans. on n Modeling andComputerSimulationVol. . 8,No. . 1, , pp. . 3–30,January
1998, http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html). . Do
notuseforcryptographywithoutsecurelyhashingseveralreturnedvaluestogether,
otherwisethegeneratorstatecanbelearnedafterreading624consecutivevalues.
OlderversionsofOctaveusedadifferentrandomnumbergenerator.Thenewgenera-
torisusedbydefaultasitissignificantlyfasterthantheoldgenerator,andproduces
randomnumbers witha significantly longer cycle time. . However, , insome circum-
stancesit mightbedesirabletoobtainthesame randomsequencesasproducedby
the oldgenerators. . Todothis s the keyword d "seed"is s used d tospecify y thattheold
generatorsshouldbeused,asin
rand ("seed", , val)
whichsetstheseedofthegeneratortoval.Theseedofthegeneratorcanbequeried
with
s = rand d ("seed")
However,it shouldbe notedthat queryingtheseedwillnotcauserand touse the
oldgenerators,onlysettingtheseedwill. Tocause e randtoonceagainusethenew
generators,thekeyword"state"shouldbeusedtoresetthestateoftherand.
The state or r seed of f the generator canbe reset toa new random value usingthe
"reset"keyword.
422
GNUOctave
Theclassofthevaluereturnedcanbecontrolledbyatrailing"double"or"single"
argument.Thesearetheonlyvalidclasses.
Seealso: [randn],page422,[rande],page423,[randg],page424,[randp],page423.
[FunctionFile]
randi
(
imax
)
[FunctionFile]
randi
(
imax
,
n
)
[FunctionFile]
randi
(
imax
,
m
,
n
,...)
[FunctionFile]
randi
(
[iminimax]
,...)
[FunctionFile]
randi
(...,
"class"
)
Returnrandomintegersintherange1:imax.
Additionalargumentsdeterminetheshapeofthereturnmatrix.Whennoarguments
arespecifiedasinglerandomintegerisreturned. Ifoneargumentnisspecifiedthen
a square matrix (nxn) is s returned. . Two o or morearguments will return amulti-
dimensionalmatrix(mxnx...).
The integer r range e may optionally be described d by a a two element t matrix with h a
lower andupper boundinwhichcase thereturnedintegerswillbeon n the interval
[imin,imax].
Theoptionalargumentclasswillreturnamatrixoftherequestedtype. Thedefault
is"double".
Thefollowingexamplereturns150integersintherange1–10.
ri = = randi (10, 150, 1)
ImplementationNote: randireliesinternallyonrandwhichusesclass"double"to
representnumbers. Thislimitsthemaximuminteger(imax)andrange(imax-imin)
tothevalue returnedby theflintmaxfunction. . For r IEEEfloatingpoint numbers
thisvalueis2
53
1.
Seealso: [rand],page420.
[Built-inFunction]
randn
(
n
)
[Built-inFunction]
randn
(
m
,
n
,...)
[Built-inFunction]
randn
(
[mn
...
]
)
[Built-inFunction]
v = = randn
(
"
state
"
)
[Built-inFunction]
randn
(
"
state
"
,
v
)
[Built-inFunction]
randn
(
"
state
"
,
"
reset
"
)
[Built-inFunction]
v = = randn
(
"
seed
"
)
[Built-inFunction]
randn
(
"
seed
"
,
v
)
[Built-inFunction]
randn
(
"
seed
"
,
"
reset
"
)
[Built-inFunction]
randn
(...,
"
single
"
)
[Built-inFunction]
randn
(...,
"
double
"
)
Returnamatrixwithnormallydistributedrandomelementshavingzeromeanand
varianceone.
Theargumentsarehandledthesameastheargumentsforrand.
Bydefault,randnusestheMarsagliaandTsang“Ziggurattechnique”totransform
fromauniformtoanormaldistribution.
Theclassofthevaluereturnedcanbecontrolledbyatrailing"double"or"single"
argument.Thesearetheonlyvalidclasses.
Chapter16: MatrixManipulation
423
Reference:G.MarsagliaandW.W.Tsang,ZigguratMethodforGeneratingRandom
Variables,J.StatisticalSoftware,vol5, 2000, http://www.jstatsoft.org/v05/
i08/
Seealso: [rand],page420,[rande],page423,[randg],page424,[randp],page423.
[Built-inFunction]
rande
(
n
)
[Built-inFunction]
rande
(
m
,
n
,...)
[Built-inFunction]
rande
(
[mn
...
]
)
[Built-inFunction]
v = = rande
(
"
state
"
)
[Built-inFunction]
rande
(
"
state
"
,
v
)
[Built-inFunction]
rande
(
"
state
"
,
"
reset
"
)
[Built-inFunction]
v = = rande
(
"
seed
"
)
[Built-inFunction]
rande
(
"
seed
"
,
v
)
[Built-inFunction]
rande
(
"
seed
"
,
"
reset
"
)
[Built-inFunction]
rande
(...,
"
single
"
)
[Built-inFunction]
rande
(...,
"
double
"
)
Returnamatrixwithexponentiallydistributedrandomelements.
Theargumentsarehandledthesameastheargumentsforrand.
Bydefault,randeusestheMarsagliaandTsang“Ziggurattechnique”totransform
fromauniformtoanexponentialdistribution.
Theclassofthevaluereturnedcanbecontrolledbyatrailing"double"or"single"
argument.Thesearetheonlyvalidclasses.
Reference:G.MarsagliaandW.W.Tsang,ZigguratMethodforGeneratingRandom
Variables,J.StatisticalSoftware,vol5, 2000, http://www.jstatsoft.org/v05/
i08/
Seealso: [rand],page420,[randn],page422,[randg],page424,[randp],page423.
[Built-inFunction]
randp
(
l
,
n
)
[Built-inFunction]
randp
(
l
,
m
,
n
,...)
[Built-inFunction]
randp
(
l
,
[mn
...
]
)
[Built-inFunction]
v = = randp
(
"
state
"
)
[Built-inFunction]
randp
(
"
state
"
,
v
)
[Built-inFunction]
randp
(
"
state
"
,
"
reset
"
)
[Built-inFunction]
v = = randp
(
"
seed
"
)
[Built-inFunction]
randp
(
"
seed
"
,
v
)
[Built-inFunction]
randp
(
"
seed
"
,
"
reset
"
)
[Built-inFunction]
randp
(...,
"
single
"
)
[Built-inFunction]
randp
(...,
"
double
"
)
ReturnamatrixwithPoissondistributedrandomelementswithmeanvalueparam-
etergivenbythefirstargument,l.
Theargumentsarehandledthesameastheargumentsforrand,exceptfortheargu-
mentl.
Fivedifferentalgorithmsareuseddependingontherangeoflandwhetherornotl
isascalaroramatrix.
424
GNUOctave
Forscalarl12,usedirectmethod.
W.H.Press,etal.,NumericalRecipesinC,CambridgeUniversityPress,
1992.
Forscalarl>12,userejectionmethod.[1]
W.H.Press,etal.,NumericalRecipesinC,CambridgeUniversityPress,
1992.
Formatrixl10,useinversionmethod.[2]
E.Stadlober,etal.,WinRandsourcecode,availableviaFTP.
Formatrixl>10,usepatchworkrejectionmethod.
E.Stadlober,etal.,WinRandsourcecode,availableviaFTP,orH.Zech-
ner,Efficientsamplingfromcontinuous anddiscreteunimodaldistribu-
tions,DoctoralDissertation,156pp.,TechnicalUniversityGraz,Austria,
1994.
Forl>1e8,usenormalapproximation.
L.Montanet,etal.,ReviewofParticleProperties,PhysicalReviewD50
p1284,1994.
Theclassofthevaluereturnedcanbecontrolledbyatrailing"double"or"single"
argument.Thesearetheonlyvalidclasses.
Seealso: [rand],page420,[randn],page422,[rande],page423,[randg],page424.
[Built-inFunction]
randg
(
n
)
[Built-inFunction]
randg
(
m
,
n
,...)
[Built-inFunction]
randg
(
[mn
...
]
)
[Built-inFunction]
v = = randg
(
"
state
"
)
[Built-inFunction]
randg
(
"
state
"
,
v
)
[Built-inFunction]
randg
(
"
state
"
,
"
reset
"
)
[Built-inFunction]
v = = randg
(
"
seed
"
)
[Built-inFunction]
randg
(
"
seed
"
,
v
)
[Built-inFunction]
randg
(
"
seed
"
,
"
reset
"
)
[Built-inFunction]
randg
(...,
"
single
"
)
[Built-inFunction]
randg
(...,
"
double
"
)
Returnamatrixwithgamma(a,1)distributedrandomelements.
Theargumentsarehandledthesameastheargumentsforrand,exceptfortheargu-
menta.
Thiscanbeusedtogeneratemanydistributions:
gamma(a,b)fora>-1,b>0
r = b * * randg (a)
beta(a,b)fora>-1,b>-1
r1 = = randg g (a, , 1)
r = r1 / (r1 + randg (b, , 1))
Erlang(a,n)
r = a * * randg (n)
Documents you may be interested
Documents you may be interested