本文整理汇总了C++中arma::mat::size方法的典型用法代码示例。如果您正苦于以下问题:C++ mat::size方法的具体用法?C++ mat::size怎么用?C++ mat::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arma::mat
的用法示例。
在下文中一共展示了mat::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sW
std::vector<std::vector<float>>
signatureWindows(arma::mat &path, int logSigDepth, int windowSize) {
std::vector<std::vector<float>> sW(path.n_rows);
std::vector<float> repPath;
for (int i = 0; i < path.n_rows; ++i) {
repPath.push_back(i);
repPath.push_back(path(i, 0));
repPath.push_back(path(i, 1));
}
for (int i = 0; i < path.size(); ++i) {
sW[i].resize(logsigdim(3, logSigDepth));
int first = std::max(0, i - windowSize);
int last = std::min((int)path.size() - 1, i + windowSize);
logSignature(&repPath[3 * first], last - first + 1, 3, logSigDepth,
&sW[i][0]);
}
return sW;
}
示例2: fit
void Gaussian::fit(const arma::mat& data)
{
if(data.size() > 0){
D = data.n_rows;
Mean = arma::mean(data);
Covariance = arma::cov(data);
A = arma::chol(Covariance);
det = arma::det(Covariance);
}
}
示例3: twoVecHetDet
/**
*
* @param vector1 first individual
* @param vector2 second individual
* @return recombination sites
*/
arma::mat twoVecHetDet(const arma::mat &vector1, const arma::mat & vector2)
{
arma::mat sum2vec(1, vector1.size());
sum2vec.zeros();
sum2vec = vector1 + vector2;
arma::mat result(1, vector1.size());
result.zeros();
int previous = 0, previousLocation = 0;
for (uint i = 0; i < vector1.size(); i++)
{
if (sum2vec[i] == 0 || sum2vec[i] == 2 || sum2vec[i] == 4)
{
previous = sum2vec[i];
previousLocation = i;
break;
}
}
for (uint i = previousLocation; i < vector1.size(); i++)
{
if (sum2vec[i] == 0 || sum2vec[i] == 2 || sum2vec[i] == 4)
{
if (abs(previous - sum2vec[i]) == 2)
{
for (uint j = previousLocation; j < i; j++)
result[j] = 1;
previous = sum2vec[i];
previousLocation = i;
}
else if (sum2vec[i] == 0 || sum2vec[i] == 2 || sum2vec[i] == 4)
{
previous = sum2vec[i];
previousLocation = i;
}
}
}
return (result);
}
示例4: b
arma::vec mat2vec(arma::mat y)
{
arma::vec b(y.begin(), y.size(), /*copy_aux_mem*/false, /*strict*/true);
return b;
}