[GiNaC-devel] [BUG] clifford::op() versus tensor::replace_contr_index
Sheplyakov Alexei
varg at theor.jinr.ru
Wed Oct 18 20:41:49 CEST 2006
Hello, Vladimir!
On Wed, Oct 18, 2006 at 03:55:35PM +0100, Vladimir Kisil wrote:
> Your exam works smoothly on my computer with CVS GiNaC, expression e
> is evaluated to gamma~mu, is it correct?
Have you applied my patch to ex.h?
> ASh> 2) In general, is it OK for class derived from indexed return
> ASh> something which is *not* idx (or derived from it) via op()?
>
> One of the reasons why clifford class returns its metric among its
> ops, I think, because this is required by the subs() method to make symbolic
> substitution in the metric as well.
Actually, I think this is perfectly sensible, not only for subs()' sake
(one could provide custom implementation of subs). The point of a derived
class is to store some additional data. One might want to make that
data availiable via op(). However, some code in GiNaC seems to make
different assumption (BTW, I hate such *implicit* assumptions).
What about the following patch:
tensor::replace_contr_index: ignore all non-idx subexpressions.
Classes derived from indexed could make their additional data
members avialable via op(). Ignore such non-idx subexperssions
when performing contractions.
---
ginac/tensor.cpp | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ginac/tensor.cpp b/ginac/tensor.cpp
index c215237..25935f4 100644
--- a/ginac/tensor.cpp
+++ b/ginac/tensor.cpp
@@ -395,6 +395,8 @@ bool tensor::replace_contr_index(exvecto
again:
if (self_idx->is_symbolic()) {
for (size_t i=1; i<other->nops(); i++) {
+ if (! is_a<idx>(other->op(i)))
+ continue;
const idx &other_idx = ex_to<idx>(other->op(i));
if (is_dummy_pair(*self_idx, other_idx)) {
--
1.4.2.3
Best regards,
Alexei.
--
All science is either physics or stamp collecting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20061018/3a2e5753/attachment.sig>
More information about the GiNaC-devel
mailing list