[GiNaC-list] let_op() and index
C.Dams at science.ru.nl
Thu Feb 24 16:35:03 CET 2005
On Thu, 24 Feb 2005 mdias at ift.unesp.br wrote:
> Thanks Chris, I modified and compiled ok. but subs() make nothing. I have to
> delare a new subs() function? Is there in source a example?
Well, you made covdiff inherit from indexed. Indexed already has a .subs()
method that comes from the type container that it is based on, so you are
actually subsing in the underlying indexed object. You could, of course,
add your own .subs()-method, but before you do so, you should ask yourself
wheter inheriting from indexed is really what you want to do. If you want
to inherit from indexed, why do you need to define your own member
variables index and arg? Indexed already has the data structures to hold
these. Also, making these public looks like a bad idea. Furthermore, why
does this class have a member index and besides that a member new_index?
If I were to write such a class, my first inclination would be to indeed
try to make it a child class of indexed, but then to simply hold an
integer that would hold, say 3, if the indexed object has 3 indices and
further indices indicate differentiation. This would behave more or less
as expected with respect to summations conventions and so on.
More information about the GiNaC-list