Path: news.mathworks.com!not-for-mail From: "Milos Milenkovic" <m.milenkovic@mathworks.com> Newsgroups: comp.soft-sys.matlab Subject: Re: Special matrix multiplication Date: Sat, 4 Feb 2012 14:40:33 +0000 (UTC) Organization: Faculty of Transport & Traffic Engineering Lines: 45 Message-ID: <jgjg11$o4c$1@newscl01ah.mathworks.com> References: <jgj6ir$rj7$1@newscl01ah.mathworks.com> <jgj876$2rh$1@newscl01ah.mathworks.com> Reply-To: "Milos Milenkovic" <m.milenkovic@mathworks.com> NNTP-Posting-Host: www-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1328366433 24716 172.30.248.47 (4 Feb 2012 14:40:33 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sat, 4 Feb 2012 14:40:33 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1282758 Xref: news.mathworks.com comp.soft-sys.matlab:756730 "John D'Errico" <woodchips@rochester.rr.com> wrote in message <jgj876$2rh$1@newscl01ah.mathworks.com>... > "Milos Milenkovic" <m.milenkovic@mathworks.com> wrote in message <jgj6ir$rj7$1@newscl01ah.mathworks.com>... > > Dear, > > suppose that we have two matrices, where each element has three values like follows: > > > > A=[(a1,b1,c1), (a2,b2,c2); (a3,b3,c3), (a4,b4,c4)] > > B=[(d1,e1,f1), (d2,e2,f2); (d3,e3,f3), (d4,e4,f4)] > > > > Now, I have to multiply these two matrices, and that is matrix C=A*B > > > > C=[ c11=(a1,b1,c1)*(d1,e1,f1)+(a2,b2,c2)*(d3,e3,f3), c12=(a1,b1,c1)*(d2,e2,f2)+(a2,b2,c2)*(d4,e4,f4); c21=(a3,b3,c3)*(d1,e1,f1)+(a4,b4,c4)*(d3,e3,f3), c22=(a3,b3,c3)*(d2,e2,f2)+(a4,b4,c4)*(d4,e4,f4)] > > > > where the most important here is the low for multiplying these three-value numbers is: > > > > (ai,bi,ci)*(di,ei,fi) = (bi*di+ei*(ai-bi), bi*ei , ei*ci+bi(fi-ei)) > > > > Please, how to do this, I have a dozen of this matrices with 700x700 in dimension approximately. > > Best, > > Milos > > While there is no magic that will let you do this for > no effort on your part, I still don't see the problem. > > You can just write a function that takes a pair of triads, > and "multiplies" them by your rule. > > Then just write another function that takes a pair of > matrices, and multiplies them, again as per your rule. > > Its just a few loops. Whats the problem? You can even > build a special class for the purpose, where you define > a "multiply" to be anything you wish between class > members. > > Its not even a big problem, but even if it was, you > eat even an elephantine computational problem one > byte at a time. Just start writing. > > John Dear John, please be a little more explicit, I know all of that, but I do not have a time to start from zero. I suppose that I can use some standard matrix multiplication function written in Matlab and make certain changes. Best, Milos