Proposal: matrices may no longer be given varidxes.
Dear all, As discussed recently on this list, if we have a matrix M, both M~0~0 and M.0.0 evaluate to the same matrix element. This idicates that the variance of a varidx given to a matrix really doesn't mean anything. Therefore I propose to add code to the method matrix::eval_indexed that checks whether the indices are idxes (in the sense of is_exactly_a<idx>) and to throw an exception if they are not. What do other developers think? Obviously this could break some code out there. Best wishes, Chris
"CD" == Chris Dams <Chris.Dams@mi.infn.it> writes: CD> doesn't mean anything. Therefore I propose to add code to the CD> method matrix::eval_indexed that checks whether the indices are CD> idxes (in the sense of is_exactly_a<idx>) and to throw an CD> exception if they are not. What do other developers think?
I cannot see any advantages to make GiNaC more restrictive. If some users feel that this is dangerous in their setting then they can avoid this themselves. With the present state I can use M.i.i to denote a generic diagonal element of M and M.i~i---the sum of all such elements. Certainly other users may think on other application of such a freedom. Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
Dear Vladimir, On Thu, 17 Aug 2006, Vladimir Kisil wrote:
With the present state I can use M.i.i to denote a generic diagonal element of M and M.i~i---the sum of all such elements. Certainly other users may think on other application of such a freedom.
Well, we have recently seen that doing that kind of misuse is a bit dangerous, havn't we? Something like this can break rather easily if new functionality is added to the library. Therefore, I think helping the user a bit by explicitly forbidding dangerous expressions is beneficial. For what you want to do, I would suggest to introduce a symbolic function, say "nosum" and to write M.nosum(i).nosum(i). That should be safe. Well, at least as long as there are no other i's hanging around... Vladimirs opinion has been noted. Do other people have other/the same opions available? Best wishes, Chris
Dear Chris, Chris Dams schrieb:
On Thu, 17 Aug 2006, Vladimir Kisil wrote:
With the present state I can use M.i.i to denote a generic diagonal element of M and M.i~i---the sum of all such elements. Certainly other users may think on other application of such a freedom.
Well, we have recently seen that doing that kind of misuse is a bit dangerous, havn't we? Something like this can break rather easily if new functionality is added to the library. Therefore, I think helping the user a bit by explicitly forbidding dangerous expressions is beneficial.
For what you want to do, I would suggest to introduce a symbolic function, say "nosum" and to write M.nosum(i).nosum(i). That should be safe. Well, at least as long as there are no other i's hanging around...
Vladimirs opinion has been noted. Do other people have other/the same opions available?
I have no advice or strong opinion about this issue, sorry. The only remarks I can make are probably on a level too basic to be helpful: Why is class 'indexed' used to attach indices to matrices? tensors for example get their indices at creation time. There is a reason for that. This is something that still confuses me. If M is my matrix, I would expect indexed(M,i) give me a kind of vector (~tensor) of matrices (note the plural). Maybe this inconsistency (at least in my opinion it is one) lies at the heart of the 'indexed' problem. Regards, Jens
participants (3)
-
Chris Dams
-
Jens Vollinga
-
Vladimir Kisil