FloatingPointOperationsinMatrix-VectorCalculus (Version1.3) RaphaelHunger TechnicalReport 2007 TechnischeUniversitätMünchenAssociateInstituteforSignalProcessing Univ.-Prof.Dr.-Ing.WolfgangUtschick History Version1.00:October2005 -Initialversion Version1.01:2006 -RewriteofsesquilinearformwithareducedamountofFLOPs -SeveralTyposfixedconcerningthenumberofFLOPSrequiredfortheCholeskydecompo- sition Version1.2:November2006 -ConditionsfortheexistenceofthestandardLL H Choleskydecompositionspecified(pos- itivedefiniteness) -OuterproductversionofLL H Choleskydecompositionremoved -FLOPsrequiredinGaxpyversionofLL H Choleskydecompositionupdated -L1 DLH Choleskydecompositionadded 1 -Matrix-matrixproductLCaddedwithLtriangular -Matrix-matrixproductL1 CaddedwithLtriangularandL1 notknownapriori -InverseL1 ofalowertriangularmatrixwithonesonthemaindiagonaladded 1 Version1.3:September2007 -Firstgloballyaccessibledocumentversion ToDo:(unknownwhen) -QR-Decomposition -LR-Decomposition Pleasereportanybugandsuggestiontohunger@tum.de 2 Contents 1. Introduction 4 2. FlopCounting 5 2.1 MatrixProducts.................................... 5 2.1.1 Scalar-VectorMultiplicationa....................... 5 2.1.2 Scalar-MatrixMultiplicationA ...................... 5 2.1.3 InnerProductaH bofTwoVectors...................... 5 2.1.4 OuterProductac H ofTwoVectors...................... 5 2.1.5 Matrix-VectorProductAb.......................... 6 2.1.6 Matrix-MatrixProductAC ......................... 6 2.1.7 MatrixDiagonalMatrixProductAD .................... 6 2.1.8 Matrix-MatrixProductLD ......................... 6 2.1.9 Matrix-MatrixProductL1 D......................... 6 2.1.10 Matrix-MatrixProductLCwithLLowerTriangular............ 6 2.1.11 GramAH AofA............................... 6 2.1.12 SquaredFrobeniusNormkAk2 =tr(AH A) ................ 7F 2.1.13 SesquilinearFormcH Ab........................... 7 2.1.14 HermitianFormaH Ra............................ 7 2.1.15 GramLH LofaLowerTriangularMatrixL................. 7 2.2 Decompositions.................................... 8 2.2.1 CholeskyDecompositionR=LL H (GaxpyVersion) ........... 8 2.2.2 CholeskyDecompositionR=L1 DLH ................... 10 1 2.3 InversesofMatrices.................................. 11 2.3.1 InverseL1 ofaLowerTriangularMatrixL ................ 11 2.3.2 InverseL1 ofaLowerTriangularMatrixL1 1 withOnesontheMainDi- agonal..................................... 12 2.3.3 InverseR1 ofaPositiveDefiniteMatrixR................. 13 2.4 SolvingSystemsofEquations ............................ 13 2.4.1 ProductL1 CwithL1 notknownapriori. ................ 13 3. Overview 14 Appendix 15 Bibliography 16 3 1. Introduction Forthedesignofefficientundlow-complexityalgorithmsinmanysignal-processingtasks,ade- tailedanalysisoftherequirednumberoffloating-pointoperations(FLOPs)isofteninevitable. Mostfrequently,matrixoperationsareinvolved,suchasmatrix-matrixproductsandinversesof matrices.StructureslikeHermitenessortriangularityforexamplecanbeexploitedtoreducethe numberofneededFLOPsandwillbediscussedhere.Inthistechnicalreport,wederiveexpressions forthenumberofmultiplicationsandsummationsthatamajorityofsignalprocessingalgorithms inmobilecommunicationsbringwiththem. Acknowledgments: TheauthorwouldliketothankDipl.-Ing.DavidA.SchmidtandDipl.-Ing.GuidoDietlforthe fruitfuldiscussionsonthistopic. 4 2. FlopCounting Inthischapter,weofferexpressionsforthenumberofcomplexmultiplicationsandsummations requiredforseveralmatrix-vectoroperations.Afloating-pointoperation(FLOP)isassumedtobe eitheracomplexmultiplicationoracomplexsummationhere,despitethefactthatacomplexmul- tiplicationrequires4realmultiplicationsand2realsummationswhereasacomplexsummations constistsofonly2realsummations,makingamultiplicationmoreexpensivethanasummation. However,wecounteachoperationasoneFLOP. Throughoutthisreport,weassume2Ctobeascalar,thevectorsa2CN ,b2CN ,and c2CM tohavedimensionN,N,andM,respectively.ThematricesA2CMN ,B2CNN , andC2CNL areassumedtohavenospecialstructure,whereasR=RH 2CNN isHermitian andD=diagfd‘ gN 2CNN isdiagonal.LisalowertriangularNNmatrix,e‘=1 n denotes theunitvectorwitha1inthen-throwandzeroselsewhere.Itsdimensionalityischosensuchthat therespectivematrix-vectorproductexists.Finally,[A]a;b denotestheelementinthea-throwand b-thcolumnofA,[A]a:b;c:d selectsthesubmatrixofAconsistingofrowsatobandcolumnscto d.0ab istheabzeromatrix.Transposition,Hermitiantransposition,conjugate,andreal-part operatoraredenotedby()T ,()H ,() ,and1takesamatrixvector productofdimension(Nn+1)(n1)whichissubtractedfromanother(Nn+1)- dimensionalvectorinvolvingNn+1summations,seeLine3.Finally,Nnmultiplications 6 andasinglesquare-rootoperationarenecessaryinLine4.Inshort,rownwith1n,bn+1‘ multiplications n;n andbn1summationsarerequired,astheKronecker-deltavanishes.Allmain diagonalentriescanbecomputedbymeansofNmultiplicationsThelowerleftoff-diagonalentries 7 Actually,itisadivisionratherthanamultiplication. 12 2.FlopCounting require " #N X1 XN N X1 XN (bn+1)= (1n)(Nn)+ b n=1b=n+1 n=1 b=n+1 N X1 N2 +Nn2 n= N+n2 n(N+1)+ 2n=1 N X1 N2 3N n2 3= + + n(N+ ) (2.11)2 2 2 2n=1 N (N1)N(2N1)=(N1) (N+3)+2 26 3(N1)N(N+ )2 21 1 2= N3 + N2 N6 2 3 multiplications,and N X1 XN 1 1 1(bn1)= N3 N2 + N (2.12)6 2 3n=1b=n+1 summations.IncludingtheNmultiplicationsforthemain-diagonalentries, 1 N3 +1 N2 +1 N6 2 3 multiplicationsand 1 N3 1 N2 +1 Nsummationshavetobeimplemented,yieldingatotalamount 6 2 3 of 1 N3 +2 NFLOPs. 3 3 2.3.2InverseL1 ofaLowerTriangularMatrixL1 1 withOnesontheMainDiagonal TheinverseofalowertriangularmatrixL1 turnsouttorequireN2 FLOPslessthantheinverse ofLwitharbitrarynonzerodiagonalelements.LetXdenotetheinverseofL1 .Clearly,Xis againalowertriangularmatrixwithonesonthemaindiagonal.Wecanexploitthisfactinorder tocomputeonlytheunknownentries. ThemthrowandnthcolumnofthesystemofequationsL1 X=IN withmn+1readsas 8 m X1 lm;n + lm;i xi;n +xm;n =0; i=n+1 im1 or,equivalently, 2 3 6 m X1 7xm;n =4lm;n + lm;i xi;n 5: i=n+1 im1 Hence,Xiscomputedviaforwardsubstitution.Tocomputexm;n ,weneedmn1multipli- cationsandmn1summations.Rememberthatmn+1.Thetotalnumberofmultiplica- tions/summationsisobtainedfrom N X1 XN 1 1 1 (mn1)= N3 N2 + N: (2.13) 6 2 3n=1m=n+1 8 Weonlyhavetoconsidermn+1,sincetheequationsresultingfromm