#4492: block_matrix reacts inconsistently with 0
--------------------------------------+-------------------------------------
Reporter: jbmohler | Owner: was
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.6.2
Component: linear algebra | Keywords:
Author: Willem Jan Palenstijn | Upstream: N/A
Reviewer: Aly Deines, Rob Beezer | Merged:
Work_issues: rebase |
--------------------------------------+-------------------------------------
Description changed by wjp:
Old description:
> Using ZZ(0) as an element of the list passed to block_matrix appears to
> be a special case somehow and throws an exception rather than creating
> the matrix seems reasonable to me.
>
> {{{
> sage: i=MatrixSpace(ZZ,2,2)(1)
> sage: i
>
> [1 0]
> [0 1]
> sage: block_matrix([1,i,1,1]) # this works as I expect
>
> [1 0|1 0]
> [0 1|0 1]
> [---+---]
> [1 0|1 0]
> [0 1|0 1]
> sage: block_matrix([0,i,1,1]) # this doesn't ... why is 0 special
> ...
> ValueError: Insufficient information to determine dimensions.
> }}}
> This feels to me like a hazardous inconsistency.
>
> Perhaps I should also add that I don't really like that it just blithely
> assumes I want a square matrix (although I did in my actual usage).
> Ticket #2429 addresses that issue more wholeheartedly.
>
> '''Apply''':
> 1. [attachment:4492_block_matrix_rebased.patch]
> 1. [attachment:trac_4492-block-matrix-reviewer.patch]
> 1. [attachment:4492_typo.patch]
New description:
Using ZZ(0) as an element of the list passed to block_matrix appears to be
a special case somehow and throws an exception rather than creating the
matrix seems reasonable to me.
{{{
sage: i=MatrixSpace(ZZ,2,2)(1)
sage: i
[1 0]
[0 1]
sage: block_matrix([1,i,1,1]) # this works as I expect
[1 0|1 0]
[0 1|0 1]
[---+---]
[1 0|1 0]
[0 1|0 1]
sage: block_matrix([0,i,1,1]) # this doesn't ... why is 0 special
...
ValueError: Insufficient information to determine dimensions.
}}}
This feels to me like a hazardous inconsistency.
Perhaps I should also add that I don't really like that it just blithely
assumes I want a square matrix (although I did in my actual usage).
Ticket #2429 addresses that issue more wholeheartedly.
'''Apply''':
1. [attachment:4492_block_matrix_rebased.patch]
1. [attachment:trac_4492-block-matrix-reviewer.patch]
1. [attachment:4492_typo.patch]
1. [attachment:trac_4492-doctest-number-field.patch]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4492#comment:28>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.