Showing information about the computation of minimum distance with Maga

22 views
Skip to first unread message

Rodrigo San José

unread,
Apr 20, 2022, 4:35:14 PMApr 20
to sage-coding-theory
In Magma, if you set the verbose level to 1 with: 
SetVerbose("Code",true)
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:
magma.SetVerbose("Code",true)
which seems to correctly change the verbose level, but when executing 
magma.MinimumWeight(magma(C))
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):
C=codes.random_linear_code(GF(4),80,20)
magma.SetVerbose("Code",true)
magma.MinimumWeight(magma(C))


Rodrigo

unread,
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

unread,
Apr 21, 2022, 6:15:16 AMApr 21
to sage-codi...@googlegroups.com, 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
into.


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)
32


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 !


Best,

--
Maxime

OpenPGP_signature

Rodrigo

unread,
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,
Rodrigo

Reply all
Reply to author
Forward
0 new messages