def genMatrix(size, kind): m = Matrix(size) if kind == "random": m.random(seed()) elif kind == "triangular": m.randomUpperTriangular(seed()) elif kind == "hilbert": m.hilbert() elif kind == "diagonal_dominant": m.randomDiagonalDominant(seed()) elif kind == "almost_singular": m.randomAlmostSingular(seed()) elif kind == "zero_minor": m.randomZeroMinor(seed()) elif kind == "tridiagonal": m.randomTridiagonal(seed()) else: return None return m
def testManipulators(self): a = Matrix(44) a.zero() a.one() a.hilbert()
def testHilbert(self): m = Matrix(50) m.hilbert() (l,u) = m.lu() self.assertTrue(m.isAlmostEqual(l*u))