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


C++ TMatrix::size方法代码示例

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


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

示例1: Classify

int Classify(TMatrix input, TPoint weights, TVariables *output){
	/* 0. Initialization */
	unsigned int l = input.size(); if (l == 0){return -1;}
	unsigned int p = weights.size(); if (p == 0){return -1;} if (p > input[0].size()){return -1;}
	output->resize(l);
	/* 1. Classification of each point by comparison of their projections to 0 */
	for (unsigned int i = 0; i < l; i++){
		double curSum = 0;
		for (unsigned int j = 0; j < p; j++){curSum += weights[j]*input[i][j];}
		(*output)[i] = (curSum > 0) ? 1 : -1;
	}
	return 0;
}
开发者ID:cran,项目名称:ddalpha,代码行数:13,代码来源:AlphaProcedure.cpp

示例2: ExtendWithProducts

int ExtendWithProducts(TMatrix input, unsigned int upToPower, TMatrix *output){
	unsigned int n = input.size();
	output->resize(n);
	for (unsigned int i = 0; i < n; i++){
		for(unsigned int j = 1; j <= upToPower; j++){
			TPoint extension;
			GetProducts(input[i], j, &extension);
			TPoint::iterator it;
			it = (*output)[i].end();
			(*output)[i].insert(it, extension.begin(), extension.end());
		}
	}
	return 0;
}
开发者ID:cran,项目名称:ddalpha,代码行数:14,代码来源:AlphaProcedure.cpp

示例3: Initialization

int Initialization(TMatrix input, TVariables output, unsigned int minFeatures){
	n = input.size(); if (n == 0){return -1;} // number of points
	if (output.size() != n){return -1;}
	d = input[0].size(); if (d == 0){return -1;} // space dimension		
	if (minFeatures == 0 || minFeatures > 2){return -1;}else{numStartFeatures = minFeatures;}
	
	/* Filling static variables x and y with input and output (transposing x) */
	x.resize(d);
	for (unsigned int i = 0; i < d; i++){
		x[i] = TPoint(n);
		for (unsigned int j = 0; j < n; j++){
			x[i][j] = input[j][i];
		}
	}
	y.resize(n); numLess = 0; numMore = 0;
	difference = 0;
	for (unsigned int i = 0; i < n; i++){
		y[i] = output[i];
		difference += y[i];
		if (y[i] > 0){numMore++;}else{numLess++;}
	}
	return 0;
}
开发者ID:cran,项目名称:ddalpha,代码行数:23,代码来源:AlphaProcedure.cpp


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