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>m+n.

AutomaticDifferentiationhastwobasicmodesofoperations,theforwardmodeand

orwardmodethederivativesarepropagatedthroughoutthe


本文标签: 霹雳 作者 裂变