本文整理汇总了C++中MatrixPtr::cwiseProduct方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixPtr::cwiseProduct方法的具体用法?C++ MatrixPtr::cwiseProduct怎么用?C++ MatrixPtr::cwiseProduct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixPtr
的用法示例。
在下文中一共展示了MatrixPtr::cwiseProduct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: K
static MatrixPtr K(const Hyp &logHyp,
GeneralTrainingData<Scalar> &generalTrainingData,
const int pdHypIndex = -1)
{
// Assertions only in the begining of the public static member functions which can be accessed outside.
// The hyparparameter index should be less than the number of hyperparameters
assert(pdHypIndex < logHyp.size());
// copy hyperparameters
Cov1::Hyp logHyp1;
Cov2::Hyp logHyp2;
copy(logHyp, logHyp1, logHyp2);
// output
MatrixPtr pK;
// covariance matrix
if(pdHypIndex < 0)
{
// Cov = Cov1 * Cov2
pK = Cov1::K(logHyp1, generalTrainingData, pdHypIndex); // Cov1
pK->noalias() = pK->cwiseProduct(*Cov2::K(logHyp2, generalTrainingData, pdHypIndex)); // Cov2
}
// partial derivatives of covariance matrix
else
{
// dCov1
if(pdHypIndex < Cov1::N - 1)
{
// dCov = dCov1*Cov2
pK = Cov1::K(logHyp1, generalTrainingData, pdHypIndex); // dCov1
pK->noalias() = pK->cwiseProduct(*Cov2::K(logHyp2, generalTrainingData, -1)); // Cov2
}
else if(pdHypIndex == N - 1)
{
// dCov = dCov1*dCov2
pK = Cov1::K(logHyp1, generalTrainingData, logHyp1.size()-1); // dCov1
pK->noalias() = pK->cwiseProduct(*Cov2::K(logHyp2, generalTrainingData, logHyp2.size()-1)); // dCov2
}
// dCov2
else
{
// dCov = Cov1*dCov2
pK = Cov1::K(logHyp1, generalTrainingData, -1); // Cov1
pK->noalias() = pK->cwiseProduct(*Cov2::K(logHyp2, generalTrainingData, pdHypIndex - Cov1::N - 1)); // dCov2
}
}
return pK;
}
示例2: Ks
static MatrixPtr Ks(const Hyp &logHyp,
const GeneralTrainingData<Scalar> &generalTrainingData,
const TestData<Scalar> &testData)
{
// copy hyperparameters
Cov1::Hyp logHyp1;
Cov2::Hyp logHyp2;
copy(logHyp, logHyp1, logHyp2);
// Cov = Cov1 * Cov2
MatrixPtr pKs = Cov1::Ks(logHyp1, generalTrainingData, testData); // Cov1
pKs->noalias() = pKs->cwiseProduct(*Cov2::Ks(logHyp2, generalTrainingData, testData)); // Cov2
return pKs;
}
示例3: Kss
static MatrixPtr Kss(const Hyp &logHyp,
const TestData<Scalar> &testData,
const bool fVarianceVector = true)
{
// copy hyperparameters
Cov1::Hyp logHyp1;
Cov2::Hyp logHyp2;
copy(logHyp, logHyp1, logHyp2);
// Cov = Cov1 * Cov2
MatrixPtr pKss = Cov1::Kss(logHyp1, testData, fVarianceVector); // Cov1
pKss->noalias() = pKss->cwiseProduct(*Cov2::Kss(logHyp2, testData, fVarianceVector)); // Cov2
return pKss;
}