(self, a)
return TwistedEdwardsCurveElement(x3, y3)
2 * (x, y) = (2xy / (ax^2 + y^2), (y^2 - ax^2) / (2 - ax^2 - y^2))
        :param a: TwistedEdwardsCurveElement
        :return:
2 * (x, y) = (2xy / (ax^2 + y^2), (y^2 - ax^2) / (2 - ax^2 - y^2))
        :param a: TwistedEdwardsCurveElement
        :return:
2 * ( x y ) = ( 2xy / ( ax^2 + y^2 ) ( y^2 - ax^2 ) / ( 2 - ax^2 - y^2 )) : param a : TwistedEdwardsCurveElement : return :
def _twice(self, a):
        """
        2 * (x, y) = (2xy / (ax^2 + y^2), (y^2 - ax^2) / (2 - ax^2 - y^2))
        :param a: TwistedEdwardsCurveElement
        :return:
        """
        if type(a) != TwistedEdwardsCurveElement:
            raise TypeError("Double only supports an object")
        x = a.x
        y = a.y

        # calculate essential components
        ax_square = self.FA.mul(self.a, self.FA.pow(x, 2))
        y_square = self.FA.pow(y, 2)
        two = self.FA.mul(2, self.FA.get_mul_identity())

        # calculate the first coordinate
        numerator_x3 = self.FA.mul(2, self.FA.mul(x, y))
        denominator_x3 = self.FA.add(ax_square, y_square)
        x3 = self.FA.div(numerator_x3, denominator_x3)

        # calculate the second coordinate
        numerator_y3 = self.FA.sub(y_square, ax_square)
        denominator_y3 = self.FA.sub(two, denominator_x3)
        y3 = self.FA.div(numerator_y3, denominator_y3)

        return TwistedEdwardsCurveElement(x3, y3)
def _twice ( self , a ) : if type ( a ) != TwistedEdwardsCurveElement : raise TypeError ( "Double only supports an object" ) x = a . x y = a . y # calculate essential components ax_square = self . FA . mul ( self . a , self . FA . pow ( x , 2 ) ) y_square = self . FA . pow ( y , 2 ) two = self . FA . mul ( 2 , self . FA . get_mul_identity ( ) ) # calculate the first coordinate numerator_x3 = self . FA . mul ( 2 , self . FA . mul ( x , y ) ) denominator_x3 = self . FA . add ( ax_square , y_square ) x3 = self . FA . div ( numerator_x3 , denominator_x3 ) # calculate the second coordinate numerator_y3 = self . FA . sub ( y_square , ax_square ) denominator_y3 = self . FA . sub ( two , denominator_x3 ) y3 = self . FA . div ( numerator_y3 , denominator_y3 ) return TwistedEdwardsCurveElement ( x3 , y3 )