Commits

German Larrain committed 66f4cc7

utils.math.matrix_as_tuple: fixed its docstrings; created a test for it.

Comments (0)

Files changed (2)

ars/utils/mathematical.py

 def matrix_as_tuple(matrix_):
 	"""Convert ``matrix_`` to a tuple.
 
-	:param matrix_:
-	:type matrix_: nested tuples, e.g. ((1,0),(1,1),(2,5))
+	Example:
+
+	>>> matrix_as_tuple(((1, 2), (3, 4)))
+	(1, 2, 3, 4)
+
+	:param matrix_: nested tuples
+	:type matrix_: tuple
+	:return: ``matrix_`` flattened as a tuple
+	:rtype: tuple
 
 	"""
 	#TODO: improve a lot

tests/utils_mathematical.py

 	arr = numpy.array(((2, 2), (2, -2)))
 	print(mut.np_matrix_to_tuple(arr))
 
+def test_matrix_as_tuple():
+	print(mut.matrix_as_tuple(((1, 2), (3, 4))))
+
 
 def test_matrix_multiply():
 	print (mut.matrix_multiply(((2,),(1,)), ((1,0,0,0,2,0,0,0,1), )))
 if __name__ == "__main__":
 
 	test_np_matrix_to_tuple()
+	test_matrix_as_tuple()
 	test_matrix_multiply()
 	test_XYZ_axes_for_orthogonality()
 	test_calc_acceleration()