#19165: Error in augmentation for mod 2 matrices
----------------------------------+------------------------
       Reporter:  jhpalmieri      |        Owner:
           Type:  defect          |       Status:  new
       Priority:  major           |    Milestone:  sage-6.9
      Component:  linear algebra  |   Resolution:
       Keywords:                  |    Merged in:
        Authors:                  |    Reviewers:
Report Upstream:  N/A             |  Work issues:
         Branch:                  |       Commit:
   Dependencies:                  |     Stopgaps:
----------------------------------+------------------------
Description changed by jhpalmieri:

Old description:

> {{{
> sage: reduce(lambda x,y: x.augment(y), [identity_matrix(GF(2),
> 1).sparse_matrix()], Matrix(GF(2), 1, 0))
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
> <ipython-input-29-60d532a77af9> in <module>()
> ----> 1 reduce(lambda x,y: x.augment(y), [identity_matrix(GF(Integer(2)),
> Integer(1)).sparse_matrix()], Matrix(GF(Integer(2)), Integer(1),
> Integer(0)))
>
> <ipython-input-29-60d532a77af9> in <lambda>(x, y)
> ----> 1 reduce(lambda x,y: x.augment(y), [identity_matrix(GF(Integer(2)),
> Integer(1)).sparse_matrix()], Matrix(GF(Integer(2)), Integer(1),
> Integer(0)))
>
> /Users/palmieri/Desktop/Sage_stuff/git/sage/src/sage/matrix/matrix_mod2_dense.pyx
> in sage.matrix.matrix_mod2_dense.Matrix_mod2_dense.augment
> (build/cythonized/sage/matrix/matrix_mod2_dense.c:11113)()
>    1576             right = right.column()
>    1577
> -> 1578         cdef Matrix_mod2_dense other = right
>    1579
>    1580         if self._nrows != other._nrows:
>
> TypeError: Cannot convert
> sage.matrix.matrix_modn_sparse.Matrix_modn_sparse to
> sage.matrix.matrix_mod2_dense.Matrix_mod2_dense
> }}}
> This arises if you construct a `FiniteDimensionalAlgebra` over `GF(2)`
> using a list of sparse matrices, and then run `.is_unitary()` on it:
> {{{
> sage: A = FiniteDimensionalAlgebra(GF(2), [identity_matrix(GF(2),
> 1).sparse_matrix()])
> sage: A.is_unitary()
>   (same error)
> }}}

New description:

 {{{
 sage: Matrix(GF(2), 1, 0).augment(identity_matrix(GF(2),
 1).sparse_matrix())
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-13-8cb0b5f8c7ad> in <module>()
 ----> 1 Matrix(GF(Integer(2)), Integer(1),
 Integer(0)).augment(identity_matrix(GF(Integer(2)),
 Integer(1)).sparse_matrix())

 
/Users/palmieri/Desktop/Sage_stuff/git/sage/src/sage/matrix/matrix_mod2_dense.pyx
 in sage.matrix.matrix_mod2_dense.Matrix_mod2_dense.augment
 (build/cythonized/sage/matrix/matrix_mod2_dense.c:11113)()
    1576             right = right.column()
    1577
 -> 1578         cdef Matrix_mod2_dense other = right
    1579
    1580         if self._nrows != other._nrows:

 TypeError: Cannot convert
 sage.matrix.matrix_modn_sparse.Matrix_modn_sparse to
 sage.matrix.matrix_mod2_dense.Matrix_mod2_dense
 }}}
 This arises if you construct a `FiniteDimensionalAlgebra` over `GF(2)`
 using a list of sparse matrices, and then run `.is_unitary()` on it:
 {{{
 sage: A = FiniteDimensionalAlgebra(GF(2), [identity_matrix(GF(2),
 1).sparse_matrix()])
 sage: A.is_unitary()
   (same error)
 }}}

--

--
Ticket URL: <http://trac.sagemath.org/ticket/19165#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to