private void gaussNewton ( double betas [ ] ) { A_temp . reshape ( L_full . numRows , numControl ) ; v_temp . reshape ( L_full . numRows , 1 ) ; x . reshape ( numControl , 1 , false ) ; // don't check numControl inside in hope that the JVM can optimize the code better if ( numControl == 4 ) { for ( int i = 0 ; i < numIterations ; i ++ ) { UtilLepetitEPnP . jacobian_Control4 ( L_full , betas , A_temp ) ; UtilLepetitEPnP . residuals_Control4 ( L_full , y , betas , v_temp . data ) ; if ( ! solver . setA ( A_temp ) ) return ; solver . solve ( v_temp , x ) ; for ( int j = 0 ; j < numControl ; j ++ ) { betas [ j ] -= x . data [ j ] ; } } } else { for ( int i = 0 ; i < numIterations ; i ++ ) { UtilLepetitEPnP . jacobian_Control3 ( L_full , betas , A_temp ) ; UtilLepetitEPnP . residuals_Control3 ( L_full , y , betas , v_temp . data ) ; if ( ! solver . setA ( A_temp ) ) return ; solver . solve ( v_temp , x ) ; for ( int j = 0 ; j < numControl ; j ++ ) { betas [ j ] -= x . data [ j ] ; } } } }
Optimize beta values using Gauss Newton .