From: Merciadri Luca on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

How does MATLAB exploit matrix multiplication's associativity? Given A
B C such that their product is possible (in matrix terms), it often
happens that
complexity(A(BC)) != complexity((AB)C).

So, how does MATLAB guess this? Is there a well-known algorithm about
this?

Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --

Give a man a fish and you feed him for a day; teach a man to fish
and you feed him for a lifetime.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkwbqrgACgkQM0LLzLt8MhxNbwCfY3RjXzlwKt/qwhw4nzWwdc7G
u1QAoJyztCDXqAOw3RzvPl9IMO8thR3b
=dxzd
-----END PGP SIGNATURE-----
From: us on
Merciadri Luca <Luca.Merciadri(a)student.ulg.ac.be> wrote in message <878w6cuukn.fsf(a)merciadriluca-station.MERCIADRILUCA>...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> How does MATLAB exploit matrix multiplication's associativity? Given A
> B C such that their product is possible (in matrix terms), it often
> happens that
> complexity(A(BC)) != complexity((AB)C).
>
> So, how does MATLAB guess this? Is there a well-known algorithm about
> this?
>
> Thanks.
> - --
> Merciadri Luca
> See http://www.student.montefiore.ulg.ac.be/~merciadri/
> - --
>
> Give a man a fish and you feed him for a day; teach a man to fish
> and you feed him for a lifetime.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
>
> iEYEARECAAYFAkwbqrgACgkQM0LLzLt8MhxNbwCfY3RjXzlwKt/qwhw4nzWwdc7G
> u1QAoJyztCDXqAOw3RzvPl9IMO8thR3b
> =dxzd
> -----END PGP SIGNATURE-----

this has been discussed at length in this NG...
search for stuff like
- matrix
- multiplication

us
From: Bruno Luong on
Merciadri Luca <Luca.Merciadri(a)student.ulg.ac.be> wrote in message <878w6cuukn.fsf(a)merciadriluca-station.MERCIADRILUCA>...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> How does MATLAB exploit matrix multiplication's associativity? Given A
> B C such that their product is possible (in matrix terms), it often
> happens that
> complexity(A(BC)) != complexity((AB)C).
>
> So, how does MATLAB guess this? Is there a well-known algorithm about
> this?

That's a good question. But Matlab does not guess, the expression is just evaluated dumbly from left to right, e.g.,

A*B*C*D = ((A*B)*C)*D

It is up to user to put the parenthesis at his/her will.

Bruno
From: Bruno Luong on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hvgb7a$5u4$1(a)fred.mathworks.com>...

> >
> > So, how does MATLAB guess this? Is there a well-known algorithm about
> > this?

It seems Wikipedia page gives a broad enough overview with few relevant papers on the bottom:
http://en.wikipedia.org/wiki/Matrix_chain_multiplication

Bruno
From: Merciadri Luca on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks all. Well, I thought that The Mathworks would have implemented
such schemes into MATLAB!

- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- --

It is better to die on one's feet than live on one's knees.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkwb448ACgkQM0LLzLt8MhxIOwCeItbmY46mbZiyNQdiasACKzJO
kCIAnRBWLXInBOTUBQkbNyx1kOzZ2Iaq
=QgAu
-----END PGP SIGNATURE-----