admin 管理员组文章数量: 1086019
2024年4月16日发(作者:霹雳兵烽决之玄象裂变百科)
ADMAT:AutomaticdifferentiationinMATLABusingobject
orientedmethods
∗
ArunVerma
†
Abstract
Diff
solutionofmanyoptimizationproblemsandotherapplicationsrequireknowledgeof
thegradient,theJacobianmatrix,ortheHessianmatrixofagivenfunction.
Automaticdifferentiation(AD)isanupcomingpowerfultechnologyforcomputing
(AutomaticDifferentiationforMATLAB)
implementsADusingtheobjectorientedtechnologyinMATLAB[11]andcancompute
anbeusedasaplug-intoolforADMIT-1
[4]andADMIT-2[5]toolboxes,enablingthecomputationofsparseandstructured
derivativematricesfornonlinearoptimization.
1Introduction
Numericalsolutionsoflargescalenonlinearproblemsinvolvecomputingderivativeinforma-
tionintheformofgradients,JacobianandHessianmatrices,oftenrepeatedly,makingthe
kesitnecessary
tohaveanaccurateandefficientderivativecomputationforthepracticalsolutionoflarge
nonlinearproblems.
Automaticdifferentiationcancomputefastandexact
1
derivativesofanydegree
computationallyviapropagatingTaylorseriescoefficientsusingthechainrule[8].Although
stillinitsformativestages,ADisnowaverypowerfultool(-C[9]and
ADIFOR[1]aretwopopularADtools)especiallywhencoupledwithrecentdevelopments,
tationoftheuserproblemstructure[13,3,2].Thetraditionalmethodsof
obtainingderivativessuchashand-codingorfinitedifferencingsufferincomparisonwith
AD;hand-codingiserror-proneandcanbeimpracticalduetotimerequirementsforthe
codedevelopmentandmaintenancewhilefinitedifferencingoftendoesn’tyieldaccurate
derivativesandmaybeinefficientinmanycases.
ADMATenablesyoutodifferentiatenonlinearmapsdefinedviaM-fi
knowledgethisisthefirstADtoolwrittenfordifferentiatingM-fielongs
tothe“operatoroverloading”classofADtoolsandusestheobjectorientedprogramming
(OOPS)featurepresentinMATLAB5foritsimplementation.
ADMAT:AutomaticDifferentiationInMATLAB2
ADMATcanbeusedasaplug-intoolfortheADMIT-1toolbox[4],enablingthe
computati
isasimpleADMIT-1examplewhichusesADMATforcomputingthesparseJacobianofa
simpletestproblem(myfun.m)whichhasanarrowheadJacobiansparsitypattern:
functiony=myfun(x,Extra)
y=x.∗x;
y(1)=y(1)+x
′
∗x;
y=y+x(1)∗x(1);
end
AssumethisprogramissavedinfiuatethefunctionFandthe
JacobianJatx
′
=(1,1,...,1)forn=5:
>>x=ones(5,1);
>>[f,J]=evalJ(’myfun’,x);
Asillustratedbythisexample,allthedetailsoftheplug-inADtool(ADMAThere)
arecompletelyhiddenfromthetheusersofADMIT-1makingitauserfriendlytool.
§2,wepresentthebasicsofanADtool
§3wepresentthebasicsofdoingADofaMATLAB-like
§4,wepresentalltheimplementationdetailsincludingthedescriptionofthe
derivativeobjectsusedinADMAT.
FormoreinformationaboutADMAT,pleaserefertoourwebsite:
/home/verma/AD/.
2BasicsofaOOPSbasedADtool
Automaticdifferentiationisachain-rule-basedtechniqueforevaluatingthederivativeswith
respecttotheinputvariablesoffunctionsdefi
reliesonthefactthatallcomputerprograms,nomatterhowcomplicated,useafinitesetof
elementary(,sin(.),sqrt(.))operationsasdefinedbytheprogramming
ueorfunctioncomputedbytheprogramissimplyacompositionofthese
tialderivativesoftheelementaryfunctionsareknown,and
theoverallderivativesarecomputedusingthechainrule[8].
Abstractly,theprogramtoevaluateanoutputy(generallyanmvector)asafunction
ofx(generallyannvector)hastheform:
x≡(x
1
,x
2
,...,x
n
)
↓
z≡(z
1
,z
2
,...,z
p
)
↓
y≡(y
1
,y
2
,...,y
n
)
wheretheintermediatevariableszarerelatedthroughaseriesofbinaryoperators,
k
z
k
=f
elem
(z
i
,z
j
),i
AutomaticDifferentiationhastwobasicmodesofoperations,theforwardmodeand
orwardmodethederivativesarepropagatedthroughoutthe
版权声明:本文标题:ADMAT Automatic di#erentiation in MATLAB using object oriented met 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1713249127a625911.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论