Rank: 114 based on 450 downloads (last 30 days) and 23 files submitted
photo

James Tursa

E-mail
Lat/Long
47.68167, -122.2075

Personal Profile:

Interested in external applications, mex & engine applications with Fortran, C, C++, etc.

Professional Interests:

 

Watch this Author's files

 

Files Posted by James View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
10 Aug 2010 Screenshot MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa but where is this for..., 6, when doing c zeros2, 5 for m14 for n15 c, mtimes, m 107 33
  • 4.875
4.9 | 10 ratings
20 Dec 2009 Screenshot Fortran 95 Interface to MATLAB API with extras! This is the one you have been waiting for, a clean interface using assumed shape Fortran pointers. Author: James Tursa 95, fortran, engine, api, mex, fortran 95 15 2
  • 5.0
5.0 | 1 rating
11 Nov 2009 Screenshot mpower2 - A faster matrix power function. mpower2 evaluates matrix to an integer power faster than the MATLAB built-in function mpower. Author: James Tursa matrix, power, mpower 15 2
11 Nov 2009 Screenshot polyvalm2 - A faster matrix polynomial evaluator polyvalm2 evaluates a polynomial with a matrix argument faster than the MATLAB function polyvalm. Author: James Tursa matrix, polynomial, polyvalm, mpower 10 3
  • 5.0
5.0 | 1 rating
23 Oct 2009 Screenshot num2vpi - Converts input exactly into vpi Converts double inputs larger than 2^53-1, or char inputs with exponents, exactly into vpi. Author: James Tursa vpi, precision, variable, integer 8 1
  • 5.0
5.0 | 1 rating
Comments and Ratings by James View all
Updated File Comments Rating
26 Aug 2010 MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa

@ Julio: MTIMESX does not do generic sparse matrix multiplies internally, it just calls the MATLAB built-in function mtimes. i.e., it does the same thing as if you had just typed c21 * cb at the MATLAB prompt. Can you verify that c21 * cb works at the MATLAB prompt but mtimesx(c21,cb) does not work? Be sure that you start them both from the same state (e.g., clear all other big variables including ans before attempting the calculation). That would be surprising to me since it would indicate some type of mex limitation that I am currently unaware of.

23 Aug 2010 bsxfun bsxfun is a functional substitute for MATLAB intrinsic of the same name Author: James Tursa

@ Harry Bedi: First change your default directory to the one where the bsxarg.c file is. Then issue the mex bsxarg.c command. (I haven't updated this submission to have a self-building mechanism yet.)

10 Aug 2010 Small size linear solver Linear solver of multiple 2x2 and 3x3 systems Author: Bruno Luong

FYI, I just uploaded a new version of MTIMESX that does small matrix multiplies (first two dimensions <= 4) with inline code in 'SPEED' mode. This runs faster than the previous version.

10 Aug 2010 MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa

Also in today's release that I forgot to mention below: Added custom inline code for small matrix multiplies where all of the first two dimensions are <= 4 (in 'SPEED' mode).

21 Jul 2010 MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa

@ D Sen: In addition, you would need to reshape audio_dft to be 32 x 1 x 4097.

Comments and Ratings on James' Files View all
Updated File Comment by Comments Rating
02 Sep 2010 Fortran 95 Interface to MATLAB API with extras! This is the one you have been waiting for, a clean interface using assumed shape Fortran pointers. Author: James Tursa Lin, Renwen

27 Aug 2010 MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa Sebastiaan

Something like A(A<1e-8) = 0 should automatically remove small numbers from the sparsity pattern.

If this is too slow, have a look at spfun; it may be faster.

However, if you mean if you can remove small elements from the output matrix, you should write something of your own, partially multiplying the matrix and removing small elements. As a tip, use full column vectors of the matrix, this will make the multiplication much faster than square blocks, since sparse matrices are stored by columns. E.g.:
C = spalloc(size(A,1), size(B,2), 0);
for j=1:size(B,2)
  R = A*B(:,j);
  R(R<1e-8) = 0;
  C(:,j) = R;
end
is (probably) a fast implementation. Try to take multiple columns for speed of course.

27 Aug 2010 MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa Julio

Thanks Sebastiaan, I never thought to check the density of the resulting matrix and you are absolutely right: the memory blew up! By the way, is there any way to define an “operational zero” for sparse matrices operations in order to automatically make MATLAB assume a zero for numbers say < than 1e-8?
Thank you again.

27 Aug 2010 MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa Sebastiaan

Could it not be possible that you are really out of memory? Your result is a 460191 by 460191 matrix, which is not necessarily sparse. If the sparsity pattern is poor, the result may even be a dense matrix. Storing a full matrix this size requires 1578GiB of memory, so you have to be sure that the result is ~2% sparse. If neither of the input matrices are <1% sparse, this is likely your problem.

27 Aug 2010 MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa Julio

Thanks for your prompt reply. “mtimes” at the MATLAB prompt gives exactly the same error so, nothing wrong with “mtimesx”. Is it possible that this is a repetition of the “outer-product” problem? I am going to try partition the matrix “cb” in several chunks and then concatenate the results. Maybe it will work this way.
Thanks again.

Top Tags Applied by James
external interface, mex, fortran, precision, engine
Files Tagged by James View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
10 Aug 2010 Screenshot MTIMESX - Fast Matrix Multiply with Multi-Dimensional Support Beats MATLAB 300% - 400% in some cases ... really! Author: James Tursa but where is this for..., 6, when doing c zeros2, 5 for m14 for n15 c, mtimes, m 107 33
  • 4.875
4.9 | 10 ratings
20 Dec 2009 Screenshot Fortran 95 Interface to MATLAB API with extras! This is the one you have been waiting for, a clean interface using assumed shape Fortran pointers. Author: James Tursa 95, fortran, engine, api, mex, fortran 95 15 2
  • 5.0
5.0 | 1 rating
11 Nov 2009 Screenshot mpower2 - A faster matrix power function. mpower2 evaluates matrix to an integer power faster than the MATLAB built-in function mpower. Author: James Tursa matrix, power, mpower 15 2
11 Nov 2009 Screenshot polyvalm2 - A faster matrix polynomial evaluator polyvalm2 evaluates a polynomial with a matrix argument faster than the MATLAB function polyvalm. Author: James Tursa matrix, polynomial, polyvalm, mpower 10 3
  • 5.0
5.0 | 1 rating
23 Oct 2009 Screenshot num2vpi - Converts input exactly into vpi Converts double inputs larger than 2^53-1, or char inputs with exponents, exactly into vpi. Author: James Tursa vpi, precision, variable, integer 8 1
  • 5.0
5.0 | 1 rating

Contact us at files@mathworks.com