[GiNaC-devel] Patch for get_dummy_indices

Vladimir Kisil kisilv at maths.leeds.ac.uk
Tue Nov 9 11:02:03 CET 2004


#
		Dear All,

		Presently the method get_dummy_indices() has a non-intuitive
  behaviour  that it  forgets about variance of indices and return all
  of them dotted. This is illustrated by the test included after the
  signature.

  This can be altered in many they and include a patch to idx.cpp which
  uses a sorting rule indifferent to variance of indices. If this patch
  is applied than a small simplification to clifford.cpp can be done as
  well. 

  Best wishes,
  Vladimir
-- 
Vladimir V. Kisil     email: kisilv at maths.leeds.ac.uk
--                      www: http://maths.leeds.ac.uk/~kisilv/

##include <iostream>
##include <ginac/ginac.h>

using namespace std;
using namespace GiNaC;

int main()
{
	varidx mu(symbol("mu"), 4);
	varidx nu(symbol("nu"), 4, true);

	symbol A("A");
	symbol B("B");

	ex e = indexed(A, nu, mu);
	ex e1 = indexed(B, nu.toggle_variance(), mu.toggle_variance());

	lst rl = lst(mu, nu);

	cout << rl << endl;
	// -> {~mu,.nu}

	exvector ind_vec = ex_to<indexed>(e).get_dummy_indices(ex_to<indexed>(e1));
	for (exvector::const_iterator it = ind_vec.begin(); it != ind_vec.end(); it++) {
			cout << ex_to<varidx>(*it) << endl;
			// -> .nu .mu
	}

	return 0;
}

#
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/x-patch
Size: 1131 bytes
Desc: this is a patch
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20041109/1eb871ea/attachment.bin>


More information about the GiNaC-devel mailing list