Showing information about the computation of minimum distance with Maga

Skip to first unread message

Rodrigo San José

Apr 20, 2022, 4:35:14 PMApr 20
to sage-coding-theory
In Magma, if you set the verbose level to 1 with: 
you get additional information when computing the minimum distance of a code (for example, estimated time of computation and temporal bounds). I would like to get that information as well when using the interface for Magma in Sage.
I have tried using:
which seems to correctly change the verbose level, but when executing 
I only get the minimum distance (but not the extra information).

As an example, I can give this (if you want to copy and paste to test):


Apr 21, 2022, 5:19:16 AMApr 21
to sage-coding-theory
I forgot to add: I am using SageMath 9.0 on Ubuntu 20.04 LTS

Maxime Bombar

Apr 21, 2022, 6:15:16 AMApr 21
to, Rodrigo
On 4/21/22 09:31, Rodrigo wrote:
> I forgot to add: I am using SageMath 9.0 on Ubuntu 20.04 LTS

Hi Rodrigo,

as always in Sage, everything is an instance of some object. `magma` is
not different than everything else. Indeed, if you ask the type of the
object `magma` you will see that it is an instance of the Interface
object. For example:

sage: type(magma)
<class 'sage.interfaces.magma.Magma'>

Now, if you look at how this object is instantiated, you see that there
are many options you can set. In particular, there is an argument
"logfile" which is set to `None` by default. This is where you will see
the logs you want. As I mentioned, by default those logs are discarded.

To get what you want, you can create a new instance of the magma
interface where you specify a file name where everything will be logged

sage: magma_with_logs = Magma(logfile="sage_magma.log") # You can call
it magma, this will just replace the usual one.
sage: magma_with_logs.set_verbose("Code", true)
sage: C = codes.random_linear_code(GF(4), 80, 20)
sage: magma_with_logs.MinimumWeight(C)

And now you can look at the file sage_magma.log and see the logs you are
looking for !

Obviously, you can handle this logfile within sagemath with usual file
handling in Python. I let you experiment with that.

By the way, there has been _a lot_ of changes since SageMath 9.0 (not
about the Magma interface, but still), especially between Sage 9.0 and
9.2 (Moving to full Python 3), and currently the stable Sage version is 9.5.

But not a big deal, the new Ubuntu LTS (22.04) is out .... today ! And
it comes with Sage 9.5. I suggest you upgrade your system when you have
time to do that !





Apr 21, 2022, 9:24:40 AMApr 21
to sage-coding-theory
Hi Maxime, 

thank you very much for the solution, it really solves my problem.

I am planning on updating to 9.5, but I am working on a shared server which I do not manage myself...

Best regards,

Reply all
Reply to author
0 new messages