About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
  • Last update: 5 years ago
  • Total downloads: 56
  • Operating system: Linux, Mac OS X, Win All, BSD, Solaris
  • Publisher: Matt J (15 other programs)
See full specifications

scripts default iconatrix Products Expressed in Terms of Individual Operands (Scripts) Publisher's description

This submission defines a class for representing products of matrices (or of any objects that know how to multiply)

This submission defines a class for representing products of matrices (or of any objects that know how to multiply) when it is more efficient to store and manipulate the matrices separately.



This creates an object P representing the matrix product A1*A2*...*An. Internally, however, the object stores/manipulates the matrices {A1,A2,...,An} individually, which can be more efficient memory-wise than when the product is fully evaluated. Furthermore, when evaluating a matrix-vector product A1*A2*...*An*x, it can be more efficient speed-wise to exploit associativity and compute the result using n successive products.

A simple example of this idea is the outer product u*v.' of column vectors u and v. Clearly, it is more efficient to multiply the outer product with a vector x as u*(v.'*x) than as (u*v.')*x. The following gives a demonstration of how the class exploits this.



%Elapsed time is 0.050854 seconds.

%Elapsed time is 0.000457 seconds.

PercentError =100*norm([y2;z2]-[y1;z1])/norm([y1;z1]), %=7.8336e-014

>>whos Pmat P

Name Size Bytes Class Attributes

P 4000x4000 64244 ProdCascade
Pmat 4000x4000 128000000 double

Other situations where it can be better to store a matrix decomposed into a product would include, for example, when a large full matrix has a sparse decomposition.

Methods overloaded by the class include mtimes (*) ,tranpose (.') , ctranpose (') , det, and inv, which exploit the fact that these operations more or less distribute across matrix products. Also, some methods allow the object P to be manipulated as if it were the cell array {A1,...,An} that generated the object initially. For example, the expression A1=P{1} will extract the first operand of the product.

The ProdCascade class can be useful not just for holding products of matrices, but also of any operator objects that know how to multiply. Here is an example that uses my MatrixObj class

to represent a frequency-domain filtering operation as a multiplication with ProdCascade object, P.

LowPass=ones(N,1); LowPass(10:end-9)=0;

%%Make FFT operator
Q.Ops.mtimes=@(Q,x) fft(x);
Q.Trans.mtimes=@(Q,x) ifft(x);

%%Make filtering operator, P*x should be equivalent to ifft(fft(x).*LowPass)


isequal( P*x,ifft(fft(x).*LowPass) )%=1

DISCAIMER: Error checking is never done to see whether the operators in a ProdCascade are compatible for successive multiplication.

System Requirements:

MATLAB 7.11 (2010b)
Program Release Status: New Release
Program Install Support: Install and Uninstall

atrix Products Expressed in Terms of Individual Operands (Scripts) Tags:

Click on a tag to find related softwares

Is atrix Products Expressed in Terms of Individual Operands (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.