Rank: 559 based on 157 downloads (last 30 days) and 4 files submitted
photo

Paolo de Leva

E-mail

Personal Profile:

Professional Interests:

 

Watch this Author's files

 

Files Posted by Paolo View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
07 Mar 2009 Screenshot Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva vector algebra, arraylab, matrix, matrix algebra, vector expansion, scalar 81 17
  • 4.95
5.0 | 21 ratings
26 Feb 2009 Screenshot Vector algebra for arrays of any size, with array expansion enabled Multiple dot, cross, and outer products, cross divisions, norms, normalizations, projections, etc. Author: Paolo de Leva algebra, linear algebra, magn, vector expansion, cross division, dot2 43 3
  • 5.0
5.0 | 3 ratings
23 Feb 2009 Binary array expansion function element-by-element binary operations (e.g. plus, times, eq, gt) with array expansion (AX) enabled. Author: Paolo de Leva boolean operation, or, rem, arraylab, lt, vector expansion 10 1
11 Dec 2006 Screenshot Defining Cartesian Reference Frames based on Point Positions Versatile algorithm defining Cartesian reference frames based on the positions of at least 3 points Author: Paolo de Leva 3d graphics, local reference frame, mechanics, physics, arraylab, reference frame 23 1
  • 5.0
5.0 | 3 ratings
Comments and Ratings by Paolo View all
Updated File Comments Rating
31 Jul 2009 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva

Chris, thak you for your rating. What you describe is indeed a useful operation which is described in geometry as a transformation matrix composition (a special kind of function composition), but it is different from what MULTIPROD does. MULTIPROD is designed to operate on 2 block arrays of matrices or vectors or scalars, not on a single block array. You can compare it with DOT and CROSS, which also operate on 2 block arrays. In other words, MULTIPROD, DOT and CROSS can be described as binary operations, while you need a unary operation (operating on a single operand). Possibly, you or some other author will be willing to design and publish an optimized function to do what you need. Such a function would be consistent with what I called the "ARRAYLAB" phylosophy (an evolution of the original MATLAB approach, see MULTIPROD manual).
Sorry for rating myself. I did that by mistake and did not find a way to undo it.

28 Feb 2009 bsxfun substitute Substitute for bsxfun for older versions of MATLAB in which it is not built-in. Author: Douglas Schwarz

An excellent "hack". A smart, fast and computationally efficient replacement for BSXFUN which allowed me to ensure backward compatibility for the latest version of the ARRAYLAB toolbox:

http://www.mathworks.fr/matlabcentral/fileexchange/8773 http://www.mathworks.fr/matlabcentral/fileexchange/8782 http://www.mathworks.fr/matlabcentral/fileexchange/23084

Two other functions, available on MATLAB Central File Exchange, do approximately the same job as Doug's submission:

http://www.mathworks.com/matlabcentral/fileexchange/10333
http://www.mathworks.com/matlabcentral/fileexchange/18685

They both do it less efficiently as for memory usage, by temporarily allocating a significant amount of additional memory to expand the input arrays. As for the first one (GENOP), it is also slower than this one.

On behalf of all the users of pre-R2007a MATLAB releases, thank you very much Doug.

24 Feb 2009 Binary array expansion function element-by-element binary operations (e.g. plus, times, eq, gt) with array expansion (AX) enabled. Author: Paolo de Leva

BAXFUN is just a trifling enhancement to the built-in function BSXFUN. The enhanced syntax just allows you to operate a dimension shift before applying the specified binary function. However, I believe it is useful to publish it for two reasons:
1) it teaches to whoever is willing to read the help text how much additional power you can obtain from BSXFUN if you combine it with a dimension shift (see examples), and it provides a compact syntax to do it with a single instruction.
2) AX was first enabled for matrix multiplication, with version 2.0 of MULTIPROD (MATLAB Central, file #8773), and for vectorial operations, with the latest version of the Vector algebra toolbox, (MATLAB Central file #8782). In these applications, it provides a terrific service. For the sake of consistency, however, I felt that it was also necessary to enable AX for element-wise operations.

24 Feb 2009 TIMEIT Benchmarking Function TIMEIT.M measures the time required to call a user-specified function Author: Steve Eddins

A suggestion to improve accuracy when you measure small execution times. I believe it would be useful to subtract from median(times) the time needed for the inner iterations (“offset”). Here is the code:

[…omissis…]
offsets = zeros(num_outer_iterations, 1);
times = offsets;
for k = 1:num_outer_iterations
    t1 = tic;
    for p = 1:num_inner_iterations
    end
    offsets(k) = toc(t1);
end

for k = 1:num_outer_iterations
    t1 = tic;
    for p = 1:num_inner_iterations
        [outputs{:}] = f();
    end
    times(k) = toc(t1);
end
 
t = (median(times-offsets)) / num_inner_iterations;
[…omissis…]

This offset is not always negligible, especially when you want to time the execution of very quick commands or functions. Notice that the value of each element of variable “offsets” also include the time needed to execute

t1 = tic; times(k) = toc(t1);

On my system, this is very small (1.7321e-005 s), but not negligible when testing the execution of very quick commands, such as RESHAPE.

Paolo de Leva

27 Dec 2008 Generalized Array Operations Computes generalized array operations by expanding singleton dimensions. Author: Douglas Schwarz

An excellent "hack", a smart and computationally efficient algorithm. It is equivalent to BSXFUN (a builtin function introduced about a year later in MATLAB R2007a), and of course much slower, but it can be used as a replacement for BSXFUN by those who have earlier versions of MATLAB. This allowed me to ensure backward compatibility for version 2.0 of my MULTIPROD function, a generalization to N dimensions of the matrix product MTIMES (I am debugging it, I will publish it ass soon as it is ready):

http://www.mathworks.fr/matlabcentral/fileexchange/8773

MULTIPROD uses BSXFUN to implement singleton expansion and to increase computational speed.

There's another file in MATLAB Central File Exchange which does approximately the same job as GENOP (and perhaps more quickly), but does it less efficiently as for memory usage, by temporarily allocating a huge amount of additional memory to physically expand the arrays:

http://www.mathworks.com/matlabcentral/fileexchange/18685

Comments and Ratings on Paolo's Files View all
Updated File Comment by Comments Rating
04 Mar 2010 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva Aleksandra

03 Nov 2009 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva Deepak

Nice program to change all the lines of code into one command. really useful in simulations etc.

12 Aug 2009 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva Kozlov, Denis

31 Jul 2009 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva de Leva, Paolo

Chris, thak you for your rating. What you describe is indeed a useful operation which is described in geometry as a transformation matrix composition (a special kind of function composition), but it is different from what MULTIPROD does. MULTIPROD is designed to operate on 2 block arrays of matrices or vectors or scalars, not on a single block array. You can compare it with DOT and CROSS, which also operate on 2 block arrays. In other words, MULTIPROD, DOT and CROSS can be described as binary operations, while you need a unary operation (operating on a single operand). Possibly, you or some other author will be willing to design and publish an optimized function to do what you need. Such a function would be consistent with what I called the "ARRAYLAB" phylosophy (an evolution of the original MATLAB approach, see MULTIPROD manual).
Sorry for rating myself. I did that by mistake and did not find a way to undo it.

31 Jul 2009 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva Sarantos, Chris

Question: Can multiprod be used to multiply a single array of matrices together along one dimension? For example if you have a 2x2xN array, and want to multiply the 2x2 matrices together along the third dimension to get a 2x2x1 output?

Top Tags Applied by Paolo
array, multidimensional array, array expansion, arraylab, expansion
Files Tagged by Paolo View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
07 Mar 2009 Screenshot Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva vector algebra, arraylab, matrix, matrix algebra, vector expansion, scalar 81 17
  • 4.95
5.0 | 21 ratings
26 Feb 2009 Screenshot Vector algebra for arrays of any size, with array expansion enabled Multiple dot, cross, and outer products, cross divisions, norms, normalizations, projections, etc. Author: Paolo de Leva algebra, linear algebra, magn, vector expansion, cross division, dot2 43 3
  • 5.0
5.0 | 3 ratings
23 Feb 2009 Binary array expansion function element-by-element binary operations (e.g. plus, times, eq, gt) with array expansion (AX) enabled. Author: Paolo de Leva boolean operation, or, rem, arraylab, lt, vector expansion 10 1
17 Feb 2009 bsxfun substitute Substitute for bsxfun for older versions of MATLAB in which it is not built-in. Author: Douglas Schwarz singleton, bsxfun, array expansion, ne, plus, multiplication 53 3
  • 5.0
5.0 | 1 rating
31 Dec 2008 TIMEIT Benchmarking Function TIMEIT.M measures the time required to call a user-specified function Author: Steve Eddins timeit, potw, time benchmark, execution time, utilities 66 6
  • 5.0
5.0 | 4 ratings
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com