gap-packages / forms

Forms -- sesquilinear and quadratic, a package for GAP
https://gap-packages.github.io/forms
2 stars 3 forks source link

Function BaseChangeHermitian is slow #54

Closed danielrademacher closed 8 months ago

danielrademacher commented 10 months ago

The function

BaseChangeHermitian

becomes quite slow for high dimensional matrices. I think a similar function was improved recently by avoiding matrix multiplications and using row/column operations instead. It would be great if this could also be done for hermitian forms.

fingolfin commented 9 months ago

Indeed. Basically, code like this:

        b := Z(q)*(A[row+2,row+1])^-1;
        P := IdentityMat(nplus1, gf);
        P[row+1,row+2] := b;
        A := P*A*Forms_HERM_CONJ(P,t);  # FIXME
        D := P*D;

needs to be rewritten so that instead of multiplying with the matrix P resp. its hermitian conjugate, we call Forms_SwapRows, Forms_AddRows, Forms_MultRow (resp. their column counterparts) to perform the intended operation more efficiently.

Some prior changes to this effect were e.g. done in fd46593e281db29c6ba4419b76c97442a62b2ccb but more needs to be done.

While at it, the same holds for BaseChangeOrthogonalQuadratic: there are still cases of matrix multiplication instead of row/column operations in there, too.