Opened 12 years ago

Last modified 7 months ago

#1526 new enhancement

conversion from gap matrix over finite field to sage matrix is VERY VERY VERY slow -- but robust.

Reported by: was Owned by: was
Priority: major Milestone:
Component: interfaces Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

E.g., in linear_code.py line 780 (in extended_code()), this line dominates:

        Gxs = Gx._matrix_(F)           # this is the killer

That is dumb. Optimize this a lot.

Change History (7)

comment:1 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:3 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:4 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:5 Changed 12 months ago by embray

  • Milestone changed from sage-6.4 to sage-8.7
  • Report Upstream set to N/A

The exact code in question no longer exists in that module, though this issue might still be relevant, and would probably be resolved by #26902.

Indeed, this is (unsurprisingly) much faster using the libgap interface.

I wasn't sure exactly how to construct a matrix over a finite field in GAP, so I made it first in Sage, and the passed it to both GAP interfaces, and then back to Sage again:

sage: F = GF(2)
sage: M = matrix(F, [[1,0,0],[1,1,0]])
sage: M_gap = gap(M); M_gap
[ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ Z(2)^0, Z(2)^0, 0*Z(2) ] ]
sage: M_libgap = libgap(M); M_libgap
[ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ Z(2)^0, Z(2)^0, 0*Z(2) ] ]
sage: %timeit M_gap._matrix_(F)
10 loops, best of 3: 22.3 ms per loop
sage: %timeit M_libgap._matrix_(F)
1000 loops, best of 3: 902 µs per loop

I think that about speaks for itself. Repeated experiments showed similar results.

comment:6 Changed 10 months ago by embray

  • Milestone changed from sage-8.7 to sage-8.8

Ticket retargeted after milestone closed (if you don't believe this ticket is appropriate for the Sage 8.8 release please retarget manually)

comment:7 Changed 7 months ago by embray

  • Milestone sage-8.8 deleted

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

Note: See TracTickets for help on using tickets.