[GiNaC-list] (no subject)

Westbury, Bruce Bruce.Westbury at warwick.ac.uk
Fri Nov 28 10:37:19 CET 2008

I am getting started with GiNaC. I tried using evalm() and naively assumed that evaluating an expression involving matrices would return a matrix. It looks like a matrix but for instance the line below with A(0,0) causes an error. If I change "ex A" to "matrix A" it also causes an error. Could someone explain this please? Also, have I missed something? or do I have to use mul add sub?

        matrix S1(2,2);
	S1 = q, 0, 1, -1/q;
	matrix S2(2,2);
        S2 = -1/q, 1, 0, q;
	ex A = evalm(S1*S2*S1-S2*S1*S2);
	cout << endl << A << endl;
	cout << endl << A(0,0) << endl;
	cout << endl << A.is_zero_matrix() << endl;

Bruce Westbury

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.cebix.net/pipermail/ginac-list/attachments/20081128/16f498a6/attachment.htm 

More information about the GiNaC-list mailing list