question: public Matrix [ ] compute ( Matrix loghyper , Matrix X , Matrix Xstar ) { if ( loghyper . getColumnDimension ( ) != 1 || loghyper . getRowDimension ( ) != numParameters ( ) ) throw new IllegalArgumentException ( "Wrong number of hyperparameters, " + loghyper . getRowDimension ( ) + " instead of " + numParameters ( ) ) ; final double ell = Math . exp ( loghyper . get ( 0 , 0 ) ) ; final double em2 = 1 / ( ell * ell ) ; final double oneplusem2 = 1 + em2 ; final double sf2 = Math . exp ( 2 * loghyper . get ( 1 , 0 ) ) ; final int m = X . getRowDimension ( ) ; final int n = X . getColumnDimension ( ) ; double [ ] [ ] x = X . getArray ( ) ; final int mstar = Xstar . getRowDimension ( ) ; final int nstar = Xstar . getColumnDimension ( ) ; double [ ] [ ] xstar = Xstar . getArray ( ) ; double [ ] sumxstardotTimesxstar = new double [ mstar ] ; for ( int i = 0 ; i < mstar ; i ++ ) { double t = 0 ; for ( int j = 0 ; j < nstar ; j ++ ) { final double tt = xstar [ i ] [ j ] ; t += tt * tt * em2 ; } sumxstardotTimesxstar [ i ] = t ; } Matrix A = new Matrix ( mstar , 1 ) ; double [ ] [ ] a = A . getArray ( ) ; for ( int i = 0 ; i < mstar ; i ++ ) { a [ i ] [ 0 ] = sf2 * Math . asin ( ( em2 + sumxstardotTimesxstar [ i ] ) / ( oneplusem2 + sumxstardotTimesxstar [ i ] ) ) ; } double [ ] sumxdotTimesx = new double [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { double t = 0 ; for ( int j = 0 ; j < n ; j ++ ) { final double tt = x [ i ] [ j ] ; t += tt * tt * em2 ; } sumxdotTimesx [ i ] = t + oneplusem2 ; } Matrix B = new Matrix ( m , mstar ) ; double [ ] [ ] b = B . getArray ( ) ; for ( int i = 0 ; i < m ; i ++ ) { final double [ ] xi = x [ i ] ; for ( int j = 0 ; j < mstar ; j ++ ) { double t = 0 ; final double [ ] xstarj = xstar [ j ] ; for ( int k = 0 ; k < n ; k ++ ) { t += xi [ k ] * xstarj [ k ] * em2 ; } b [ i ] [ j ] = t + em2 ; } } for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < mstar ; j ++ ) { b [ i ] [ j ] = sf2 * Math . asin ( b [ i ] [ j ] / Math . sqrt ( ( sumxstardotTimesxstar [ j ] + oneplusem2 ) * sumxdotTimesx [ i ] ) ) ; } } return new Matrix [ ] { A , B } ; }
target:  Compute compute test set covariances