def __init__(self, *args): if len(args) == 1 and isinstance(args[0], Matrix) \ and args[0].shape == (2,1): temp = args[0] elif len(args) == 2: temp = ((args[0],),(args[1],)) else: raise ValueError('Expecting 2x1 Matrix or the 2 elements of the Matrix but got %s' % str(args)) Matrix.__init__(self, temp)
def __init__(self, *args): if len(args) == 4: temp = ((args[0],args[1]),(args[2],args[3])) elif len(args) == 1 \ and isinstance(args[0], Matrix) \ and args[0].shape == (2,2): temp = args[0] else: raise ValueError('Expecting 2x2 Matrix or the 4 elements of the Matrix but got %s' % str(args)) Matrix.__init__(self, temp)