Hi Alexei, Can you please attach a copy of your replies to my email address? I disable email delivery whenever I subscribe to forums as most of the times I post infrequently. Alexei Sheplyakov-2 wrote:
I am adding a light weight support for vector algebra in ginac. I am aware that it can be done through Clifford algebra, but the output is almost incomprehensible to debug.
I don't quite understand what is exactly wrong. Could you elaborate, please?
If vector and scalar products of vectors are not given their own identities but are implemented using the clifford algebra as in the post http://www.ginac.de/pipermail/ginac-list/2005-June/000671.html then the output no longer bears any resemblance to the original definition. For example the consider the following output "-C.0*B.2*A.1-C.1*A.2*B.0+C.2*B.0*A.1+C.0*A.2*B.1+C.1*B.2*A.0-C.2*B.1*A.0" There is no resemblance to the original definition which could be printed nicely "A . (B x C)" To emphasize my point, I dont really care how the triple product is represented inside. But when things go wrong (due to bugs) I would like to easily debug the code. For example, if I was expecting A . (C x B), the second output will immediately point out that to me. On the other hand if scalar and vector products of vectors are given their own identities, then there is no need for clifford algebra any more to evaluate them. Alexei Sheplyakov-2 wrote:
My problem is this. When a request like inner_product(lhs, rhs) is made, where one of lhs and rhs is not a vector, I would like to replace the inner_product with a regular product. How can I achieve this?
if (typeid(ex_to<basic>(lhs)) != typeid(your_class)) { // do the replacement } else if (typeid(ex_to<basic>(rhs)) != typeid(your_class)) { // same here } else { // do something nontrivial }
Yes. This would be sufficient. Alexei Sheplyakov-2 wrote:
I am planning to do it as follows 1) extend a symbol to a vector
I don't think it's a good idea. Symbol is something simple and in a sense "atomic". Also it's quite performance and memory critical. You'd better use the clifford class.
I need to think about this. thanks, Krishna. -- View this message in context: http://www.nabble.com/extending-the-symbol-tp19818944p19849081.html Sent from the Ginac - General mailing list archive at Nabble.com.