예제 #1
0
    def testCreation(self):

        testMatrix = Matrix()
        
        for row in range(4):
            for col in range(4):
                self.assertTrue(testMatrix.getValue(row, col) == 0)
                
        testMatrix.setValue(0, 0, 1.893)
        testMatrix.setValue(2, 1, -200.1)
        testMatrix.setValue(3, 2, 4)
        
        self.assertTrue(testMatrix.getValue(0, 0) == 1.893)
        self.assertTrue(testMatrix.getValue(2, 1) == -200.1)
        self.assertTrue(testMatrix.getValue(3, 2) == 4)
예제 #2
0
from Matrix import Matrix

m = Matrix (3,3)

m.setValue (3, 5.5)
print m.getValue(3)
m.printMatrix()