First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 0 years ago

Max Alekseyev gravatar image

This should do the job:

def riAj(A,i,j):
    return A.row(i-1)[:j]

def pAi(A,i):
    for j in (1..A.ncols()):
        if riAj(A,i,j) not in span(A.base_ring(),(riAj(A,k,j) for k in (1..i-1))):
            return j
    raise ValueError
click to hide/show revision 2
No.2 Revision

This should do the job:

def riAj(A,i,j):
    return A.row(i-1)[:j]

def pAi(A,i):
    for j in (1..A.ncols()):
        if A[0,j-1]!=0 and riAj(A,i,j) not in span(A.base_ring(),(riAj(A,k,j) for k in (1..i-1))):
            return j
    raise ValueError