+ cdiag(jackres, 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, tmpmatrix);
+ gsl_vector_sub(tmpvec, jackres);
+ gsl_vector_memcpy(tmpvec2, tmpvec);
+ gsl_vector_mul(tmpvec, tmpvec2);
+ gsl_vector_add(jackerrornorm, tmpvec);
+ }
+ gsl_vector_scale( jackerrornorm,
+ (double)(O815->comargs.nmeas-1)/O815->comargs.nmeas );