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 Sherman Jr.
Subject: Re: multiplying matrices into tensors?
Date: Wed, 3 Aug 2011 20:12:54 -0400

On Wed, Aug 3, 2011 at 7:51 PM, John W. Eaton <address@hidden> wrote:
On  3-Aug-2011, fork wrote:

| James Cloos <cloos <at> jhcloos.com> writes:
|
| > Does octave have an easy way of accomplishing that?  Especially given
| > the homogeneous coordinates?
|
| I wonder if the following would work on Octave (all m-files and old style object
| code, looks like to me):
|
| http://csmr.ca.sandia.gov/~tgkolda/TensorToolbox/
|
| The list might be curious (1) whether this works and (2) what parts break if not.

Reading

 http://csmr.ca.sandia.gov/tensortoolboxregistration/reg-2.4.html

I see some license terms that are not at all friendly to free software
or to users (may use for research and evaluation purposes only; may
not use for commercial purposes of any kind, etc.).  So I would
certainly not be able to recommend using that software, and I ask that
you not use the Octave mailing lists to recommend non-free software.

Thanks,

jwe
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave

This is not at all intuitive, but one solution I have come up with (and there may be much better ways to do this is the following.  If X and Y are m by n matrices and you want to some function "fun" between the columns of these matrices:
Xc = mat2cell(X, [m], ones(1, n));
Yc = mat2cell(Y, [m], ones(1, n));
Z = cell2mat(cellfun(@fun, Xc, Yc, 'UniformOutput', false));

Actually, as I just finished typing this, I see that you want to do all pairs of columns and not just corresponding pairs of columns (product of the ith column of X and the ith column of Y).  The only way I can think of off the top of my head is to use something like repmat to repeat the matrices of X and Y in such a way to get all pairs of columns.  This seems to me rather brute forceish (and memory intensive).  I'm sure someone would know of a better way.

Hope this helps in some way.





reply via email to

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