Excessive Run Time For back solve of 'huge' symbolic matrices.

I am calculating a left matrix division A\b on MatLab 2009b and it has taken more than a week now. I admit that the matrix A is huge and it contains some symbols. Is there any way to speed up this calculation, or will I ever get some results? Thanks a lot!

10 Kommentare

Quantify huge and by symbols you mean symbolic variables?
Does mldivide even work with symbolic arrays??
@Walter: J wrote, that it runs since a week now. This seems to imply, that it runs at all. But who knows...
@Walter, it appears to:
syms a c
a\c
ans =
c/a
Let's see... shouldn't it be c' / a' ? c/a would be the equivalent answer if one assumed scalars, but the question was about arrays. (I would have to have a closer look at the definitions to determine whether the transpose should be plain transpose or conjugate transpose.)
Does the same code work for normal sized matrices, say 10x10?
What is huge?
J
J am 13 Sep. 2011
Matrix A is a weighting matrix. Dimension: 24*24; Storage space: 4 mb; symbolic variables contained: 6.
Actually, following Windmeijer 2005, I am correcting the undersized error terms in my GMM estimation. The code and data are both available for email.
Thank you very much!
J
J am 13 Sep. 2011
Theoretically, the code should work (Please try the following)
%%%%%%%%%%%%%%%%%%%
syms x y;
A= [2*x x; x x/3];
b=eye(2)*y;
C= A\b;
C
%%%%%%%%%%%%%%%%%%%
But the division takes so long that I start wondering ...
Anybody got any ideas?
Thanks a lot!
The calculation takes about a second on my computer, which is pretty slow for a 2x2 problem!
J
J am 14 Sep. 2011
The trial calculation does take less than 1 second (please see the following), and it makes me believe that the code is executable.
%%%%%%%%%%%%%%%%%%%%%%%
syms x y;
A= [2*x x; x x/3];
b=eye(2)*y;
tic, C= A\b, toc;
%%%%%%%%%%%%%%%%%%%%%%%
Elapsed time is 0.023101 seconds.
%%%%%%%%%%%%%%%%%%%%%%%
However, the real calculation takes more than a week and I wonder if anything is wrong (Please see the original question and comment #7).
Thank you very much!

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Andrew Newell
Andrew Newell am 14 Sep. 2011

0 Stimmen

Do you really need the symbolic answer? It's probably very complicated, and not very edifying. You could create a function that inputs numerical values for your six variables and calculates A\b numerically. It would be orders of magnitude faster.

2 Kommentare

J
J am 15 Sep. 2011
As I state in comment # 7, "following Windmeijer 2005, I am correcting the undersized error terms in my GMM estimation."
The left matrix division A\b is a middle step for a term that I need to calculate partial derivatives [Jacobian matrix on those 6 variables].
I really wish there is a way to get rid off the symbles early and still be able to calculate the derivatives later.
Thank you very much!
You could calculate numerical partial derivatives. A package such as John d'Errico's (http://www.mathworks.com/matlabcentral/fileexchange/13490-adaptive-robust-numerical-differentiation) can be very accurate.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by