本文整理汇总了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;
}
示例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;
}
示例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;
}