(s, _lambda, P)
return P
Update ``P`` such that for the updated `P'` `P' v = e_{s}`.
Update ``P`` such that for the updated `P'` `P' v = e_{s}`.
Update P such that for the updated P P v = e_ { s } .
def _update(s, _lambda, P):
    """
    Update ``P`` such that for the updated `P'` `P' v = e_{s}`.
    """
    k = min([j for j in xrange(s, len(_lambda)) if _lambda[j] != 0])

    for r in xrange(len(_lambda)):
        if r != k:
            P[r] = [P[r][j] - (P[k][j] * _lambda[r]) / _lambda[k] for j in xrange(len(P[r]))]

    P[k] = [P[k][j] / _lambda[k] for j in xrange(len(P[k]))]
    P[k], P[s] = P[s], P[k]

    return P
def _update ( s , _lambda , P ) : k = min ( [ j for j in xrange ( s , len ( _lambda ) ) if _lambda [ j ] != 0 ] ) for r in xrange ( len ( _lambda ) ) : if r != k : P [ r ] = [ P [ r ] [ j ] - ( P [ k ] [ j ] * _lambda [ r ] ) / _lambda [ k ] for j in xrange ( len ( P [ r ] ) ) ] P [ k ] = [ P [ k ] [ j ] / _lambda [ k ] for j in xrange ( len ( P [ k ] ) ) ] P [ k ] , P [ s ] = P [ s ] , P [ k ] return P