本文整理汇总了C++中TPoint::size方法的典型用法代码示例。如果您正苦于以下问题:C++ TPoint::size方法的具体用法?C++ TPoint::size怎么用?C++ TPoint::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPoint
的用法示例。
在下文中一共展示了TPoint::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetProducts
static int GetProducts(TPoint values, unsigned int power, TPoint *output){
int d = values.size();
if (power == 1){
output->resize(d);
for (int i = 0; i < d; i++){(*output)[i] = values[i];}
return 0;
}
output->resize(0);
TVariables indices(power);
unsigned int counter = 0;
while(indices[0] < d){
output->push_back(1);
for (unsigned int i = 0; i < power; i++){
(*output)[counter] *= values[indices[i]];
}
counter++;
int lastArray = power - 1;
while(lastArray > 0 && indices[lastArray] == d - 1){lastArray--;}
indices[lastArray]++;
for (unsigned int i = lastArray; i < power; i++){
indices[i] = indices[lastArray];
}
}
return 0;
}
示例2: 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;
}