當前位置: 首頁>>代碼示例>>C++>>正文


C++ std::conj方法代碼示例

本文整理匯總了C++中std::conj方法的典型用法代碼示例。如果您正苦於以下問題:C++ std::conj方法的具體用法?C++ std::conj怎麽用?C++ std::conj使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在std的用法示例。


在下文中一共展示了std::conj方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: gfFluxTE

// TE flux from Green's functions
//   extra factor of kp (elsewhere in the integrand) to make dimensionless
// if integrate==true (default), then integral over emitter layer 
//   done analytically. In this case xs = thickness of layer s
// if integrate==false, then xs is the location of the emitter
cdouble gfFluxTE(const SMatrix &S, const pwaves &pTE, 
				int l, int s, double zl, double xs, bool integrate) {
	cdouble kzl = S.kz[l];
	cdouble kzs = S.kz[s];
	cdouble kp = S.kp;
	cdouble xl = II * kzl * zl; 
	cdouble A = pTE.Al * exp(xl);
	cdouble B = pTE.Bl * exp(-xl);
	cdouble C = pTE.Cl * exp(xl);
	cdouble D = pTE.Dl * exp(-xl);

	cdouble fTE = 0;
	int gES[4] = {-1,-1,+1,+1}; // signs in exponent terms
	int gHS[4] = {+1,+1,-1,-1};

	cdouble (*spaceFx)(int, int, cdouble, double);
	if (integrate)
		spaceFx = zsInt;
	else
		spaceFx = zsProd;

	// Note the overall neg. sign below
	cdouble prefac = II * kp / (4. * kzs) * conj(kzl / kzs);
	cdouble gEtt[4] = {A, B, C, D};
	cdouble gHpt[4] = {A, -B, C, -D};
	for (int i=0; i<4; ++i)
		for (int j=0; j<4; ++j)
			fTE -= prefac * gEtt[i] * conj(gHpt[j]) * spaceFx(gES[i], gHS[j], kzs, xs);
	
	return fTE;
}
開發者ID:odmiller,項目名稱:MultilayerEM,代碼行數:36,代碼來源:fieldFunctions.cpp

示例2: reflTrans

void reflTrans(const mlgeo &g, double k0, double theta, int pol, 
				cdouble *r, double *R, cdouble *t, double *T) {
	SMatrix S = new SMatrix(g, k0, k0 * sin(theta));
	*r = S->S21(0, g.N, pol);
	*t = S->S11(0, g.N, pol);
	*R = (*r) * conj(*r); 
	*T = real(sqrt(g.eps(N))) / real(sqrt(g.eps(0))) * (*t) * conj(*t); 
}
開發者ID:odmiller,項目名稱:MultilayerEM,代碼行數:8,代碼來源:fieldFunctions.cpp

示例3: conj

Vector<T> Vector<T>::conjugate(const Vector &vec) const
{
  iSize = vec.size();
  T *vecPtr = new T[iSize];
  for(long i = 0; i < iSize; i++)
    vecPtr[i] = conj(vec.ptrArray[i]);

  return Vector<T>(iSize, vecPtr);
}
開發者ID:ingeekim,項目名稱:VectorC-Template,代碼行數:9,代碼來源:Vector.hpp

示例4: gfFluxTM

// TM flux from Green's functions
cdouble gfFluxTM(const SMatrix &S, const pwaves &pTM, 
				int l, int s, double zl, double xs, bool integrate) {
	cdouble kzl = S.kz[l];
	cdouble kzs = S.kz[s];
	cdouble kl = S.k[l];
	cdouble ks = S.k[s];
	cdouble kp = S.kp;
	cdouble xl = II * kzl * zl; 
	cdouble A = pTM.Al * exp(xl);
	cdouble B = pTM.Bl * exp(-xl);
	cdouble C = pTM.Cl * exp(xl);
	cdouble D = pTM.Dl * exp(-xl);

	cdouble fTM = 0;
	int gES[4] = {-1,-1,+1,+1}; // signs in exponent terms
	int gHS[4] = {+1,+1,-1,-1};

	cdouble (*spaceFx)(int, int, cdouble, double);
	if (integrate)
		spaceFx = zsInt;
	else
		spaceFx = zsProd;

	// TM1
	cdouble prefac = II * kzl * kp / (4. * ks * kl) * conj(kl / ks);
	cdouble gEpp[4] = {A, -B, -C, D};
	cdouble gHtp[4] = {-A, -B, C, D};
	for(int i=0; i<4; ++i)
		for(int j=0; j<4; ++j)
			fTM += prefac * gEpp[i] * conj(gHtp[j]) * spaceFx(gES[i], gHS[j], kzs, xs); 

	// TM2
	prefac *= kp * conj(kp) / (kzs * conj(kzs));
	cdouble gEpz[4] = {-A, B, -C, D};
	cdouble gHtz[4] = {A, B, C, D};
	for(int i=0; i<4; ++i)
		for(int j=0; j<4; ++j)
			fTM += prefac * gEpz[i] * conj(gHtz[j]) * spaceFx(gES[i], gHS[j], kzs, xs);
	
	return fTM;
}
開發者ID:odmiller,項目名稱:MultilayerEM,代碼行數:42,代碼來源:fieldFunctions.cpp

示例5: dZdE_thg

/**	Calculates the gradient of the Z error for THG.
 *
 *	\param Esigp	the magnitude replaced Esig(t,tau).
 *	\param Et		the current best guess.
 *	\param dZ		the gradient. 
 */
void dZdE_thg(const TmexArray &Esigp, const TmexArray &Et, TmexArray &dZ)
{
	int M = Esigp.size_M();	// The number of time points.
	int N = Esigp.size_N();	// The number of delay points.
	TReal sz = Esigp.size();
	
	for(int t0 = 0; t0 < M; ++t0)
	{
		TCmplx T(0.0,0.0);
		for(int tau = 0; tau < N; ++tau) {
			int tp = t0 - (tau - N/2);
			if (tp >= 0 && tp < M) {
				T += (Et[t0] * Et[tp] * Et[tp] - Esigp(t0,tau)) * conj(Et[tp] * Et[tp]);
			}
			tp = t0 + (tau - N/2);
			if (tp >= 0 && tp < M) {
				T += 2.0 * conj(Et[tp] * Et[t0]) * (Et[tp] * Et[t0] * Et[t0] - Esigp(tp,tau));
			}
		}
		dZ[t0] = T/sz;
	}
}
開發者ID:fboehle,項目名稱:Frog-Frog,代碼行數:28,代碼來源:dZdE_thg.cpp

示例6: zsProd

// product of exponential terms arising in Green's function computations
cdouble zsProd(int s1, int s2, cdouble kzs, double zs) {
	return exp(II * zs * (double(s1) * kzs + double(s2) * conj(kzs)));
}
開發者ID:odmiller,項目名稱:MultilayerEM,代碼行數:4,代碼來源:fieldFunctions.cpp


注:本文中的std::conj方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。