- gsl_matrix_complex_scale ( tmpmatrix, tmpc );
-
- cdiag(tmpvec, tmpmatrix);
-
+ 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);
+