why is GiNaC::symbol commutative??
Hello, subject explains it all. I would like to use symbols to represent matrices. Obvious solution (replacing symbols via some_ex.sub(some_symbol==some_matrix) does not work for multiplication of matrices. Other ways to do it? Thanks. Vaclav. (If I understand it right, upon replacement of one matrix, one has matrix*symbol; symbol is supposed to be a scalar, so we have commutative multiplication; then the other symbol is also substituted for a matrix, so one gets exception "non-commutative scalar".)
Hi! On Tue, Dec 03, 2002 at 03:25:00PM +0100, smilauer@volny.cz wrote:
I would like to use symbols to represent matrices. Obvious solution (replacing symbols via some_ex.sub(some_symbol==some_matrix) does not work for multiplication of matrices. Other ways to do it?
1) Subclass symbol (see GiNaC tutorial, section 6.3.) and override return_type() to return 'return_types::noncommutative' and return_type_tinfo() to return 'TINFO_matrix'. These new symbols will then have the same commutativity properties as matrices. 2) Use dummy 1x1 numeric or symbolic matrices instead of symbols, and subs() the entrire matrices. Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Christian Bauer
-
smilauer@volny.cz