// can be computed exactly and efficiently.
// Explicitly make a column vector so that this works when A is a
// numpy matrix (as opposed to ndarray or sparse matrix).
v = np.ones((A.shape[0], 1), dtype=float)
M = abs(A).T
for i in range(p):
v = M.dot(v)
A_abs_one_norm = max(v)
// Treat zero norm as a special case.
if not A_abs_one_norm:
return 0
After Change
A value related to a bound.
if len(A.shape) != 2 or A.shape[0] != A.shape[1]:
raise ValueError("expected A to be like a square matrix")
p = 2*m + 1