sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.19k stars 411 forks source link

[positive referee] add setting of rows or columns to a matrix #405

Closed williamstein closed 16 years ago

williamstein commented 16 years ago
On 7/26/07, David Joyner <wdjoyner@gmail.com> wrote:
> On 7/26/07, mak <mak@math.uvic.ca> wrote:
> > 1.  How do I change the entire row or column of a matrix at once?  In
> > pari, I could do e.g. a=[1,2,3;4,5,6], and then put a[1,]=[0,0,0],
> > which would give a=[0,0,0;4,5,6].  What's the sage equivalent?

There is no SAGE equivalent yet.  David's example might be helpful
below though.  The best you could in SAGE is set each entry
one at a time right now.  I should add something.  

def set_row(A, r, v):
    for i in range(A.ncols()):
         A[r, i] = v[i]

I'm not sure how we forgot to ever do this. 

Component: linear algebra

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

mwhansen commented 16 years ago
comment:4

Attachment: 405.patch.gz

89c6e537-b2e3-45e6-882d-d4957b74ffe5 commented 16 years ago
comment:5

merged in 2.9.1 rc0