]> gitweb.michael.orlitzky.com - dunshire.git/commitdiff
Test that vec() is a no-op on vectors.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 6 Oct 2016 22:10:10 +0000 (18:10 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 6 Oct 2016 22:10:10 +0000 (18:10 -0400)
src/dunshire/matrices.py

index 1e0f2a5b7970fd19b78a2d136dc0a98dee2547af..7bfc429bdd5651b10e07cae79a653e1e3cc925b5 100644 (file)
@@ -109,18 +109,34 @@ def vec(real_matrix):
 
     EXAMPLES:
 
-       >>> A = matrix([[1,2],[3,4]])
-       >>> print(A)
-       [ 1  3]
-       [ 2  4]
-       <BLANKLINE>
+        >>> A = matrix([[1,2],[3,4]])
+        >>> print(A)
+        [ 1  3]
+        [ 2  4]
+        <BLANKLINE>
 
-       >>> print(vec(A))
-       [ 1]
-       [ 2]
-       [ 3]
-       [ 4]
-       <BLANKLINE>
+        >>> print(vec(A))
+        [ 1]
+        [ 2]
+        [ 3]
+        [ 4]
+        <BLANKLINE>
+
+    Note that if ``real_matrix`` is a vector, this function is a no-op:
+
+        >>> v = matrix([1,2,3,4], (4,1))
+        >>> print(v)
+        [ 1]
+        [ 2]
+        [ 3]
+        [ 4]
+        <BLANKLINE>
+        >>> print(vec(v))
+        [ 1]
+        [ 2]
+        [ 3]
+        [ 4]
+        <BLANKLINE>
 
     """
     return matrix(real_matrix, (len(real_matrix), 1))