Opened 9 years ago

Closed 4 years ago

#12901 closed defect (wontfix)

permutation_automorphism_group fails in optional doctest of coding/linear_code.py

Reported by: benjaminfjones Owned by: wdj
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: coding theory Keywords: gap
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

There is a bug in the permutation_automorphism_group(algorithm="gap") method of LinearCode. It was discovered when doctests were added to coding/linear_code.py in #12893.

~/Installations/sage-git» sage -tp --optional=sage,gap_packages src/sage/coding
Running doctests with ID 2014-07-16-19-21-12-c6433e4f.
Sorting sources by runtime so that slower doctests are run first....
Doctesting 17 files using 2 threads.
sage -t src/sage/coding/linear_code.py
**********************************************************************
File "src/sage/coding/linear_code.py", line 1416, in sage.coding.linear_code.LinearCode.decode
Failed example:
    C.decode(v, algorithm="guava")  # optional - gap_packages (Guava package)
Exception raised:
    Traceback (most recent call last):
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run
        self.execute(example, compiled, test.globs)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute
        exec compiled in globs
      File "<doctest sage.coding.linear_code.LinearCode.decode[20]>", line 1, in <module>
        C.decode(v, algorithm="guava")  # optional - gap_packages (Guava package)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/coding/linear_code.py", line 1440, in decode
        result = gap.Decodeword(code, right_word)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 563, in __call__
        return self._parent.function_call(self._name, list(args), kwds)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 898, in function_call
        ['%s=%s'%(key,value.name()) for key, value in kwds.items()])))
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 570, in eval
        result = Expect.eval(self, input_line, **kwds)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1229, in eval
        for L in code.split('\n') if L != ''])
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 771, in _eval_line
        raise RuntimeError(message)
    RuntimeError: Gap produced error output
    Error, List Element: <list>[2] must have an assigned value
       executing Decodeword($sage5,$sage27);
**********************************************************************
File "src/sage/coding/linear_code.py", line 2304, in sage.coding.linear_code.LinearCode.permutation_automorphism_group
Failed example:
    C.permutation_automorphism_group(algorithm="gap")  # optional - gap_packages (Guava package)
Exception raised:
    Traceback (most recent call last):
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run
        self.execute(example, compiled, test.globs)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute
        exec compiled in globs
      File "<doctest sage.coding.linear_code.LinearCode.permutation_automorphism_group[21]>", line 1, in <module>
        C.permutation_automorphism_group(algorithm="gap")  # optional - gap_packages (Guava package)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/coding/linear_code.py", line 2345, in permutation_automorphism_group
        A = gap("MatrixAutomorphisms(matCwt)")
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 199, in __call__
        return cls(self, x, name=name)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1312, in __init__
        self._name = parent._create(value, name=name)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 389, in _create
        self.set(name, value)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 1305, in set
        out = self._eval_line(cmd, allow_use_file=True)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 771, in _eval_line
        raise RuntimeError(message)
    TypeError: Gap produced error output
    Error, no method found! For debugging hints type ?Recovery from NoMethodFound
    Error, no 1st choice method found for `MatrixAutomorphisms' on 1 arguments
       executing $sage26:=MatrixAutomorphisms(matCwt);;
**********************************************************************
File "src/sage/coding/linear_code.py", line 2306, in sage.coding.linear_code.LinearCode.permutation_automorphism_group
Failed example:
    C.permutation_automorphism_group(algorithm="gap")  # optional - gap_packages (Guava package)
Exception raised:
    Traceback (most recent call last):
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run
        self.execute(example, compiled, test.globs)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute
        exec compiled in globs
      File "<doctest sage.coding.linear_code.LinearCode.permutation_automorphism_group[23]>", line 1, in <module>
        C.permutation_automorphism_group(algorithm="gap")  # optional - gap_packages (Guava package)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/coding/linear_code.py", line 2345, in permutation_automorphism_group
        A = gap("MatrixAutomorphisms(matCwt)")
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 199, in __call__
        return cls(self, x, name=name)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1312, in __init__
        self._name = parent._create(value, name=name)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 389, in _create
        self.set(name, value)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 1305, in set
        out = self._eval_line(cmd, allow_use_file=True)
      File "/home/punarbasu/Installations/sage-git/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 771, in _eval_line
        raise RuntimeError(message)
    TypeError: Gap produced error output
    Error, no method found! For debugging hints type ?Recovery from NoMethodFound
    Error, no 1st choice method found for `MatrixAutomorphisms' on 1 arguments
       executing $sage11:=MatrixAutomorphisms(matCwt);;
**********************************************************************
2 items had failures:
   1 of  23 in sage.coding.linear_code.LinearCode.decode
   2 of  25 in sage.coding.linear_code.LinearCode.permutation_automorphism_group
    [398 tests, 3 failures, 36.46 s]

Change History (9)

comment:1 Changed 9 years ago by benjaminfjones

From my initial investigation is seems that the failure occurs when the GAP function MatrixAutomorphisms is called with an empty matrix [ ] as it's argument.

An example where the problem occurs,

sage: C = HammingCode(2,GF(4,"z")); C                                        
Linear code of length 5, dimension 3 over Finite Field in z of size 2^2      
sage: C.permutation_automorphism_group(algorithm="partition")                
Permutation Group with generators [(1,3)(4,5), (1,4)(3,5)]                   
sage: C.permutation_automorphism_group(algorithm="gap")                                  
...
TypeError: Gap produced error output
Error, no 1st choice method found for `MatrixAutomorphisms' on 1 arguments

executing $sage26:=MatrixAutomorphisms(matCwt);;

When I trace C.permutation_automorphism_group(algorithm="gap") in this example, I see that

   1922                 gap.eval("matCwt:=List(Cwt,c->VectorCodeword(c))")            #        for each i until stop = 1) 
-> 1923                 A = gap("MatrixAutomorphisms(matCwt)")
   1924                 #print "A = ",A, "\n Gp = ", Gp, "\n strGp = ", str(Gp)

ipdb> print wt
3
ipdb> print nonzerowts
[0, 3, 4, 5]
ipdb> gap("Cwt")
[  ]
ipdb> gap("List(eltsC, c->WeightCodeword(c))")
[ 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ]

so it looks to me like we're expecting to find vectors of weight 3, 4, and 5, but according to GAP there are only vectors of weight 0 or 4 in the code.

comment:2 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:3 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:6 Changed 6 years ago by jdemeyer

  • Description modified (diff)

comment:7 Changed 4 years ago by jsrn

  • Keywords linear code removed
  • Status changed from new to needs_review

Running the Sage test suite with --optional=sage,gap_packages no longer produces such an error, nor does the example given in comment 1. I'm closing this as invalid.

comment:8 Changed 4 years ago by jsrn

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from needs_review to positive_review

comment:9 Changed 4 years ago by embray

  • Resolution set to wontfix
  • Status changed from positive_review to closed

Closing tickets in the sage-duplicate/invalid/wontfix module with positive_review (i.e. someone has confirmed they should be closed).

Note: See TracTickets for help on using tickets.