void eppMatrix(double *X, double * V, int k, int n, double rho, double p){ int i, j, *iter_step; double *v, *x; double c0, c; v=(double *)malloc(sizeof(double)*n); x=(double *)malloc(sizeof(double)*n); iter_step=(int *)malloc(sizeof(int)*2); /* *X and V are k x n matrices in matlab, stored in column priority manner *x corresponds a row of X */ c0=0; for(i=0; i<k; i++){ for(j=0; j<n; j++) v[j]=V[i + j*k]; epp(x, &c, iter_step, v, n, rho, p, c0); c0=c; for(j=0; j<n; j++) X[i + j*k]=x[j]; } free(v); free(x); free(iter_step); }
TEST(ElectronPairProduction, thisIsNotNucleonic) { // Test if non-nuclei are skipped. ElectronPairProduction epp(CMB); Candidate c(11, 1E20 * eV); // electron epp.process(&c); EXPECT_DOUBLE_EQ(1E20 * eV, c.current.getEnergy()); }
TEST(ElectronPairProduction, belowEnergyTreshold) { // Test if nothing happens below 1e15 eV. ElectronPairProduction epp(CMB); Candidate c(nucleusId(1, 1), 1E14 * eV); epp.process(&c); EXPECT_DOUBLE_EQ(1E14 * eV, c.current.getEnergy()); }
void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) { /*set up input arguments */ double* v= mxGetPr(prhs[0]); int n= (int) mxGetScalar(prhs[1]); double rho= mxGetScalar(prhs[2]); double p = mxGetScalar(prhs[3]); double c0 = mxGetScalar(prhs[4]); double *x; double *c; double *iter_step; int steps; /* set up output arguments */ plhs[0] = mxCreateDoubleMatrix( n,1, mxREAL); plhs[1] = mxCreateDoubleMatrix( 1,1, mxREAL); plhs[2] = mxCreateDoubleMatrix( 1,1, mxREAL); x=mxGetPr(plhs[0]); c=mxGetPr(plhs[1]); iter_step=mxGetPr(plhs[2]); epp(x, c, &steps, v, n, rho, p, c0); *iter_step=steps; }
TEST(ElectronPairProduction, thisIsNotNucleonic) { // Test if non-nuclei are skipped ElectronPairProduction epp(CMB); Candidate c; c.current.setId(11); // electron double E = 1e20 * eV; c.current.setEnergy(E); epp.process(&c); EXPECT_DOUBLE_EQ(E, c.current.getEnergy()); }
TEST(ElectronPairProduction, belowEnergyTreshold) { // Test if nothing happens below 1e15 eV ElectronPairProduction epp(CMB); Candidate c; c.current.setId(nucleusId(1, 1)); // proton double E = 1e14 * eV; c.current.setEnergy(E); epp.process(&c); EXPECT_DOUBLE_EQ(E, c.current.getEnergy()); }
// ElectronPairProduction ----------------------------------------------------- TEST(ElectronPairProduction, allBackgrounds) { // Test if interaction data files are loaded. ElectronPairProduction epp(CMB); epp.setPhotonField(IRB_Kneiske04); epp.setPhotonField(IRB_Stecker05); epp.setPhotonField(IRB_Franceschini08); epp.setPhotonField(IRB_Finke10); epp.setPhotonField(IRB_Dominguez11); epp.setPhotonField(IRB_Gilmore12); epp.setPhotonField(IRB_Stecker16_upper); epp.setPhotonField(IRB_Stecker16_lower); }