def zeros(cls, r, c=None): """Return an r x c matrix of zeros, square if c is omitted.""" if is_sequence(r): SymPyDeprecationWarning( feature="The syntax zeros([%i, %i])" % tuple(r), useinstead="zeros(%i, %i)." % tuple(r), issue=3381, deprecated_since_version="0.7.2", ).warn() r, c = r else: c = r if c is None else c r = as_int(r) c = as_int(c) return cls._new(r, c, [cls._sympify(0)]*r*c)
def eye(cls, n): """Return an n x n identity matrix.""" n = as_int(n) mat = [cls._sympify(0)]*n*n mat[::n + 1] = [cls._sympify(1)]*n return cls._new(n, n, mat)