@ Override public void encode ( DMatrixRMaj F , double [ ] param ) { // see if which columns are to be used selectColumns ( F ) ; // set the largest element in the first two columns and normalize // using that value double v [ ] = new double [ ] { F . get ( 0 , col0 ) , F . get ( 1 , col0 ) , F . get ( 2 , col0 ) , F . get ( 0 , col1 ) , F . get ( 1 , col1 ) , F . get ( 2 , col1 ) } ; double divisor = selectDivisor ( v , param ) ; // solve for alpha and beta and put into param SimpleMatrix A = new SimpleMatrix ( 3 , 2 ) ; SimpleMatrix y = new SimpleMatrix ( 3 , 1 ) ; for ( int i = 0 ; i < 3 ; i ++ ) { A . set ( i , 0 , v [ i ] ) ; A . set ( i , 1 , v [ i + 3 ] ) ; y . set ( i , 0 , F . get ( i , col2 ) / divisor ) ; } SimpleMatrix x = A . solve ( y ) ; param [ 5 ] = x . get ( 0 ) ; param [ 6 ] = x . get ( 1 ) ; }
Examines the matrix structure to determine how to parameterize F .