void build_each(int a, int b, double* center_coef, double* curv, double* graph, int* graph_size, int switcher) { a -= 1;b -= 1; if (graph_size[a] == max_len) {return;} for (int i = 0;i < graph_size[a];i++) { double* p = getE(graph,a,i*2); if (fabs(*p-double(b+1)) < 0.001) {return;} } //mexPrintf("%d %d\n",a,b); double* p = getE(graph,a,graph_size[a]*2); *p = b+1; switch (switcher) { case 4: *(p+1) = fabs(center_coef[a]+center_coef[b]); break; case 3: *(p+1) = fabs((center_coef[a]+center_coef[b])/sqrt(curv[a]*curv[b])); break; default: *(p+1) = fabs((center_coef[a]+center_coef[b])/(curv[a]*curv[b])); break; } graph_size[a] += 1; }
//--------------------------------------------------------------------------- void comp_Heun() { E = getE(f,t); double wtemp = w + E*Dt; double ftemp = f + wtemp*Dt; w += Dt*(E + getE(f,t+Dt))/2.; f += Dt*(w + wtemp)/2.; f = mod2pi(f); }
//--------------------------------------------------------------------------- void comp_Verlet_V() { if(!starteddrawing) E = getE(f,t); // solves problem when // starting E is 0 or wierder double oldE = E; f = f + w*Dt + 0.5*E*Dt*Dt; E = getE(f,t+Dt); w = w + (E+oldE)*Dt/2.; f = mod2pi(f); }
matrix getMatrixLLMatchAtRow(matrix_linklist LL, double match, int R, int * numMatches){ #ifdef _ERROR_CHECKING_ON_ if(LL==NULL){ #ifdef _ERROR_ fprintf(stderr,"ERROR LL is NULL in getMatrixLLMatchAtRow\n"); #endif #ifdef _FORCE_HARD_CRASH_ exit(1); #endif return NULL; } #endif *numMatches =getMatrixLLNumberMatchAtRow( LL,(double)match,R); matrix matches; #ifdef _ERROR_CHECKING_ON_ if(*numMatches<0){ matches=NULL; #ifdef _ERROR_ fprintf(stderr,"numMatches in getMatrixLLMatchAtRow is less than 0\n"); #endif #ifdef _FORCE_HARD_CRASH_ exit(1); #endif return NULL; } #endif if(*numMatches==0){ matches=NULL; return matches; } printf("LL print numMatches %d\n",*numMatches); matches = newMatrix(*numMatches,1); int index; int seq; seq = 1; index = 1; LL_MNode node = LL->start; while( node!=NULL){ if(match==getE(node->data,R,1)){ setE(matches,index,1,seq); printf("matchesRec %g\n",getE(matches,index,1)); index++; } node=node->next; seq++; } return matches; }
double CMesh::getFOSSST() { for (int i=mXSize; i> 0; i--) { double mT = getT(0,i-1,0); if ( mT > mFOTemp) { double v1 = ( getPixy(0,i-1,0,1,1) + getPixy(0,i-1,0,2,2)) /( getE(0,i-1,0) + getP(0,i-1,0)); double v2 = ( getPixy(0,i,0,1,1) + getPixy(0,i,0,2,2)) /( getE(0,i,0) + getP(0,i,0)); return (1./JHBARC) * (v1 + (v2- v1) * ((mFOTemp - mT) /(getT(0,i,0) - mT))); } } return 0.; }
int getMatrixLLNumberElemGreaterThanMatchAtRow(matrix_linklist LL, double match, int R){ if(LL==NULL){ fprintf(stderr,"ERROR LL is NULL in getMatrixLLNumberElemGreaterThanMatchAtRow\n"); } int rows; LL_MNode node = LL->start; int count = 0; while(node!=NULL){ rows = getRows(node->data); if(R>rows){ fprintf(stderr,"ERROR getMatrixLLNumberMatchAtRow data data only\n"); fprintf(stderr," has %d rows but you have requested\n",rows); fprintf(stderr," a match with row %d.\n",R); return -1; } if(getE(node->data,R,1)>match){ count++; } node=node->next; } return count; }
int getMatrixLLLastMatchAtRow(matrix_linklist LL, double match, int R){ if(LL==NULL){ fprintf(stderr,"ERROR LL is NULL in getMatrixLLLastMatch\n"); return -1; } LL_MNode node = LL->start; int rows; int seq = 0; int lastseq = -1; while(node!=NULL){ seq++; rows = getRows(node->data); if(R>rows){ fprintf(stderr,"ERROR getMatrixLLLastMatch data data only\n"); fprintf(stderr," has %d rows but you have requested\n",rows); fprintf(stderr," a match with row %d.\n",R); return -1; } if(getE(node->data,R,1)==match){ lastseq = seq; } node=node->next; } return lastseq; }
int printMatrixLL(matrix_linklist LL){ #ifdef _ERROR_CHECKING_ON_ if(LL==NULL){ #ifdef _ERROR_ fprintf(stderr,"ERROR LL is NULL in printMatrixLL\n"); #endif #ifdef _FORCE_HARD_CRASH_ exit(1); #endif return -1; } #endif int rows; int i; printf("\nLength %d\n",LL->length); LL_MNode node = LL->start; int count; count = 1; while(node!=NULL){ rows = getRows(node->data); printf("Sequence %d \t Rows of Data %d\n",count,rows); for(i=1;i<=rows;i++){ printf("Row %d %g\n",i,getE(node->data,i,1)); } node=node->next; count++; } printf("Finished with printMatrixLL\n"); return 0; }
int printMatrix(const_matrix mtx) { if (!mtx){ printf("Matrix does not appear to exist!\n"); return -1; } int i; int j; int totalRows = getRows(mtx); int totalCols = mtx->cols; matrix mtxtemp; printf("Rows %d Columns %d\n",totalRows, totalCols); mtxtemp = mtx; while(mtxtemp!=NULL){ for (i=1;i<=mtxtemp->rows;i++) { for(j=1;j<=mtxtemp->cols;j++){ printf("%.6g \t",getE(mtxtemp,i,j)); } printf("\n"); } mtxtemp=mtxtemp->Extra; } return 0; }
void thermalFeedbackCell(struct RUNPARAMS *param, struct CELL *cell,struct PART *curp, int level, REAL E){ // ---------------------------------------------------------- /// Inject an energy "E" in the cell "cell" on thermal form. //---------------------------------------------------------- #ifdef SNTEST #endif // SNTEST printf("injecting Energy in thermal form within a cell\n"); //REAL mtot_feedback = curp->mass* param->sn->ejecta_proportion; //REAL dv = POW(0.5,3.*level); //REAL d_e = mtot_feedback/dv ; //curp->mass -= mtot_feedback; //cell->field.d += d_e; cell->field.E += E; cell->field.p += E*(GAMMA-1.); //Energy conservation #ifdef DUAL_E // struct Utype U; // conservative field structure // W2U(&cell->field, &U); // primitive to conservative // U.eint*=1.+d_e/cell->field.d; // compute new internal energy // U2W(&U, &cell->field); // back to primitive #else // cell->field.p*=1.+d_e/cell->field.d; // compute new internal energy #endif getE(&cell->field); //compute new total energy cell->field.p=FMAX(cell->field.p,PMIN); cell->field.a=SQRT(GAMMA*cell->field.p/cell->field.d); // compute new sound speed }
int main() { double source[ROWS][COLS]; //a getE(source,ROWS); //e显示结果,其中调用了b,c,d过程 showResult(source); return 0; }
realkind FieldDataCPU::EFieldEnergy(void) { double Ex_t, Ey_t, Ez_t, Emag; Emag = 0; for(int k=0;k<nz;k++) { for(int j=0;j<ny;j++) { for(int i=0;i<nx;i++) { Ex_t = getE(i,j,k,0); Ey_t = getE(i,j,k,1); Ez_t = getE(i,j,k,2); Emag += (Ex_t*Ex_t + 0.0*Ey_t*Ey_t + 0.0*Ez_t*Ez_t); } } } Emag *= 0.5*pdata->dxdi*pdata->xi*pdata->xi; if(pdata->ndimensions == 1) Emag /= pdata->ny*pdata->nz*pdata->Lx; if(pdata->ndimensions > 1) Emag *= pdata->dydi/(pdata->nz*pdata->Lx*pdata->Ly); if(pdata->ndimensions > 2) Emag *= pdata->dzdi*pdata->nz; // Emag *= epsilon_0_p*pdata->T0/(pdata->L0*pdata->L0*pdata->q0*pdata->q0); realkind energy = Emag; return energy; }
double *separation_of_centers(double t, double tc, double per, double a, double inc, double ecc, double omega, double a_rs, double Ratio){ // based on equations in Winn 2010 (chapter of sara seager book same year) double r,f,M,n,tp,E,eps; double X,Y,Z; //have to scale a double au = 1.4960e11; // m a = a*au; omega = omega*M_PI/180; // change omega from degrees to radians double stellar_r = a/a_rs; double image_scale = stellar_r/Ratio; n = 2.*M_PI/per; // mean motion eps = 1.0e-7; inc = inc*M_PI/180.0; // translate inclination into radians f = M_PI/2. - omega; //true anomaly corresponding to time of primary transit center E = 2.*atan(sqrt((1. - ecc)/(1. + ecc))*tan(f/2.)); //corresponding eccentric anomaly M = E - ecc*sin(E); tp = tc - per*M/2./M_PI; //time of periastron if(ecc < 1.0e-5){ f = ((t - tp)/per - (int)((t - tp)/per))*2.*M_PI; //calculates f for a circular orbit } else{ M = n*(t - tp); E = getE(M, ecc); f = 2.*atan(sqrt((1.+ecc)/(1.-ecc))*tan(E/2.)); } r = a*(1-pow(ecc,2))/(1 + ecc*cos(f)); X = -r*cos(omega + f); Y = -r*sin(omega + f)*cos(inc); Z = r*sin(omega + f)*sin(inc); double *coords = malloc(sizeof(double) *4); // dynamic `array (size 4) of pointers to int` coords[0] = X/image_scale; coords[1] = Y/image_scale; coords[2] = Z/image_scale; coords[3] = Z; return coords; }
int printMNode( LL_MNode node ){ int rows; int i; int count; count = 1; while(node!=NULL){ rows = getRows(node->data); printf("Sequence %d \t Rows of Data %d\n",count,rows); for(i=1;i<=rows;i++){ printf("Row %d %g\n",i,getE(node->data,i,1)); } node=node->next; count++; } return 0; }
void conserveField(struct Wtype *field, struct RUNPARAMS *param, struct PART *star, REAL dx, REAL aexp, REAL mstar){ // ----------------------------------------------------------// /// compute the conservations equations after a star is created // ----------------------------------------------------------// REAL drho = mstar / POW(dx,3.); struct Utype U; struct Wtype W; memcpy(&W,field,sizeof(struct Wtype)); W2U(&W, &U); // density U.d -= drho; #ifdef WRADHYD REAL xion=W.dX/W.d; U.dX = U.d*xion; #endif // momentum U.du -= star->vx * drho; U.dv -= star->vy * drho; U.dw -= star->vz * drho; // internal energy #ifdef DUAL_E U.eint=U.eint*(1.-drho/W.d); // assuming T and x remain constant #endif U2W(&U, &W); // total energy getE(&(W)); W.a=SQRT(GAMMA*W.p/W.d); W.p=FMAX(W.p,PMIN); memcpy(field,&W,sizeof(struct Wtype)); if(isnan(U.du)){ printf("drho=%e vx=%e\n",drho,star->vx); } }
// Print the current time and A/B signal levels on the console void showTime() { unsigned int s = getSeconds(); //-- Newline + whole time every minute if ( s == 0 ) p("\r\n%02u%s:%02u:%02u ", getHours(), getDST() ? "D" : "", getMinutes(), s); else if ( (s % 10 ) == 0) p("%02u", s ); else p("-"); //-- Show the A/B/D/E pulse status, F level if (getA()) p("A"); if (getB()) p("B"); if (getD()) p("D"); if (getE()) p("E"); if (getF()) p("F"); }
int main ( void ) { int i, p=53, q=61; int n = p*q; int f = (p-1)*(q-1), e = getE(f), d = getD(e, f); int data = 123, encry, decry; printf("p = %d, q = %d, f = %d, e = %d, d = %d\ndata = %d\n", p, q, f, e, d, data ); encry = candp(data, e, f); if ( encry == data ) { printf("%s\n","cao"); } printf("the encry is %d\n", encry); decry = candp(encry, d, f); printf("the decry is %d\n", decry); }
static PyObject *_rsky(PyObject *self, PyObject *args) { /* This module computes the distance between the centers of the star and the planet in the plane of the sky. This parameter is denoted r_sky = sqrt(x^2 + y^2) in the Seager Exoplanets book (see the section by Murray, and Winn eq. 5). In the Mandel & Agol (2002) paper, this quantity is denoted d. */ double ecc, E, inc, a, r, d, f, omega, per, M, n, t0, eps, t; //Py_ssize_t i, dims; npy_intp i, dims[1]; PyArrayObject *ts, *zs; if(!PyArg_ParseTuple(args,"Odddddd", &ts, &t0, &per, &a, &inc, &ecc, &omega)) return NULL; dims[0] = PyArray_DIMS(ts)[0]; zs = (PyArrayObject *) PyArray_SimpleNew(1, dims, PyArray_TYPE(ts)); double *t_array = PyArray_DATA(ts); double *z_array = PyArray_DATA(zs); n = 2.*M_PI/per; // mean motion eps = 1.0e-7; for(i = 0; i < dims[0]; i++) { t = t_array[i]; if(ecc > 1.e-5) //calculates f for eccentric orbits { M = n*(t - t0); E = getE(M, ecc); r = a*(1.0 - ecc*cos(E)); f = acos(a*(1.0 - ecc*ecc)/(r*ecc) - 1.0/ecc); if(fabs((a*(1.0 - ecc*ecc)/(r*ecc) -1.0/ecc) - 1.0) < eps) f = 0.0; } else f = ((t-t0)/per - (int)((t-t0)/per))*2.*M_PI; //calculates f for a circular orbit d = a*(1.0-ecc*ecc)/(1.0+ecc*cos(f))*sqrt(1.0 - sin(omega+f)*sin(omega+f)*sin(inc)*sin(inc)); //calculates separation of centers z_array[i] = d; } return PyArray_Return((PyArrayObject *)zs); }
void thermalFeedbackOct(struct RUNPARAMS *param, struct CELL *cell,struct PART *curp, int level, REAL E){ // ---------------------------------------------------------- /// Inject an energy "E" in all cells of the oct contening /// the cell "cell" uniformly on thermal form. // ---------------------------------------------------------- #ifdef SNTEST printf("injecting Energy in thermal form within a oct\n"); #endif // SNTEST //REAL mtot_feedback = curp->mass* param->sn->ejecta_proportion; //REAL dv = POW(0.5,3.*level); //REAL d_e = mtot_feedback/dv ; //curp->mass -= mtot_feedback; struct OCT* oct = cell2oct(cell); int i; for(i=0;i<8;i++){ struct CELL* curcell = &oct->cell[i]; //cell->field.d += d_e/8.; REAL e = E/8.; curcell->field.E += e; curcell->field.p += e*(GAMMA-1.); //Energy conservation #ifdef DUAL_E // struct Utype U; // conservative field structure // W2U(&cell->field, &U); // primitive to conservative // U.eint*=1.+d_e/cell->field.d; // compute new internal energy // U2W(&U, &cell->field); // back to primitive #else // cell->field.p*=1.+d_e/cell->field.d; // compute new internal energy #endif getE(&cell->field); //compute new total energy cell->field.p=FMAX(cell->field.p,PMIN); cell->field.a=SQRT(GAMMA*cell->field.p/cell->field.d); // compute new sound speed } }
double getMatrixLLstartAtRow(matrix_linklist LL, int R){ if(LL==NULL){ return -1; } if(LL->start==NULL){ fprintf(stderr,"ERROR getMatrixLLstartAtRow has error because "); fprintf(stderr,"LL->start is NULL\n"); return -1; } int rows; rows = getRows(LL->start->data); if(R>rows){ fprintf(stderr,"ERROR getMatrixLLstartAtRow R value is larger "); fprintf(stderr,"than the number of rows\n"); return -1; } return getE(LL->start->data,R,1); }
void kineticFeedback_simple(struct RUNPARAMS *param, struct CELL *cell,struct PART *curp, REAL aexp, int level, REAL E){ REAL mtot_feedback = curp->mass* param->sn->ejecta_proportion; curp->mass -= mtot_feedback; struct OCT* oct = cell2oct(cell); int i; for(i=0;i<8;i++){ struct CELL* curcell = &oct->cell[i]; REAL dv = POW(0.5,3*level);// curent volume REAL dir_x[]={-1., 1.,-1., 1.,-1., 1.,-1., 1.};// diagonal projection REAL dir_y[]={-1.,-1., 1., 1.,-1.,-1., 1., 1.}; REAL dir_z[]={-1.,-1.,-1.,-1., 1., 1., 1., 1.}; REAL E_e = E/8.; REAL m_e = mtot_feedback/8.; REAL d_e = m_e/dv; // ejecta density REAL v_e = SQRT(2.*E_e/curcell->field.d); curcell->field.d += m_e/dv; curcell->field.u += v_e*dir_x[i]/SQRT(3.); curcell->field.v += v_e*dir_y[i]/SQRT(3.); curcell->field.w += v_e*dir_z[i]/SQRT(3.); //Energy conservation #ifdef DUAL_E struct Utype U; // conservative field structure W2U(&cell->field, &U); // primitive to conservative U.eint*=1.+d_e/cell->field.d; // compute new internal energy U2W(&U, &cell->field); // back to primitive #else cell->field.p*=1.+d_e/cell->field.d; // compute new internal energy #endif getE(&curcell->field); //compute new total energy curcell->field.p=FMAX(curcell->field.p,PMIN); curcell->field.a=SQRT(GAMMA*curcell->field.p/curcell->field.d); // compute new sound speed } }
int main(int argc, char * argv[]) { int p, q; int n, In; int e; int d; int M, C; int temp = 1; int i; p = 17; q = 11; n = p * q; In = (p - 1)*(q - 1); getE(&e, In); getD(&d, e, In); printf("p = %d, q = %d, d = %d, e = %d, n = %d, In = %d\n", p, q, d, e, n, In); printf("公钥:{%d, %d}, 私钥:{%d, %d}\n", e, n, d, n); printf("输入明文M :"); scanf("%d", &M); //加密 for(i = 0; i < e; i++){ temp = temp * M; if(temp > n){ temp = temp % n; } } printf("加密后:%d\n", temp); C = temp; temp = 1; //解密 for(i = 0; i < d; i++){ temp = temp * C; if(temp > n){ temp = temp % n; } } printf("解密后:%d\n", temp); }
double getMatrixLLNodeElem(matrix_linklist LL, int seq, int R){ if(LL==NULL){ fprintf(stderr,"ERROR LL is NULL in getMatrixLLNodeElem\n"); exit(1); } if(seq<=0){ fprintf(stderr,"ERROR seq is less than or equal to 0 in getMatrixLLNodeElem\n"); exit(1); } if(seq>LL->length){ fprintf(stderr,"ERROR seq is greater than the LL length in getMatrixLLNodeElem\n"); exit(1); } if(R<1){ fprintf(stderr,"ERROR R value is less than 0\n"); exit(1); } int rows; LL_MNode node = LL->start; int sequence = 0; while(node!=NULL){ sequence++; rows = getRows(node->data); if(sequence==seq){ if(R>rows){ fprintf(stderr,"ERROR getMatrixLLNodeElem R is larger than number of rows\n"); fprintf(stderr,"total rows in matrix %d you have requested row %d\n",rows,R); exit(1); } return getE(node->data,R,1); } node=node->next; } return -1; }
int getMatrixLLNumberMatchAtRow(matrix_linklist LL, double match, int R){ #ifdef _ERROR_CHECKING_ON_ if(LL==NULL){ #ifdef _ERROR_ fprintf(stderr,"ERROR LL is NULL in getMatrixLLNumberMatchAtRow\n"); #endif #ifdef _FORCE_HARD_CRASH_ exit(1); #endif return -1; } #endif int rows; LL_MNode node = LL->start; int count = 0; while(node!=NULL){ rows = getRows(node->data); if(R>rows){ fprintf(stderr,"ERROR getMatrixLLNumberMatchAtRow data only\n"); fprintf(stderr," has %d rows but you have requested\n",rows); fprintf(stderr," a match with row %d.\n",R); return -1; } if(getE(node->data,R,1)==match){ count++; } node=node->next; } return count; }
void kineticFeedback_test(struct RUNPARAMS *param, struct CELL *cell,struct PART *curp, REAL aexp, int level, REAL E){ struct OCT* oct = cell2oct(cell); int i; for(i=0;i<8;i++){ struct CELL* curcell = &oct->cell[i]; REAL e = E/8.; REAL v = SQRT(2.*e/curcell->field.d); REAL dir_x[]={-1., 1.,-1., 1.,-1., 1.,-1., 1.};// diagonal projection REAL dir_y[]={-1.,-1., 1., 1.,-1.,-1., 1., 1.}; REAL dir_z[]={-1.,-1.,-1.,-1., 1., 1., 1., 1.}; curcell->field.u = v*dir_x[i]/SQRT(3.); curcell->field.v = v*dir_y[i]/SQRT(3.); curcell->field.w = v*dir_z[i]/SQRT(3.); //Energy conservation curcell->field.p=FMAX(curcell->field.p,PMIN); getE(&curcell->field); //compute new total energy curcell->field.a=SQRT(GAMMA*curcell->field.p/curcell->field.d); // compute new sound speed } }
/* * fill the viterbi matrix and identify the maximum likelihood path * through the system states */ void viterbi(int T, int M, double *X, int *G, double *TH, int N, int R, double *A, int *GS) { // sort of a hack for getting the - infinity value double temp = 1.0; double infinity = -1 * (temp / (temp - 1.0)); // the viterbi matrix as vector double *viterbi = malloc(M * T * R * sizeof(double)); //for(int ind=0; ind!=M*T*R; ++ind) { // viterbi[ind] = 0; //} // indices of most likely states int *maxemissionind = malloc(T * sizeof(int)); double maxemission = infinity, viterbibefore, newem, maxviterbi; for (int t = 0; t != T; ++t) { // all time points viterbibefore = maxemission; maxemission = infinity; for (int m = 0; m != M; ++m) { // all states in gamma int ind = (int)(t*M+m); if (t == 0) { //initialise viterbi[ind] = -log2(M) + getE(X, t, G, m, TH, N, R); } else { int Aind, Vind; double tmp; maxviterbi = infinity; for(int m2=0; m2!=M; ++m2) { Aind = m*M+m2; Vind = (t-1)*M+m2; tmp = A[Aind] + viterbi[Vind]; if(tmp>maxviterbi) { maxviterbi = tmp; } } viterbi[ind] = maxviterbi + getE(X, t, G, m, TH, N, R); } // remember the maximal value in this time point + the // state from which the data point was generated if (viterbi[ind] >= maxemission) { maxemission = viterbi[ind]; maxemissionind[t] = m; } } } // fill the gammaprime matrix for (int t = 0; t != T; t++) { int state = maxemissionind[t]; int startind = (int) t * N * R; for (int r = 0; r != R; r++) { int start = startind + r * N; for (int i = 0; i != N; i++) { GS[(int) (start + i)] = G[(int) (state * N + i)]; } } } // M step: update transition probabilities for sub matrix updateA(A, maxemissionind, M, T); free(maxemissionind); free(viterbi); return; }
// Report that a signal has dropped void showSignalDrop() { p("%s", (getA()||getB()||getD()||getE())?"*":""); }
double KernelNeighborhood::dist(int i, int j, MatrixXd& omege){ return (omege * getE(i, j)).squaredNorm(); }
realkind FieldDataCPU::evaluate_energy(void) { double Ex_t, Ey_t, Ez_t, Emag; double Bx_t, By_t, Bz_t, Bmag; Emag = 0; Bmag = 0; for(int k=0;k<nz;k++) { for(int j=0;j<ny;j++) { for(int i=0;i<nx;i++) { Ex_t = getE(i,j,k,0); Ey_t = getE(i,j,k,1); Ez_t = getE(i,j,k,2); Emag += (Ex_t*Ex_t + 0.0*Ey_t*Ey_t + 0.0*Ez_t*Ez_t); Bx_t = getB(i,j,k,0); By_t = getB(i,j,k,1); Bz_t = getB(i,j,k,2); Bmag += (Bx_t*Bx_t + By_t*By_t + Bz_t*Bz_t); } } } Emag *= 0.5*pdata->dxdi*pdata->xi*pdata->xi; Bmag *= 0.5*pdata->dxdi*pdata->bobzeta; if(pdata->ndimensions == 1) { Bmag /= pdata->ny*pdata->nz*pdata->Lx; Emag /= pdata->ny*pdata->nz*pdata->Lx; } if(pdata->ndimensions > 1) { Bmag *= pdata->dydi/(pdata->nz*pdata->Lx*pdata->Ly); Emag *= pdata->dydi/(pdata->nz*pdata->Lx*pdata->Ly); } if(pdata->ndimensions > 2) { Bmag *= pdata->dzdi; Emag *= pdata->dzdi; } // Emag *= epsilon_0_p*pdata->T0/(pdata->L0*pdata->L0*pdata->q0*pdata->q0); // Bmag *= pdata->m0/(pdata->q0*pdata->q0*pdata->L0*pdata->L0*mu_0_p); // printf("Field Energys E, B = %e, %e \n",Emag, Bmag); realkind energy = Emag+Bmag; return energy; }
double Methods::getZScoreRank(double numberOfInstancesOfWordPair, double numberOfInstancesOfWord1, double numberOfInstancesOfWord2, double numberOfAllInstances) { return (numberOfInstancesOfWordPair - getE(numberOfInstancesOfWord1, numberOfInstancesOfWord2, numberOfAllInstances)) / getD(numberOfInstancesOfWord1, numberOfInstancesOfWord2, numberOfAllInstances); }