Skip to content

Test that getitem of numpy matrix using Sage integers works #10928

@sagetrac-flawrence

Description

@sagetrac-flawrence

In older versions of Sage, extracting a one-column submatrix
of a NumPy matrix could return it as a one-row matrix if using
a Sage integer for the column number:

sage: m = numpy.matrix(numpy.arange(6).reshape(3, 2))
sage: m[:, int(0)]  # correct submatrix extraction
matrix([[0],
        [2],
        [4]])
sage: m[:, Integer(0)]  # incorrect submatrix extraction
matrix([[0, 2, 4]])

Current versions of NumPy no longer have this problem.

This ticket adds a doctest to ensure correct submatrix
extraction keeps working.

Upstream: Fixed upstream, in a later stable release.

CC: @jasongrout @mkoeppe @slel

Component: packages: standard

Keywords: numpy

Author: Samuel Lelièvre

Branch/Commit: 290ab73

Reviewer: Vincent Delecroix

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions