from .core import roundmode, roundfloat
from .interval import interval


class mcmatrix(list):

    def __init__(self, arg):
        list.__init__(self)
        if arg.__class__.__name__ == "list":
            for i in range(0, arg.__len__(), 1):
                if arg[i].__class__.__name__ == "list":
                    self.append(mcmatrix(arg[i]))
                else:
                    self.append(arg[i])
        else:
            self.append(arg[i])

    def __add__(self, arg):
        answer = list()
        if arg.__class__.__name__ == "mcmatrix":
            for i in range(0, self.__len__(), 1):
                answer.append(self[i] + arg[i])
        else:
            for i in range(0, self.__len__(), 1):
                answer.append(self[i] + arg)
        return mcmatrix(answer)

    def __iadd__(self, arg):
        return mcmatrix.__add__(self, arg)

    def __radd__(self, arg):
        return mcmatrix.__add__(self, arg)

    def __sub__(self, arg):
        return mcmatrix.__add__(self, -arg)

    def __isub__(self, arg):
        return mcmatrix.__sub__(self, arg)

    def __rsub__(self, arg):
        return mcmatrix.__sub__(self, arg)

    def __mul__(self, arg):
        answer = list()
        for i in range(0, self.__len__(), 1):
            answer.append(self[i] * arg)
        return mcmatrix(answer)

    def __imul__(self, arg):
        return mcmatrix.__mul__(self, arg)

    def __rmul__(self, arg):
        return mcmatrix.__mul__(self, arg)

    def __truediv__(self, arg):
        return mcmatrix.__mul__(self, 1. / arg)

    def __itruediv__(self, arg):
        return mcmatrix.__truediv__(self, arg)

    def __rtruediv__(self, arg):
        answer = list()
        for i in range(0, self.__len__(), 1):
            answer.append(arg / self[i])
        return mcmatrix(answer)

    def __neg__(self):
        return mcmatrix.__mul__(self, -1.)

@@ -88,16 +88,35 @@
 (list):%0A
+    #size=mcmatrix.
 %0A    def
@@ -1903,8 +1903,822 @@
 f, -1.)%0A
+%0A    def transpose(self):%0A        if self%5B0%5D.__class__.__name__ == %22mcmatrix%22:%0A            vertical = self.__len__()%0A            horiontal = self%5B0%5D.__len__()%0A            answer = mcmatrix.zeros(%5Bhoriontal,vertical%5D)%0A            for i in range(0,horiontal,1):%0A                for j in range(0,vertical,1):%0A                    answer%5Bi%5D%5Bj%5D = self%5Bj%5D%5Bi%5D%0A        return answer%0A%0A    def T(self):%0A        return mcmatrix.transpose(self)%0A%0A    def numbers(shape, arg):%0A        answer = list()%0A        column = list()%0A        for j in range(0,shape%5B1%5D,1):%0A            column.append(arg)%0A        for i in range(0,shape%5B0%5D,1):%0A            answer.append(column)%0A        return mcmatrix(answer)%0A%0A    def ones(shape):%0A        return mcmatrix.numbers(shape, 1.)%0A%0A    def zeros(shape):%0A        return mcmatrix.numbers(shape, 0.)%0A

Append transpose , zeros and ones(mcmatrix)