def get_inverse(self):

        """Returns the inverse (matrix with the opposite effect) of this
        matrix."""

        ret = self.__new__(self.__class__, object)
        i = self._m

        i0,  i1,  i2,  i3, \
        i4,  i5,  i6,  i7, \
        i8,  i9,  i10, i11, \
        i12, i13, i14, i15 = i

        negpos=[0., 0.]
        temp = i0 * i5 * i10
        negpos[temp > 0.] += temp

        temp = i1 * i6 * i8
        negpos[temp > 0.] += temp

        temp = i2 * i4 * i9
        negpos[temp > 0.] += temp

        temp = -i2 * i5 * i8
        negpos[temp > 0.] += temp

        temp = -i1 * i4 * i10
        negpos[temp > 0.] += temp

        temp = -i0 * i6 * i9
        negpos[temp > 0.] += temp

        det_1 = negpos[0]+negpos[1]

        if (det_1 == 0.) or (abs(det_1 / (negpos[1] - negpos[0])) < \
                             (2. * 0.00000000000000001) ):
            raise Matrix44Error("notivertable", "This Matrix44 can not be inverted")

        det_1 = 1. / det_1

        ret._m = [ (i5*i10 - i6*i9)*det_1,
                  -(i1*i10 - i2*i9)*det_1,
                   (i1*i6 - i2*i5 )*det_1,
                   0.0,
                  -(i4*i10 - i6*i8)*det_1,
                   (i0*i10 - i2*i8)*det_1,
                  -(i0*i6 - i2*i4)*det_1,
                   0.0,
                  (i4*i9 - i5*i8 )*det_1,
                  -(i0*i9 - i1*i8)*det_1,
                   (i0*i5 - i1*i4)*det_1,
                   0.0,
                   0.0, 0.0, 0.0, 1.0 ]

        m = ret._m
        m[12] = - ( i12 * m[0] + i13 * m[4] + i14 * m[8] )
        m[13] = - ( i12 * m[1] + i13 * m[5] + i14 * m[9] )
        m[14] = - ( i12 * m[2] + i13 * m[6] + i14 * m[10] )

        return ret
dataset/ETHPy150Open PythonProgramming/Beginning-Game-Development-with-Python-and-Pygame/Chapter 10/gameobjects/matrix44.py/Matrix44.get_inverse/original