+ cdiag(jackres, evecres, tmpmatrix);
+
+ for (int imeas=0; imeas<O815->comargs.nmeas; imeas++) {
+ gsl_matrix_complex_memcpy (tmpmatrix, totalval);
+ gsl_matrix_complex_sub (tmpmatrix, measurements[imeas][itsep]);
+ gsl_matrix_complex_scale ( tmpmatrix, gsl_complex_rect(1.0/(O815->comargs.nmeas-1), 0.0) );
+ gsl_vector_complex_memcpy( tmpvecc, totaldisco );
+ gsl_vector_complex_sub( tmpvecc, measurements_disco[imeas] );
+ for (int icorr=0; icorr<4; icorr++)
+ for (int jcorr=0; jcorr<4; jcorr++) {
+ gsl_complex discopart = gsl_complex_mul( gsl_vector_complex_get(tmpvecc, icorr),
+ gsl_complex_conjugate( gsl_vector_complex_get(tmpvecc, jcorr) )
+ );
+ discopart = gsl_complex_mul_real(discopart, pow(1.0/(O815->comargs.nmeas-1),2));
+ gsl_matrix_complex_set( tmpmatrix, icorr, jcorr,
+ gsl_complex_sub( gsl_matrix_complex_get( tmpmatrix, icorr, jcorr ),
+ discopart
+ )
+ );
+ }
+ cdiag(tmpvec, tmpmatrix2, tmpmatrix);
+
+ gsl_vector_sub(tmpvec, jackres);
+ gsl_vector_memcpy(tmpvec2, tmpvec);
+ gsl_vector_mul(tmpvec, tmpvec2);
+ gsl_vector_add(jackerrornorm, tmpvec);
+
+ gsl_matrix_complex_sub(tmpmatrix2, evecres);
+ for (int i=0; i<4; i++)
+ for (int j=0; j<4; j++) {
+ gsl_complex tmperr =
+ gsl_complex_rect( pow(GSL_REAL( gsl_matrix_complex_get( tmpmatrix2, i, j ) ),2),
+ pow(GSL_IMAG( gsl_matrix_complex_get( tmpmatrix2, i, j ) ),2));
+ gsl_matrix_complex_set(tmpmatrix, i, j, tmperr);
+ }
+ gsl_matrix_complex_add( evecerrornorm, tmpmatrix );
+ }
+ gsl_vector_scale( jackerrornorm,
+ (double)(O815->comargs.nmeas-1)/O815->comargs.nmeas );
+ gsl_matrix_complex_scale( evecerrornorm, gsl_complex_rect( (double)(O815->comargs.nmeas-1)/O815->comargs.nmeas, 0.0 ) );