#NEWLINE# def __mul__( self , other ) : #NEWLINE# #INDENT# if isinstance ( other , Vector ) : #NEWLINE# #INDENT# ( out , i , j , u , v ) = ( 0 , 0 , 0 , self . value , other . value ) #NEWLINE# try : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# if ( u [ i ] [ 0 ] < v [ j ] [ 0 ] ) : #NEWLINE# #INDENT# i += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( u [ i ] [ 0 ] > v [ j ] [ 0 ] ) : #NEWLINE# #INDENT# j += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( i , j ) = ( ( i + 1 ) , ( j + 1 ) ) #NEWLINE# out += ( u [ i ] [ 1 ] * v [ j ] [ 1 ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except IndexError : #NEWLINE# #INDENT# return out #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return Vector ( tuple ( ( ( k , ( v * other ) ) for ( k , v ) in self . value ) ) )