Beispiel #1
0
    def old_code_container(self):
        r = sp.array([1.0, 0.9, 0.8])
        C = sp_la.toeplitz(r)
        cnos = [10, 15.3, 50]

        print 'initial matrix:'
        print C
        print

        for cno in cnos:
            print 'initial condition:', matrix_cond(C)
            print 'target condition:', cno
            print
            Ddiag = diagonal_loading(C, cno)
            Dcol = coloured_loading(C, cno)
            print 'diagonally loaded:', matrix_cond(Ddiag)
            print Ddiag
            print 'coloured loaded:', matrix_cond(Dcol)
            print Dcol
            print

        print 'C matrix:', matrix_cond(C)
        print C
        Cnew = coloured_loading(C, 10, overwrite_mat=True)
        print 'Cnew loaded at condition:', matrix_cond(Cnew)
        print Cnew
        print 'same matrices: C is Cnew', C is Cnew
        print
Beispiel #2
0
    def old_code_container(self):
        r = sp.array([1.0, 0.9, 0.8])
        C = sp_la.toeplitz(r)
        cnos = [10, 15.3, 50]

        print 'initial matrix:'
        print C
        print

        for cno in cnos:
            print 'initial condition:', matrix_cond(C)
            print 'target condition:', cno
            print
            Ddiag = diagonal_loading(C, cno)
            Dcol = coloured_loading(C, cno)
            print 'diagonally loaded:', matrix_cond(Ddiag)
            print Ddiag
            print 'coloured loaded:', matrix_cond(Dcol)
            print Dcol
            print

        print 'C matrix:', matrix_cond(C)
        print C
        Cnew = coloured_loading(C, 10, overwrite_mat=True)
        print 'Cnew loaded at condition:', matrix_cond(Cnew)
        print Cnew
        print 'same matrices: C is Cnew', C is Cnew
        print
Beispiel #3
0
    def testMatrixCond(self):
        """test for matrix condition"""

        self.assertEqual(matrix_cond(sp.eye(10)), 1.0)
        self.assertEqual(matrix_cond(self.mat), 4.5292109924517616)
Beispiel #4
0
    def testMatrixCond(self):
        """test for matrix condition"""

        self.assertEqual(matrix_cond(sp.eye(10)), 1.0)
        self.assertEqual(matrix_cond(self.mat), 4.5292109924517616)