当前位置: 首页>>代码示例>>C++>>正文


C++ Gaussian::getSum方法代码示例

本文整理汇总了C++中Gaussian::getSum方法的典型用法代码示例。如果您正苦于以下问题:C++ Gaussian::getSum方法的具体用法?C++ Gaussian::getSum怎么用?C++ Gaussian::getSum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gaussian的用法示例。


在下文中一共展示了Gaussian::getSum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: average

/**
 * Print Statistics for the generated Packets
 *
 * Description:\n
 * Prints Total number of packets sent, the elapsed time,
 * the mean power, mean real and imaginary values for the samples
 * for both LCP and RCP
 *
 */
void
printStatistics()
{
	timeval end;
	gettimeofday(&end, NULL);

	int32_t sec = end.tv_sec - start.tv_sec;
	int32_t usec = end.tv_usec - start.tv_usec;
	if (usec < 0) {
		usec += 1000000;
		--sec;
	}
	cout << packet << " packets sent in "
		<< sec << "." << usec << " seconds" << endl;
	int32_t maxQueue = sndX->getSendHWM();
	cout << "maximum output queue X " << maxQueue << endl;
	maxQueue = sndY->getSendHWM();
	cout << "maximum output queue Y " << maxQueue << endl;

	int64_t samples;
	float64_t total;
	ComplexFloat64 power;
	ComplexFloat64 fSum;
	ComplexInt64 iSum;
/**
*	 X pol Statistics
*/
	samples = genX.getSampleCnt();
	power = genX.getPower();
	total = power.real() + power.imag();
	cout << "X pol" << endl;
	cout << samples << " samples, average (float) sample power = ";
	cout << total / samples << endl;
	cout << "power (float): re = " << power.real() << ", im = " << power.imag();
	cout << ", total = " << total << endl;
#ifdef notdef
	power = genX.getIntegerPower();
	total = power.real() + power.imag();
	cout << samples << " samples, average (short) sample power = ";
	cout << total / samples << endl;
	cout << "power (integer): re = " << power.real() << ", im = ";
	cout << power.imag() << ", total = " << total << endl;
#endif
	fSum = genX.getSum();
	cout << "sum of amplitudes (float64) = (" << fSum.real();
	cout << ", " << fSum.imag() << ")" << endl;
	cout << "avg of amplitudes (float64) = (" << fSum.real() / samples;
	cout << ", " << fSum.imag() / samples << ")" << endl;
#ifdef notdef
	iSum = genX.getIntegerSum();
	cout << "sum of amplitudes (short) = (" << iSum.real();
	cout << ", " << iSum.imag() << ")" << endl;
	cout << "avg of amplitudes (short) = (";
	cout << (float64_t) iSum.real() / samples;
	cout << ", " << (float64_t) iSum.imag() / samples << ")" << endl;
#endif

/**
*	 Y pol Statistics
*/
	samples = genY.getSampleCnt();
	power = genY.getPower();
	total = power.real() + power.imag();
	cout << "Y pol" << endl;
	cout << samples << " samples, average (float) sample power = ";
	cout << total / samples << endl;
	cout << "power (float): re = " << power.real() << ", im = " << power.imag();
	cout << ", total = " << total << endl;
#ifdef notdef
	power = genY.getIntegerPower();
	total = power.real() + power.imag();
	cout << samples << " samples, average (short) sample power = ";
	cout << total / samples << endl;
	cout << "power (integer): re = " << power.real() << ", im = ";
	cout << power.imag() << ", total = " << total << endl;
#endif
	fSum = genY.getSum();
	cout << "sum of amplitudes (float64) = (" << fSum.real();
	cout << ", " << fSum.imag() << ")" << endl;
	cout << "avg of amplitudes (float64) = (" << fSum.real() / samples;
	cout << ", " << fSum.imag() / samples << ")" << endl;
#ifdef notdef
	iSum = genY.getIntegerSum();
	cout << "sum of amplitudes (short) = (" << iSum.real();
	cout << ", " << iSum.imag() << ")" << endl;
	cout << "avg of amplitudes (short) = (";
	cout << (float64_t) iSum.real() / samples;
	cout << ", " << (float64_t) iSum.imag() / samples << ")" << endl;
#endif
}
开发者ID:Abhishekpatil,项目名称:SonATA,代码行数:99,代码来源:packetgen.cpp


注:本文中的Gaussian::getSum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。