[GiNaC-list] extending the symbol

Alexei Sheplyakov varg at theor.jinr.ru
Mon Oct 6 08:03:56 CEST 2008


Hello,

On Sat, Oct 04, 2008 at 07:09:59PM -0400, Krishna Mohan Gundu 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?

> 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
}

> 
> 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.

Best regards,
	Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20081006/6bdd5eaf/attachment.sig 


More information about the GiNaC-list mailing list