mailr9335 - /1.3/test_suite/unit_tests/_maths_fns/test_kronecker_product.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on August 19, 2009 - 10:29:
Author: bugman
Date: Wed Aug 19 10:29:13 2009
New Revision: 9335

URL: http://svn.gna.org/viewcvs/relax?rev=9335&view=rev
Log:
Added a unit test for the maths_fns.kronecker_product.kron_prod() function.


Modified:
    1.3/test_suite/unit_tests/_maths_fns/test_kronecker_product.py

Modified: 1.3/test_suite/unit_tests/_maths_fns/test_kronecker_product.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_maths_fns/test_kronecker_product.py?rev=9335&r1=9334&r2=9335&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/_maths_fns/test_kronecker_product.py (original)
+++ 1.3/test_suite/unit_tests/_maths_fns/test_kronecker_product.py Wed Aug 19 
10:29:13 2009
@@ -21,7 +21,7 @@
 
###############################################################################
 
 # Python module imports.
-from numpy import float64, zeros
+from numpy import array, eye, float64, zeros
 from sys import stdout
 from unittest import TestCase
 
@@ -123,6 +123,25 @@
         return new
 
 
+    def test_kron_prod(self):
+        """Test the Kronecker product function kron_prod()."""
+
+        # The 3D, rank-2 matrices.
+        R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)
+        R2 = array([[1, 0, 0], [0, 0, 0], [0, 0, 0]], float64)
+
+        # The Kronecker product.
+        C = kron_prod(R1, R2)
+
+        # Print outs.
+        print("R1:\n%s" % R1)
+        print("R2:\n%s" % R2)
+        print("C:\n%s" % C)
+
+        # Checks.
+        self.assertEqual(C.shape, (9, 9))
+
+
     def test_transpose_12(self):
         """Check the 1,2 transpose of a rank-4, 3D tensor."""
 




Related Messages


Powered by MHonArc, Updated Wed Aug 19 10:40:04 2009