def __init__(self, *args):
		"""Matrix constructor

		A matrix can be created in three ways.

		1. A single integer argument is supplied.  The constructor creates a
		null square matrix of that size.  For example 

			Matrix(2)

		creates the following matrix

			0	0
			0	0

		2. Two integer arguments are supplied.  The constructor creates a null
		matrix of size first argument x second argument.  For example

			Matrix(2, 3)

		creates the following matrix

			0	0	0
			0	0	0

		3. A list of lists is supplied.  It represents a set of initial matrix
		values.  Each element is a row and each sub-list is a column.
		For example

			Matrix([[1,2,3], [4,5,6], [7,8,9]])

		creates the following matrix

			1	2	3
			4	5	6
			7	8	9

		"""
		if not (len(args) == 1 or len(args) == 2):
			raise TypeError("Matrix() takes 1 or 2 arguments (%d given)") % \
				len(args)
		if len(args) == 2:	# Two arguments
			# Create an null n,m matrix.
			row, col = args
			self.create_null_matrix(row, col)
		else:	# One argument
			if isinstance(args[0], types.IntType):
				# Create a square null matrix.
				self.create_null_matrix(args[0], args[0])
			else:
				# Create a matrix from initial values.
				self.m = args[0]
				if __debug__:
					# Verify correct format for m.
					if not isinstance(args[0], types.ListType):
						raise TypeError("Invalid initial data %s" % args[0])
					for row in args[0]:
						if not isinstance(row, types.ListType):
							raise ValueError("Invalid initial data %s" % \
								args[0])
						if not (len(row) == len(args[0][0])):
							raise ValueError("Non-rectangular initial data")
					if not (self.cols() > 0):
						raise ValueError("invalid number of columns %d" % \
							self.cols())
					if self.rows() == 1 and self.cols() == 1:
						raise ValueError("Cannot create 1x1 matrix")
Matrix constructor

		A matrix can be created in three ways.

		1. A single integer argument is supplied.  The constructor creates a
		null square matrix of that size.  For example 

			Matrix(2)

		creates the following matrix

			0	0
			0	0

		2. Two integer arguments are supplied.  The constructor creates a null
		matrix of size first argument x second argument.  For example

			Matrix(2, 3)

		creates the following matrix

			0	0	0
			0	0	0

		3. A list of lists is supplied.  It represents a set of initial matrix
		values.  Each element is a row and each sub-list is a column.
		For example

			Matrix([[1,2,3], [4,5,6], [7,8,9]])

		creates the following matrix

			1	2	3
			4	5	6
			7	8	9

		
recipes/Python/189971_Basic_Linear_Algebra_Matrix/recipe-189971.py