# with self.subTest("wide"): cond = np.linalg.cond(m_bs).max() lower, upper, piv = la.lu(m_bs, 'separate') luf, piv = la.lu(m_bs, 'raw') luf = la.transpose(luf) self.assertArrayAllClose(tril(lower), tril(luf), cond=cond) self.assertArrayAllClose(upper, np.triu(luf)[box], cond=cond) # with self.subTest("wide"): cond = np.linalg.cond(m_sb).max() lower, upper, piv = la.lu(m_sb, 'separate') luf, piv = la.lu(m_sb, 'raw') luf = la.transpose(luf) self.assertArrayAllClose(tril(lower), tril(luf)[box[:-1]], cond=cond) self.assertArrayAllClose(upper, np.triu(luf), cond=cond) @expectedFailure @errstate @hy.given(hn.constant('(a,a)', ['d', 'D'], min_side=2)) def test_low_rank(self, ones_ss): unitary, right = la.qr(ones_ss) self.assertArrayAllClose(unitary @ right, ones_ss) lower, upper, _ = la.lu(ones_ss) self.assertArrayAllClose(lower @ upper, ones_ss) with self.assertRaisesRegex(*utn.invalid_err): la.solve(ones_ss, ones_ss[..., :2]) # ============================================================================= if __name__ == '__main__': main(verbosity=2)
"""Main entry point""" import sys import os.path from numpy_linalg.testing import main this_dir = os.path.dirname(__file__) executable = os.path.basename(sys.executable) argv = [executable + ' -m tests', 'discover', '-s', this_dir] + sys.argv[1:] main(module=None, argv=argv)