Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Matrix Multiplication Date: Thu, 12 May 2011 23:53:04 +0000 (UTC) Organization: Boeing Co Lines: 43 Message-ID: <iqhrt0$l9f$1@newscl01ah.mathworks.com> References: <iqevjs$cb2$1@newscl01ah.mathworks.com> <iqf0b3$e4g$1@newscl01ah.mathworks.com> <iqf1nc$hkb$1@newscl01ah.mathworks.com> <iqf2fm$jid$1@newscl01ah.mathworks.com> <iqf3fk$lvv$1@newscl01ah.mathworks.com> <iqga1c$p95$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-01-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1305244384 21807 172.30.248.46 (12 May 2011 23:53:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Thu, 12 May 2011 23:53:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 756104 Xref: news.mathworks.com comp.soft-sys.matlab:726498 "Vineet " <yadavvineet@gmail.com> wrote in message <iqga1c$p95$1@newscl01ah.mathworks.com>... > "Roger Stafford" wrote in message <iqf3fk$lvv$1@newscl01ah.mathworks.com>... > > "Vineet " <yadavvineet@gmail.com> wrote in message <iqf2fm$jid > > > Yes, I have to perform lot of matrix multiplication where I know that the matrix multiplication would result in symmetric matrix and I think there should be a way to tell this to matlab so that computation time for matrix multiplication reduces substantially. > > > vineet > > - - - - - - - - - > > Can you please tell us how you know in advance that your matrix product will turn out to be symmetric? Knowing this might influence the kinds of suggestions you receive from others. > > > > Roger Stafford > Hi > Roger > Many thanks for your quick reply > > Anyhow I want to multiply H*Q*H' where Q is positive definite and H is any arbitrary rectangular matrix. These type of matrix multiplication arise quite a lot in statistics. I know before hand that output of HQHt would be a symmetric matrix hence when I multiply HQ= H*Q; B=HQ *H'; I want to tell matlab that B is a symmetric matrix > > > In my real application H is sparse (~8% full) and huge i.e. ~50000*2000000 (i cannot hold H in memory so I store it in vertical stripts on harddrive) > and Q is blkdiag with each block being 2635*2635 so currently I am multiplying these matrices by the second method shown in the example code given below > > clc > clear all > n = 10; > p = 6; > Q = rand(n/2); > Q = Q'*Q;% create a Positive definite matrix > H = rand(p,n); > Q1 = blkdiag(Q,Q); > % Do HQHT directly > tic > HQHT=H*Q1*H'; > toc > tic > % Do HQHT indirectly > Htemp = H(:,1:5)*Q*H(:,1:5)'; > Htemp2 = Htemp+(H(:,6:10)*Q*H(:,6:10)'); > toc > > Many thanks once again for your help > Vineet I don't see any obvious specialized symmetric BLAS routines that are going to directly help with this calculation. How is Q formed? e.g., is it formed as a A*A' type of operation and do you have the pieces available? James Tursa