Be the first to rate this file! 5 Downloads (last 30 days) File Size: 34.61 KB File ID: #30764

frontal

by Felipe G. Nievinski

 

15 Mar 2011 (Updated 16 Apr 2011)

Do: C = frontal_mtimes(A, b); not: for k=1:size(A,3), C(:,:,k) = A(:,:,k) * b(:,:,k); end

| Watch this File

File Information
Description

These routines assist in the manipulation of matrices with same shape but different content. For example, performing the product A*b is trivial for matrix A and vector b, but what would you do if you had several such products to form? Examples abound: rotations, Jacobians, covariances, etc. Using the frontal routines, you'd collect them all in a three-dimensional matrix or third-order tensor, with each k-th frontal panel of A(:,:,k) and b(:,:,k) storing one such a related matrix and vector. Then calling

  C = frontal_mtimes(A, b);

would do the equivalent of

  for k=1:size(A,3), C(:,:,k) = A(:,:,k) * b(:,:,k); end

but using internally different algorithms depending on the dimensions of A (including a C-mex option). If you like operator overloading, you can do instead:

  A = frontal(A);
  b = frontal(b);
  C = A*b;

You might want to compile the file frontal_mtimes_helper.c, but it's not required.

After you've unzipped it, test your installation running:

  addpath(genpath('c:\work\fx\frontal\'))
  test_frontal

(don't do addpath(genpath('c:\work\fx\frontal\frontal\')))

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
testit, Multiple matrix multiplications, with array expansion enabled, MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support

MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
16 Mar 2011 James Tursa

FYI: From the "Other Files" display above it looks like the intent is to install this as a class directory structure with some helper files. But when the zip file is downloaded there is no such directory structure. All I get is a bunch of files. So I will have to manually build the @frontal folder and then separate out the helper functions also, maybe putting them in a private directory under @frontal. Is it your intent that a person who downloads this has to build all these directory structures manually?

16 Mar 2011 Felipe G. Nievinski

Please check your unzipping procedure. I've double checked the zip and the directory structure is intact.

16 Mar 2011 James Tursa

OK. I think I have it working now, at least partially. I had to add both the frontal directory *and* the util subdirectory to the path.

16 Mar 2011 Felipe G. Nievinski

Don't do:

  addpath(genpath('c:\work\fx\frontal\frontal\'))

just:

  addpath(genpath('c:\work\fx\frontal\'))

as instructed.

Please login to add a comment or rating.
Updates
16 Mar 2011

clarified paths

16 Apr 2011

added acknowledgements; applied more tags.

Tag Activity for this File
Tag Applied By Date/Time
tensor Felipe G. Nievinski 15 Mar 2011 15:40:40

Contact us at files@mathworks.com