Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix.column(i) should throw error when i is larger than the number of columns in the matrix (minus 1). #2077

Closed
jasongrout opened this issue Feb 6, 2008 · 4 comments

Comments

@jasongrout
Copy link
Member

sage: a=matrix([[1,2],[3,4]])
sage: a.column(0)
(1, 3)
sage: a.column(1)
(2, 4)
sage: a.column(3)
(2, 4)
sage: a.column(2)
(1, 3)

The documentation for a.column says that it behaves like list indexing when given a negative index. We should probably also act like list indexing for positive indices that are too big and throw an error:

sage: l=range(3); l
[0, 1, 2]
sage: l[3]
---------------------------------------------------------------------------
<type 'exceptions.IndexError'>            Traceback (most recent call last)

/home/grout/downloads/cython-callback/<ipython console> in <module>()

<type 'exceptions.IndexError'>: list index out of range

Component: linear algebra

Issue created by migration from https://trac.sagemath.org/ticket/2077

@jasongrout
Copy link
Member Author

Attachment: matrix-column-wrapping.patch.gz

@jasongrout
Copy link
Member Author

comment:1

Attachment: matrix-column-wrapping.2.patch.gz

Apply the .2.patch (which corrects a minor typo).

@mwhansen
Copy link
Contributor

mwhansen commented Feb 7, 2008

comment:3

Looks good to me.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Feb 7, 2008

comment:4

Merged matrix-column-wrapping.2.patch in Sage 2.10.2.alpha2

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Feb 7, 2008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants