I am trying to create a 3x3 Matrix class in python. I am having difficulty initializing the 2D array properly.
In the following code I am getting an error saying that Matrix3x3 has no attribute m. If I initialize m before the init, it seems like 'm' acts like a static variable, which I do not want.
class Matrix3x3:
#[1 0 0]
#[0 1 0]
#[0 0 1]
def __init__(self, m):
#self.m[row][column]
self.m[0][0] = m[0][0];
self.m[0][1] = m[0][1];
self.m[0][2] = m[0][2];
self.m[1][0] = m[1][0];
self.m[1][1] = m[1][1];
self.m[1][2] = m[1][2];
self.m[2][0] = m[2][0];
self.m[2][1] = m[2][1];
self.m[2][2] = m[2][2];