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


C++ Dims::getNumberOfElements方法代码示例

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


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

示例1: event


//.........这里部分代码省略.........
			for (UINT32 i=0; i < iif.getNumberOfPorts(); i++) {
				hInputs[0].push_back(iif.getPort(i));
			}
			
			event.response = C_OK;
			return;
			
		}
		
		
		case EVENT_STATE_SET:
		{
			/* ######################################################### */
			// create operation sets
			hSets.push_back(iif.getSet("add"));
			hSets.push_back(iif.getSet("shunt"));
			hSets.push_back(iif.getSet("shunt_dev"));
				
			/* ######################################################### */
			
			//	create and seed RNG
			rng = coreCreateUtility(hComponent, "dev/std/util/rng", 0);
			dev_std_util_rng::select(hComponent, rng, "MT2000.normal");
			dev_std_util_rng::seed(hComponent, rng, &(*event.state.seed)[0], event.state.seed->size());
			
			/*
				Extracting the data from the state MatML file - reality checking as we go...
			*/
			
			
			MatMLNode nodePars(event.xmlNode);
			
			// get dimensions
			VUINT64 dims_temp = nodePars.getField("dims").getArrayUINT64();
			for (UINT32 i=0; i < dims_temp.size(); i++) {
				dims.push_back(dims_temp[i]);
			}
			
			count = dims.getNumberOfElements();
			
			membrane.resize(count, 0);
			
			// get the args
			if (nodePars.hasField("tau_membrane")) {
				tau_membrane = nodePars.getField("tau_membrane").getArraySINGLE();
			}
			UINT32 N = tau_membrane.size();
			
			if (nodePars.hasField("sigma_membrane")) {
				sigma_membrane = nodePars.getField("sigma_membrane").validate(Dims(N)).getArraySINGLE();
			}
			
			if (nodePars.hasField("p")) {
				p_v = nodePars.getField("p").validate(Dims(N)).getArraySINGLE();
			}
			
			if (nodePars.hasField("pos_reversal_potential")) {
				pos_reversal_potential = nodePars.getField("pos_reversal_potential").validate(Dims(N)).getArraySINGLE();
			}
			
			if (nodePars.hasField("neg_reversal_potential")) {
				neg_reversal_potential = nodePars.getField("neg_reversal_potential").validate(Dims(N)).getArraySINGLE();
			}
			
			lambda_membrane.resize(count);
			lambda_membrane_reciprocal.resize(count);
			if (N == 1) {
				tau_membrane.resize(count, tau_membrane[0]);
				sigma_membrane.resize(count, sigma_membrane[0]);
				p_v.resize(count, p_v[0]);
				pos_reversal_potential.resize(count, pos_reversal_potential[0]);
				neg_reversal_potential.resize(count, neg_reversal_potential[0]);
			}
			else if (N != count) {
				berr << "pars are of incorrect size!";
			}
			
			for (UINT32 i=0; i<count; i++) {
				lambda_membrane[i] = exp(-1.0 / (tau_membrane[i] * sampleRateToRate(time.sampleRate)));
				lambda_membrane_reciprocal[i] = 1.0 - lambda_membrane[i];
			}
			
			
			//	ok
			event.response = C_OK;
			return;
		}


//#include "events.cpp"


	}

	//	raise an exception if you run into trouble during event(). the return value
	//	indicates whether you processed the event.


	
}
开发者ID:BRAHMS-SystemML,项目名称:brahms,代码行数:101,代码来源:modlin_activation_leaky.cpp


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