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