A class for successive matrix products
Version 1.3.5 (13.7 KB) by
Matt J
A class representing products of matrices, internally storing/manipulating them separately.
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. Below is a basic example, but more can be found in the Examples tab.
N=3e4;
u=rand(N,1);
v=rand(N,1);
x=rand(N,1);
Pmat=u*v.';
and let us also represent Pmat as a ProdCascade object.
P=ProdCascade({u,v.'});
Now, compare the execution time from multiplying with Pmat and its transpose,
tic;
y1=Pmat*x;
z1=Pmat.'*y1;
toc; %Elapsed time is 0.347683 seconds.
with the same operations using a ProdCascade representation,
tic
y2=P*x;
z2=P.'*y2;
toc %Elapsed time is 0.005741 seconds.
DISCAIMER: Error checking is never done to see whether the operators in a ProdCascade are compatible for successive multiplication.
Cite As
Matt J (2026). A class for successive matrix products (https://uk.mathworks.com/matlabcentral/fileexchange/29498-a-class-for-successive-matrix-products), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2010b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Programming > Classes > Define Classes > Handle Classes >
Find more on Handle Classes in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.3.5 | Description update |
||
| 1.3.4 | Extended mrdivide & mldivide functionality to non-square matrices, but note that results are not guaranteed exact in this case. |
||
| 1.3.3 | Edit to Examples.mlx |
||
| 1.3.2 | Title change |
||
| 1.3.1 | * Added mldivide, mrdivide methods
|
||
| 1.3.0.0 | Edited the copywrite info. No new code. |
||
| 1.1.0.0 | Modified the description page. No new code to download. |
||
| 1.0.0.0 |
