# Path: hftools/dataset/dim.py
# class DimSweep(DiagAxis):
#     pass
# 
# class DimMatrix_i(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_i
#     _deriv_axis = DimMatrix_Deriv_i
#     sortprio = 1000
# 
# class DimMatrix_j(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_j
#     _deriv_axis = DimMatrix_Deriv_j
#     sortprio = 1001
# 
# Path: hftools/dataset/arrayobj.py
# class hfarray(_hfarray):
#     def __new__(subtype, data, dims=None, dtype=None, copy=True, order=None,
#                 subok=False, ndmin=0, unit=None, outputformat=None, info=None):
#         if hasattr(data, "__hfarray__"):
#             data, dims = data.__hfarray__()
#             if unit is None and len(dims) == 1:
#                 unit = dims[0].unit
#             if outputformat is None and len(dims) == 1:
#                 outputformat = dims[0].outputformat
#         return _hfarray.__new__(subtype, data, dims=dims, dtype=dtype,
#                                 copy=copy, order=order, subok=subok,
#                                 ndmin=ndmin, unit=unit,
#                                 outputformat=outputformat, info=info)
# 
# Path: hftools/testing/common.py
# class TestCase(unittest.TestCase):
#     def assertAllclose(self, a, b, rtol=1e-05, atol=1e-08, msg=None):
#         a = np.asanyarray(a)
#         b = np.asanyarray(b)
#         if msg is None:
#             msg = "a (%s) not close to b (%s)" % (a, b)
#         self.assertTrue(np.allclose(a, b, rtol, atol), msg)
# 
#     def assertIsNotInstance(self, obj, cls):
#         self.assertFalse(isinstance(obj, cls))
# 
#     def assertIsInstance(self, obj, cls, msg=None):
#         """Same as self.assertTrue(isinstance(obj, cls)), with a nicer
#         default message."""
#         if not isinstance(obj, cls):
#             arg = (unittest.case.safe_repr(obj), cls)
#             standardMsg = '%s is not an instance of %r' % arg
#             self.fail(self._formatMessage(msg, standardMsg))
# 
#     def assertHFToolsWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsWarning)
#         self.assertRaises(HFToolsWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsWarning)
# 
#     def assertHFToolsDeprecationWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsDeprecationWarning)
#         self.assertRaises(HFToolsDeprecationWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsDeprecationWarning)
# 
# def make_load_tests(module):
#     """Add doctests to tests for module
# 
#     usage::
#         load_tests = make_load_tests(module)
#     """
#     warnings.simplefilter("error", HFToolsWarning)
#     warnings.simplefilter("error", HFToolsDeprecationWarning)
# #    warnings.simplefilter("error", DeprecationWarning)
# 
#     def load_tests(loader, standard_tests, pattern):
#         suite = unittest.TestSuite()
#         suite.addTests(standard_tests)
#         DocTests = doctest.DocTestSuite(module)
#         suite.addTests(DocTests)
#         return suite
#     return load_tests


import os
import numpy as np
import hftools.math as hfmath
from hftools.dataset import hfarray, DimSweep, DimMatrix_i, DimMatrix_j
from hftools.testing import TestCase, make_load_tests
        self.assertEqual(res.shape, (3, 2, 2))
        self.assertEqual(res.dims, (self.J, self.mi, self.mj))

    def test_2(self):
        res = hfmath.matrix_multiply(self.m, self.m2)
        self.assertAllclose(res, np.dot([[1., 2], [3, 4]], [[1., 2], [3, 4]]))
        self.assertEqual(res.shape, (3, 2, 2))
        self.assertEqual(res.dims, (self.J, self.mi, self.mj))

    def test_3(self):
        res = hfmath.matrix_multiply(self.m2, self.m)
        self.assertAllclose(res, np.dot([[1., 2], [3, 4]], [[1., 2], [3, 4]]))
        self.assertEqual(res.shape, (3, 2, 2))
        self.assertEqual(res.dims, (self.J, self.mi, self.mj))

    def test_nparray(self):
        self.assertRaises(Exception, hfmath.matrix_multiply,
                          np.array(self.m), np.array(self.m))


class TestDet(TestInv):
    def test_1(self):
        res = hfmath.det(self.m)
        self.assertAllclose(res, -2)
        self.assertEqual(res.shape, (3, ))
        self.assertEqual(res.dims, (self.J, ))

if __name__ == '__main__':
    I = DimSweep("I", [1, 2])
    J = DimSweep("J", [10, 20, 30])

# Path: hftools/dataset/dim.py
# class DimSweep(DiagAxis):
#     pass
# 
# class DimMatrix_i(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_i
#     _deriv_axis = DimMatrix_Deriv_i
#     sortprio = 1000
# 
# class DimMatrix_j(_DimMatrix):
#     _indep_axis = DimMatrix_Indep_j
#     _deriv_axis = DimMatrix_Deriv_j
#     sortprio = 1001
# 
# Path: hftools/dataset/arrayobj.py
# class hfarray(_hfarray):
#     def __new__(subtype, data, dims=None, dtype=None, copy=True, order=None,
#                 subok=False, ndmin=0, unit=None, outputformat=None, info=None):
#         if hasattr(data, "__hfarray__"):
#             data, dims = data.__hfarray__()
#             if unit is None and len(dims) == 1:
#                 unit = dims[0].unit
#             if outputformat is None and len(dims) == 1:
#                 outputformat = dims[0].outputformat
#         return _hfarray.__new__(subtype, data, dims=dims, dtype=dtype,
#                                 copy=copy, order=order, subok=subok,
#                                 ndmin=ndmin, unit=unit,
#                                 outputformat=outputformat, info=info)
# 
# Path: hftools/testing/common.py
# class TestCase(unittest.TestCase):
#     def assertAllclose(self, a, b, rtol=1e-05, atol=1e-08, msg=None):
#         a = np.asanyarray(a)
#         b = np.asanyarray(b)
#         if msg is None:
#             msg = "a (%s) not close to b (%s)" % (a, b)
#         self.assertTrue(np.allclose(a, b, rtol, atol), msg)
# 
#     def assertIsNotInstance(self, obj, cls):
#         self.assertFalse(isinstance(obj, cls))
# 
#     def assertIsInstance(self, obj, cls, msg=None):
#         """Same as self.assertTrue(isinstance(obj, cls)), with a nicer
#         default message."""
#         if not isinstance(obj, cls):
#             arg = (unittest.case.safe_repr(obj), cls)
#             standardMsg = '%s is not an instance of %r' % arg
#             self.fail(self._formatMessage(msg, standardMsg))
# 
#     def assertHFToolsWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsWarning)
#         self.assertRaises(HFToolsWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsWarning)
# 
#     def assertHFToolsDeprecationWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsDeprecationWarning)
#         self.assertRaises(HFToolsDeprecationWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsDeprecationWarning)
# 
# def make_load_tests(module):
#     """Add doctests to tests for module
# 
#     usage::
#         load_tests = make_load_tests(module)
#     """
#     warnings.simplefilter("error", HFToolsWarning)
#     warnings.simplefilter("error", HFToolsDeprecationWarning)
# #    warnings.simplefilter("error", DeprecationWarning)
# 
#     def load_tests(loader, standard_tests, pattern):
#         suite = unittest.TestSuite()
#         suite.addTests(standard_tests)
#         DocTests = doctest.DocTestSuite(module)
#         suite.addTests(DocTests)
#         return suite
#     return load_tests


# Path: hftools/tests/test_math.py
import os
import numpy as np
import hftools.math as hfmath
from hftools.dataset import hfarray, DimSweep, DimMatrix_i, DimMatrix_j
from hftools.testing import TestCase, make_load_tests

        self.assertEqual(res.shape, (3, 2, 2))
        self.assertEqual(res.dims, (self.J, self.mi, self.mj))

    def test_2(self):
        res = hfmath.matrix_multiply(self.m, self.m2)
        self.assertAllclose(res, np.dot([[1., 2], [3, 4]], [[1., 2], [3, 4]]))
        self.assertEqual(res.shape, (3, 2, 2))
        self.assertEqual(res.dims, (self.J, self.mi, self.mj))

    def test_3(self):
        res = hfmath.matrix_multiply(self.m2, self.m)
        self.assertAllclose(res, np.dot([[1., 2], [3, 4]], [[1., 2], [3, 4]]))
        self.assertEqual(res.shape, (3, 2, 2))
        self.assertEqual(res.dims, (self.J, self.mi, self.mj))

    def test_nparray(self):
        self.assertRaises(Exception, hfmath.matrix_multiply,
                          np.array(self.m), np.array(self.m))


class TestDet(TestInv):
    def test_1(self):
        res = hfmath.det(self.m)
        self.assertAllclose(res, -2)
        self.assertEqual(res.shape, (3, ))
        self.assertEqual(res.dims, (self.J, ))

if __name__ == '__main__':
    I = DimSweep("I", [1, 2])
    J = DimSweep("J", [10, 20, 30])

    K = DimSweep("K", [100, 200, 300, 400])