#NEWLINE# def compute_dr_wrt( self , wrt ) : #NEWLINE# #INDENT# if ( wrt not in ( self . v , self . rt , self . t ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( wrt is self . t ) : #NEWLINE# #INDENT# if ( ( not hasattr ( self , '_drt' ) ) or ( self . _drt . shape [ 0 ] != self . v . r . size ) ) : #NEWLINE# #INDENT# IS = np . arange ( self . v . r . size ) #NEWLINE# JS = ( IS % 3 ) #NEWLINE# data = np . ones ( len ( IS ) ) #NEWLINE# self . _drt = sp . csc_matrix ( ( data , ( IS , JS ) ) ) #NEWLINE# #UNINDENT# return self . _drt #NEWLINE# #UNINDENT# if ( wrt is self . rt ) : #NEWLINE# #INDENT# ( rot , rot_dr ) = cv2 . Rodrigues ( self . rt . r ) #NEWLINE# rot_dr = rot_dr . reshape ( ( 3 , 3 , 3 ) ) #NEWLINE# dr = np . einsum ( 'abc, zc -> zba' , rot_dr , self . v . r ) . reshape ( ( ( - 1 ) , 3 ) ) #NEWLINE# return IS #NEWLINE# #UNINDENT# if ( wrt is self . v ) : #NEWLINE# #INDENT# rot = cv2 . Rodrigues ( self . rt . r ) [ 0 ] #NEWLINE# IS = np . repeat ( np . arange ( self . v . r . size ) , 3 ) #NEWLINE# JS = np . repeat ( np . arange ( self . v . r . size ) . reshape ( ( ( - 1 ) , 3 ) ) , 3 , axis = 0 ) #NEWLINE# data = np . vstack ( [ rot for i in range ( ( self . v . r . size / 3 ) ) ] ) #NEWLINE# result = sp . csc_matrix ( ( data . ravel ( ) , ( IS . ravel ( ) , JS . ravel ( ) ) ) ) #NEWLINE# return result