help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiplying matrices into tensors?


From: James Cloos
Subject: Re: multiplying matrices into tensors?
Date: Thu, 04 Aug 2011 16:36:00 -0400
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

>>>>> "JGH" == Jordi Gutiérrez Hermoso <address@hidden> writes:

JGH> This can still be done with bsxfun, but takes one more line:

JGH>      c = bsxfun(@times, permute(a, [1,2,3]), permute(b(4,:),[3,1,2]))
JGH>      c(1:3,:,:) +=  bsxfun(@times, permute(b(1:3,:), [1,3,2]),
JGH>                                    permute(a(4,:), [1,2,3]))

JGH> Note that permute(..., [1,2,3]) is superfluous. I just put in place
JGH> to make it explicit how the indices of a and b correspond to the
JGH> indices of c.

I figured that out, and left it in for the same reason.

I already wrote an hmult function, which also worked, and which can deal
with R^{n}P, not just R^{3}P.  I just need to flesh it out to use varargin
and add code for other functions on homogeneous coords before packaging it.

Thank you.  Your explanations and examples helped!

-JimC
-- 
James Cloos <address@hidden>         OpenPGP: 1024D/ED7DAEA6


reply via email to

[Prev in Thread] Current Thread [Next in Thread]