#2396: add support for matrix numpy-style indexing
----------------------------+-----------------------------------------------
Reporter: dfdeshom | Owner: dfdeshom
Type: defect | Status: closed
Priority: minor | Milestone: sage-duplicate/invalid/wontfix
Component: linear algebra | Resolution: duplicate
Keywords: | Reviewer:
Author: | Merged:
----------------------------+-----------------------------------------------
Changes (by mvngu):
* status: new => closed
* resolution: => duplicate
* milestone: sage-4.1.2 => sage-duplicate/invalid/wontfix
Comment:
This has been fixed in Sage 4.1.2.alpha4:
{{{
[mv...@sage sage-4.1.2.alpha4-sage.math]$ ./sage
----------------------------------------------------------------------
| Sage Version 4.1.2.alpha4, Release Date: 2009-09-27 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
**********************************************************************
* *
* Warning: this is a prerelease version, and it may be unstable. *
* *
**********************************************************************
sage: M = MatrixSpace(QQ, 9)
sage: A = M.random_element(); A
[ 1 -2 2 2 0 -2 1/2 1 1/2]
[ 0 -1 1 2 2 0 1 -1 1/2]
[ 1/2 2 -1 2 1/2 0 -1 2 1]
[ 1 -1 -2 0 -1/2 -1 -1 0 2]
[ 0 -1 0 0 -1/2 -2 -1 2 2]
[ -1 1 -1 0 2 0 1 0 1]
[ 0 1 0 1 -1/2 1 1 2 -1]
[ -1 -1/2 -1 0 -1 0 0 2 0]
[ 0 -1/2 -1 2 1 0 0 0 0]
sage: m = 3
sage: A[:,1] += m * A[:,4]
sage: A
[ 1 -2 2 2 0 -2 1/2 1 1/2]
[ 0 5 1 2 2 0 1 -1 1/2]
[ 1/2 7/2 -1 2 1/2 0 -1 2 1]
[ 1 -5/2 -2 0 -1/2 -1 -1 0 2]
[ 0 -5/2 0 0 -1/2 -2 -1 2 2]
[ -1 7 -1 0 2 0 1 0 1]
[ 0 -1/2 0 1 -1/2 1 1 2 -1]
[ -1 -7/2 -1 0 -1 0 0 2 0]
[ 0 5/2 -1 2 1 0 0 0 0]
sage:
sage: A[2:4, 3:8] = 0
sage: A
[ 1 -2 2 2 0 -2 1/2 1 1/2]
[ 0 5 1 2 2 0 1 -1 1/2]
[ 1/2 7/2 -1 0 0 0 0 0 1]
[ 1 -5/2 -2 0 0 0 0 0 2]
[ 0 -5/2 0 0 -1/2 -2 -1 2 2]
[ -1 7 -1 0 2 0 1 0 1]
[ 0 -1/2 0 1 -1/2 1 1 2 -1]
[ -1 -7/2 -1 0 -1 0 0 2 0]
[ 0 5/2 -1 2 1 0 0 0 0]
sage: A[:,:] = 0
sage: A
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
}}}
Closing this as a duplicate of #4972.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2396#comment:3>
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
-~----------~----~----~----~------~----~------~--~---