From dae85d103fae8b7247667f2a621fd245f95b5db4 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 6 Oct 2016 18:10:10 -0400 Subject: [PATCH] Test that vec() is a no-op on vectors. --- src/dunshire/matrices.py | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/dunshire/matrices.py b/src/dunshire/matrices.py index 1e0f2a5..7bfc429 100644 --- a/src/dunshire/matrices.py +++ b/src/dunshire/matrices.py @@ -109,18 +109,34 @@ def vec(real_matrix): EXAMPLES: - >>> A = matrix([[1,2],[3,4]]) - >>> print(A) - [ 1 3] - [ 2 4] - + >>> A = matrix([[1,2],[3,4]]) + >>> print(A) + [ 1 3] + [ 2 4] + - >>> print(vec(A)) - [ 1] - [ 2] - [ 3] - [ 4] - + >>> print(vec(A)) + [ 1] + [ 2] + [ 3] + [ 4] + + + 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] + + >>> print(vec(v)) + [ 1] + [ 2] + [ 3] + [ 4] + """ return matrix(real_matrix, (len(real_matrix), 1)) -- 2.44.2