本文整理汇总了C++中data::CreateNVP方法的典型用法代码示例。如果您正苦于以下问题:C++ data::CreateNVP方法的具体用法?C++ data::CreateNVP怎么用?C++ data::CreateNVP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data
的用法示例。
在下文中一共展示了data::CreateNVP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
void Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(normalNodeMaxNumChildren, "normalNodeMaxNumChildren");
ar & CreateNVP(splitHistory, "splitHistory");
}
示例2: Serialize
void Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(firstBound, "firstBound");
ar & CreateNVP(secondBound, "secondBound");
ar & CreateNVP(bound, "bound");
ar & CreateNVP(lastDistance, "lastDistance");
}
示例3: CreateNVP
void DrusillaSelect<MatType>::Serialize(Archive& ar,
const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(candidateSet, "candidateSet");
ar & CreateNVP(candidateIndices, "candidateIndices");
ar & CreateNVP(l, "l");
ar & CreateNVP(m, "m");
}
示例4: Serialize
void Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
// We just need to serialize each of the members.
ar & CreateNVP(mean, "mean");
ar & CreateNVP(covariance, "covariance");
ar & CreateNVP(covLower, "covLower");
ar & CreateNVP(invCov, "invCov");
ar & CreateNVP(logDetCov, "logDetCov");
}
示例5: CreateNVP
void EMFit<InitialClusteringType, CovarianceConstraintPolicy>::Serialize(
Archive& ar,
const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(maxIterations, "maxIterations");
ar & CreateNVP(tolerance, "tolerance");
ar & CreateNVP(clusterer, "clusterer");
ar & CreateNVP(constraint, "constraint");
}
示例6: Serialize
void CF::Serialize(Archive& ar, const unsigned int /* version */)
{
// This model is simple; just serialize all the members. No special handling
// required.
using data::CreateNVP;
ar & CreateNVP(numUsersForSimilarity, "numUsersForSimilarity");
ar & CreateNVP(rank, "rank");
ar & CreateNVP(w, "w");
ar & CreateNVP(h, "h");
ar & CreateNVP(cleanedData, "cleanedData");
}
示例7: CreateNVP
void DecisionStump<MatType>::Serialize(Archive& ar,
const unsigned int /* version */)
{
using data::CreateNVP;
// This is straightforward; just serialize all of the members of the class.
// None need special handling.
ar & CreateNVP(classes, "classes");
ar & CreateNVP(bucketSize, "bucketSize");
ar & CreateNVP(splitDimension, "splitDimension");
ar & CreateNVP(split, "split");
ar & CreateNVP(binLabels, "binLabels");
}
示例8: Serialize
void HilbertRTreeAuxiliaryInformation<TreeType ,HilbertValueType>::
Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(hilbertValue, "hilbertValue");
}
示例9: Serialize
void GMM::Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(gaussians, "gaussians");
ar & CreateNVP(dimensionality, "dimensionality");
// Load (or save) the gaussians. Not going to use the default std::vector
// serialize here because it won't call out correctly to Serialize() for each
// Gaussian distribution.
if (Archive::is_loading::value)
dists.resize(gaussians);
for (size_t i = 0; i < gaussians; ++i)
{
std::ostringstream oss;
oss << "dist" << i;
ar & CreateNVP(dists[i], oss.str());
}
ar & CreateNVP(weights, "weights");
}
示例10: Serialize
void RSModel::Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(treeType, "treeType");
ar & CreateNVP(randomBasis, "randomBasis");
ar & CreateNVP(q, "q");
// This should never happen, but just in case...
if (Archive::is_loading::value)
CleanMemory();
// We'll only need to serialize one of the model objects, based on the type.
switch (treeType)
{
case KD_TREE:
ar & CreateNVP(kdTreeRS, "range_search_model");
break;
case COVER_TREE:
ar & CreateNVP(coverTreeRS, "range_search_model");
break;
case R_TREE:
ar & CreateNVP(rTreeRS, "range_search_model");
break;
case R_STAR_TREE:
ar & CreateNVP(rStarTreeRS, "range_search_model");
break;
case BALL_TREE:
ar & CreateNVP(ballTreeRS, "range_search_model");
break;
case X_TREE:
ar & CreateNVP(xTreeRS, "range_search_model");
break;
}
}
示例11: Serialize
void RectangleTree<MetricType, StatisticType, MatType, SplitType, DescentType,
AuxiliaryInformationType>::
Serialize(Archive& ar,
const unsigned int /* version */)
{
using data::CreateNVP;
// Clean up memory, if necessary.
if (Archive::is_loading::value)
{
for (size_t i = 0; i < numChildren; i++)
delete children[i];
children.clear();
if (ownsDataset && dataset)
delete dataset;
}
ar & CreateNVP(maxNumChildren, "maxNumChildren");
ar & CreateNVP(minNumChildren, "minNumChildren");
ar & CreateNVP(numChildren, "numChildren");
// Due to quirks of boost::serialization, depending on how the user serializes
// the tree, the root node may be duplicated. Therefore we don't allow
// children of the root to serialize the parent, and we fix the parent link
// after serializing the children when loading below.
if (Archive::is_saving::value && parent != NULL && parent->Parent() == NULL)
{
RectangleTree* fakeParent = NULL;
ar & CreateNVP(fakeParent, "parent");
}
else
{
ar & CreateNVP(parent, "parent");
}
ar & CreateNVP(begin, "begin");
ar & CreateNVP(count, "count");
ar & CreateNVP(numDescendants, "numDescendants");
ar & CreateNVP(maxLeafSize, "maxLeafSize");
ar & CreateNVP(minLeafSize, "minLeafSize");
ar & CreateNVP(bound, "bound");
ar & CreateNVP(stat, "stat");
ar & CreateNVP(parentDistance, "parentDistance");
ar & CreateNVP(dataset, "dataset");
// If we are loading and we are the root, we own the dataset.
if (Archive::is_loading::value && parent == NULL)
ownsDataset = true;
ar & CreateNVP(points, "points");
ar & CreateNVP(auxiliaryInfo, "auxiliaryInfo");
// Because 'children' holds mlpack types (that have Serialize()), we can't use
// the std::vector serialization.
if (Archive::is_loading::value)
children.resize(numChildren);
for (size_t i = 0; i < numChildren; ++i)
{
std::ostringstream oss;
oss << "child" << i;
ar & CreateNVP(children[i], oss.str());
}
// Fix the parent links for the children, if necessary.
if (Archive::is_loading::value && parent == NULL)
{
// Look through each child individually.
for (size_t i = 0; i < children.size(); ++i)
{
children[i]->ownsDataset = false;
children[i]->Parent() = this;
}
}
}
示例12: Serialize
void Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(start, "start");
ar & CreateNVP(end, "end");
ar & CreateNVP(maxVals, "maxVals");
ar & CreateNVP(minVals, "minVals");
ar & CreateNVP(splitDim, "splitDim");
ar & CreateNVP(splitValue, "splitValue");
ar & CreateNVP(logNegError, "logNegError");
ar & CreateNVP(subtreeLeavesLogNegError, "subtreeLeavesLogNegError");
ar & CreateNVP(subtreeLeaves, "subtreeLeaves");
ar & CreateNVP(root, "root");
ar & CreateNVP(ratio, "ratio");
ar & CreateNVP(logVolume, "logVolume");
ar & CreateNVP(bucketTag, "bucketTag");
ar & CreateNVP(alphaUpper, "alphaUpper");
if (Archive::is_loading::value)
{
if (left)
delete left;
if (right)
delete right;
}
ar & CreateNVP(left, "left");
ar & CreateNVP(right, "right");
}
示例13: Serialize
void FastMKSModel::Serialize(Archive& ar, const unsigned int /* version */)
{
using data::CreateNVP;
ar & CreateNVP(kernelType, "kernelType");
if (Archive::is_loading::value)
{
// Clean memory.
if (linear)
delete linear;
if (polynomial)
delete polynomial;
if (cosine)
delete cosine;
if (gaussian)
delete gaussian;
if (epan)
delete epan;
if (triangular)
delete triangular;
if (hyptan)
delete hyptan;
linear = NULL;
polynomial = NULL;
cosine = NULL;
gaussian = NULL;
epan = NULL;
triangular = NULL;
hyptan = NULL;
}
// Serialize the correct model.
switch (kernelType)
{
case LINEAR_KERNEL:
ar & CreateNVP(linear, "linear_fastmks");
break;
case POLYNOMIAL_KERNEL:
ar & CreateNVP(polynomial, "polynomial_fastmks");
break;
case COSINE_DISTANCE:
ar & CreateNVP(cosine, "cosine_fastmks");
break;
case GAUSSIAN_KERNEL:
ar & CreateNVP(gaussian, "gaussian_fastmks");
break;
case EPANECHNIKOV_KERNEL:
ar & CreateNVP(epan, "epan_fastmks");
break;
case TRIANGULAR_KERNEL:
ar & CreateNVP(triangular, "triangular_fastmks");
break;
case HYPTAN_KERNEL:
ar & CreateNVP(hyptan, "hyptan_fastmks");
break;
}
}
示例14: CreateNVP
void CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>::Serialize(
Archive& ar,
const unsigned int /* version */)
{
using data::CreateNVP;
// If we're loading, and we have children, they need to be deleted. We may
// also need to delete the local metric and dataset.
if (Archive::is_loading::value)
{
for (size_t i = 0; i < children.size(); ++i)
delete children[i];
if (localMetric && metric)
delete metric;
if (localDataset && dataset)
delete dataset;
}
ar & CreateNVP(dataset, "dataset");
ar & CreateNVP(point, "point");
ar & CreateNVP(scale, "scale");
ar & CreateNVP(base, "base");
ar & CreateNVP(stat, "stat");
ar & CreateNVP(numDescendants, "numDescendants");
// Due to quirks of boost::serialization, depending on how the user
// serializes the tree, it's possible that the root of the tree will
// accidentally be serialized twice. So if we are a first-level child, we
// avoid serializing the parent. The true (non-duplicated) parent will fix
// the parent link.
if (Archive::is_saving::value && parent != NULL && parent->Parent() == NULL)
{
CoverTree* fakeParent = NULL;
ar & CreateNVP(fakeParent, "parent");
}
else
{
ar & CreateNVP(parent, "parent");
}
ar & CreateNVP(parentDistance, "parentDistance");
ar & CreateNVP(furthestDescendantDistance, "furthestDescendantDistance");
ar & CreateNVP(metric, "metric");
if (Archive::is_loading::value && parent == NULL)
{
localMetric = true;
localDataset = true;
}
// Lastly, serialize the children.
size_t numChildren = children.size();
ar & CreateNVP(numChildren, "numChildren");
if (Archive::is_loading::value)
children.resize(numChildren);
for (size_t i = 0; i < numChildren; ++i)
{
std::ostringstream oss;
oss << "child" << i;
ar & CreateNVP(children[i], oss.str());
}
if (Archive::is_loading::value && parent == NULL)
{
// Look through each child individually.
for (size_t i = 0; i < children.size(); ++i)
{
children[i]->localMetric = false;
children[i]->localDataset = false;
children[i]->Parent() = this;
}
}
}
示例15: CreateNVP
void RangeSearch<MetricType, MatType, TreeType>::Serialize(
Archive& ar,
const unsigned int /* version */)
{
using data::CreateNVP;
// Serialize preferences for search.
ar & CreateNVP(naive, "naive");
ar & CreateNVP(singleMode, "singleMode");
// Reset base cases and scores if we are loading.
if (Archive::is_loading::value)
{
baseCases = 0;
scores = 0;
}
// If we are doing naive search, we serialize the dataset. Otherwise we
// serialize the tree.
if (naive)
{
if (Archive::is_loading::value)
{
if (setOwner && referenceSet)
delete referenceSet;
setOwner = true;
}
ar & CreateNVP(referenceSet, "referenceSet");
ar & CreateNVP(metric, "metric");
// If we are loading, set the tree to NULL and clean up memory if necessary.
if (Archive::is_loading::value)
{
if (treeOwner && referenceTree)
delete referenceTree;
referenceTree = NULL;
oldFromNewReferences.clear();
treeOwner = false;
}
}
else
{
// Delete the current reference tree, if necessary and if we are loading.
if (Archive::is_loading::value)
{
if (treeOwner && referenceTree)
delete referenceTree;
// After we load the tree, we will own it.
treeOwner = true;
}
ar & CreateNVP(referenceTree, "referenceTree");
ar & CreateNVP(oldFromNewReferences, "oldFromNewReferences");
// If we are loading, set the dataset accordingly and clean up memory if
// necessary.
if (Archive::is_loading::value)
{
if (setOwner && referenceSet)
delete referenceSet;
referenceSet = &referenceTree->Dataset();
metric = referenceTree->Metric(); // Get the metric from the tree.
setOwner = false;
}
}
}